[10.0.34.dev] Gestion des notices

This commit is contained in:
fredtempez 2019-10-19 15:23:56 +02:00
parent c6aa384f12
commit 6a8c0d27a1
2 changed files with 16 additions and 11 deletions

View File

@ -31,7 +31,7 @@ class common {
const TEMP_DIR = 'site/tmp/'; const TEMP_DIR = 'site/tmp/';
// Numéro de version // Numéro de version
const ZWII_VERSION = '10.0.33.dev'; const ZWII_VERSION = '10.0.34.dev';
public static $actions = []; public static $actions = [];
public static $coreModuleIds = [ public static $coreModuleIds = [
@ -901,10 +901,15 @@ class common {
} }
/** /**
* Insert des données * Sauvegarde des données
* @param array $keys Clé(s) des données * @param array $keys Clé(s) des données
*/ */
public function setData($keys = NULL) { public function setData($keys = NULL) {
// Pas d'enregistrement lorsque'une notice est présente
if (!empty(self::$inputNotices)) {
return;
}
//Retourne une chaine contenant le dossier à créer //Retourne une chaine contenant le dossier à créer
$folder = $this->dirData ($keys[0],$this->geti18n()); $folder = $this->dirData ($keys[0],$this->geti18n());
@ -916,6 +921,7 @@ class common {
'dir' => $folder, 'dir' => $folder,
'template' => self::TEMP_DIR . 'data.template.json' 'template' => self::TEMP_DIR . 'data.template.json'
]); ]);
switch(count($keys)) { switch(count($keys)) {
case 2: case 2:
$db->set($keys[0],$keys[1]); $db->set($keys[0],$keys[1]);
@ -1402,6 +1408,7 @@ class core extends common {
$action .= ucfirst($actionPart); $action .= ucfirst($actionPart);
} }
} }
$action = array_key_exists($action, $module::$actions) ? $action : 'index'; $action = array_key_exists($action, $module::$actions) ? $action : 'index';
if(array_key_exists($action, $module::$actions)) { if(array_key_exists($action, $module::$actions)) {
$module->$action(); $module->$action();
@ -1430,13 +1437,12 @@ class core extends common {
} }
} }
} }
// Sinon traitement des données de sortie qui requiert qu'aucune notice ne soit présente // Sinon traitement des données de sortie qui requiert qu'aucune notice soit présente
else { else {
// Enregistrement des données // Enregistrement des données
if($output['state'] !== false) { //if($output['state'] !== false) {
$this->setData([$module->getData()]); //$this->setData([$module->getData()]);
} //}
// Notification // Notification
if($output['notification']) { if($output['notification']) {
if($output['state'] === true) { if($output['state'] === true) {

View File

@ -34,8 +34,7 @@ class install extends common {
if($this->getData(['user']) !== []) { if($this->getData(['user']) !== []) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
//'access' => false 'access' => false
'redirect' => helper::baseUrl(false)
]); ]);
} }
// Accès autorisé // Accès autorisé
@ -89,7 +88,7 @@ class install extends common {
$this->createRobots(); $this->createRobots();
// Créer sitemap // Créer sitemap
$this->createSitemap('all'); $this->createSitemap('all');
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl(false), 'redirect' => helper::baseUrl(false),
'notification' => ($sent === true ? 'Installation terminée' : $sent), 'notification' => ($sent === true ? 'Installation terminée' : $sent),