From 30f72c685934223d54a09674e151f0f8c2ff6336 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 9 Mar 2021 16:38:02 +0100 Subject: [PATCH] Module Install from store WIP --- core/module/addon/addon.php | 20 +++++++++++++++----- core/module/addon/view/store/store.php | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/core/module/addon/addon.php b/core/module/addon/addon.php index 46b31954..2a225c66 100644 --- a/core/module/addon/addon.php +++ b/core/module/addon/addon.php @@ -217,6 +217,13 @@ class addon extends common { public function store() { $url = 'http://zwiicms.fr/?modules-2/list'; $store = json_decode(helper::urlGetContents($url), true); + // Modules installés + $infoModules = helper::getModules(); + // Clés moduleIds dans les pages + $inPages = helper::arrayCollumn($this->getData(['page']),'moduleId', 'SORT_DESC'); + foreach( $inPages as $key=>$value){ + $inPagesTitle[ $this->getData(['page', $key, 'title' ]) ] = $value; + } // Parcourir les données des modules foreach ($store as $key=>$value) { self::$storeList [] = [ @@ -225,11 +232,14 @@ class addon extends common { mb_detect_encoding(strftime('%d %B %Y', $store[$key]['fileDate']), 'UTF-8', true) ? strftime('%d %B %Y', $store[$key]['fileDate']) : utf8_encode(strftime('%d %B %Y', $store[$key]['fileDate'])), - template::button('moduleExport' . $key, [ - 'class' => 'buttonBlue', - 'href' => helper::baseUrl(). $this->getUrl(0) . '/installModule/' . $key.'/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre - 'value' => template::ico('download') - ]) + implode(', ',array_keys($inPages,$key)) === '' + ? template::button('moduleExport' . $key, [ + 'class' => 'buttonBlue', + 'href' => helper::baseUrl(). $this->getUrl(0) . '/installModule/' . $key.'/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre + 'value' => template::ico('download') + ]) + : '' + ]; } // Valeurs en sortie diff --git a/core/module/addon/view/store/store.php b/core/module/addon/view/store/store.php index d7b6029a..8e746ba5 100644 --- a/core/module/addon/view/store/store.php +++ b/core/module/addon/view/store/store.php @@ -2,7 +2,7 @@
'buttonGrey', - 'href' => helper::baseUrl(), + 'href' => helper::baseUrl() . 'addon', 'ico' => 'left', 'value' => 'Retour' ]); ?>