Module Install from store WIP

This commit is contained in:
Fred Tempez 2021-03-09 16:38:02 +01:00
parent a0a259f92f
commit 30f72c6859
2 changed files with 16 additions and 6 deletions

View File

@ -217,6 +217,13 @@ class addon extends common {
public function store() { public function store() {
$url = 'http://zwiicms.fr/?modules-2/list'; $url = 'http://zwiicms.fr/?modules-2/list';
$store = json_decode(helper::urlGetContents($url), true); $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 // Parcourir les données des modules
foreach ($store as $key=>$value) { foreach ($store as $key=>$value) {
self::$storeList [] = [ self::$storeList [] = [
@ -225,11 +232,14 @@ class addon extends common {
mb_detect_encoding(strftime('%d %B %Y', $store[$key]['fileDate']), 'UTF-8', true) mb_detect_encoding(strftime('%d %B %Y', $store[$key]['fileDate']), 'UTF-8', true)
? strftime('%d %B %Y', $store[$key]['fileDate']) ? strftime('%d %B %Y', $store[$key]['fileDate'])
: utf8_encode(strftime('%d %B %Y', $store[$key]['fileDate'])), : utf8_encode(strftime('%d %B %Y', $store[$key]['fileDate'])),
template::button('moduleExport' . $key, [ implode(', ',array_keys($inPages,$key)) === ''
'class' => 'buttonBlue', ? template::button('moduleExport' . $key, [
'href' => helper::baseUrl(). $this->getUrl(0) . '/installModule/' . $key.'/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre 'class' => 'buttonBlue',
'value' => template::ico('download') '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 // Valeurs en sortie

View File

@ -2,7 +2,7 @@
<div class="col2"> <div class="col2">
<?php echo template::button('configStoreBack', [ <?php echo template::button('configStoreBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl(), 'href' => helper::baseUrl() . 'addon',
'ico' => 'left', 'ico' => 'left',
'value' => 'Retour' 'value' => 'Retour'
]); ?> ]); ?>