diff --git a/core/module/install/install.php b/core/module/install/install.php index bb05ab5d..89e4babe 100644 --- a/core/module/install/install.php +++ b/core/module/install/install.php @@ -18,6 +18,7 @@ class install extends common { public static $actions = [ 'index' => self::GROUP_VISITOR, + "postinstall" => self::GROUP_VISITOR, 'steps' => self::GROUP_ADMIN, 'update' => self::GROUP_ADMIN ]; @@ -75,11 +76,55 @@ class install extends common { // source: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes ]; - /** - * Installation + * Pré-installation - choix de la langue */ public function index() { + // Accès refusé + if($this->getData(['user']) !== []) { + // Valeurs en sortie + $this->addOutput([ + 'access' => false + ]); + } + // Accès autorisé + else { + // Soumission du formulaire + if($this->isPost()) { + $this->setData(['config', 'i18n', 'interface', $this->getInput('installLanguage')]); + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . 'install/postinstall' + ]); + } + } + + // Liste des langues UI disponibles + if (is_dir(self::I18N_DIR)) { + $dir = getcwd(); + chdir(self::I18N_DIR); + $files = glob('*.json'); + // Ajouter une clé au tableau avec le code de langue + foreach( $files as $file) { + // La langue est-elle référencée ? + if (array_key_exists(basename($file, '.json'), self::$languagesUI)) { + self::$i18nFiles[basename($file, '.json')] = self::$languagesUI[basename($file, '.json')]; + } + } + chdir($dir); + } + + $this->addOutput([ + 'display' => self::DISPLAY_LAYOUT_LIGHT, + 'title' => 'Installation', + 'view' => 'index' + ]); + } + + /** + * post Installation + */ + public function postInstall() { // Accès refusé if($this->getData(['user']) !== []) { // Valeurs en sortie @@ -204,21 +249,6 @@ class install extends common { $dataThemes = json_decode($dataThemes, true); self::$themes = helper::arrayColumn($dataThemes, 'name'); - // Liste des langues UI disponibles - if (is_dir(self::I18N_DIR)) { - $dir = getcwd(); - chdir(self::I18N_DIR); - $files = glob('*.json'); - // Ajouter une clé au tableau avec le code de langue - foreach( $files as $file) { - // La langue est-elle référencée ? - if (array_key_exists(basename($file, '.json'), self::$languagesUI)) { - self::$i18nFiles[basename($file, '.json')] = self::$languagesUI[basename($file, '.json')]; - } - } - chdir($dir); - } - // Créer sitemap $this->createSitemap(); // Mise à jour de la liste des pages pour TinyMCE @@ -228,7 +258,7 @@ class install extends common { $this->addOutput([ 'display' => self::DISPLAY_LAYOUT_LIGHT, 'title' => 'Installation', - 'view' => 'index' + 'view' => 'postinstall' ]); } } diff --git a/core/module/install/view/index/index.css b/core/module/install/view/index/index.css index d7c543b0..e69de29b 100755 --- a/core/module/install/view/index/index.css +++ b/core/module/install/view/index/index.css @@ -1 +0,0 @@ -/* Vide */ \ No newline at end of file diff --git a/core/module/install/view/index/index.php b/core/module/install/view/index/index.php index 7fff68de..0717b540 100644 --- a/core/module/install/view/index/index.php +++ b/core/module/install/view/index/index.php @@ -1,100 +1,20 @@ -

- -

- -

- -

-
-
-
- 'off', - 'label' => 'Identifiant' - ]); ?> -
-
-
-
- 'off', - 'label' => 'Mot de passe' - ]); ?> -
-
- 'off', - 'label' => 'Confirmation' - ]); ?> -
-
- 'off', - 'label' => 'Adresse mail' - ]); ?> -
-
- 'off', - 'label' => 'Prénom' - ]); ?> -
-
- 'off', - 'label' => 'Nom' - ]); ?> -
-
-
- -
-
- 'Installer' - ]); ?> -
-
+ +

+ +

+
+
+ 'Langues installées', + 'selected' => $this->getData(['config', 'i18n', 'interface']) + ]); ?> +
+
+
+
+ 'Suivant' + ]); ?> +
+
\ No newline at end of file diff --git a/core/module/install/view/postinstall/postinstall.css b/core/module/install/view/postinstall/postinstall.css new file mode 100644 index 00000000..d7c543b0 --- /dev/null +++ b/core/module/install/view/postinstall/postinstall.css @@ -0,0 +1 @@ +/* Vide */ \ No newline at end of file diff --git a/core/module/install/view/index/index.js.php b/core/module/install/view/postinstall/postinstall.js.php similarity index 100% rename from core/module/install/view/index/index.js.php rename to core/module/install/view/postinstall/postinstall.js.php diff --git a/core/module/install/view/postinstall/postinstall.php b/core/module/install/view/postinstall/postinstall.php new file mode 100644 index 00000000..6a175e61 --- /dev/null +++ b/core/module/install/view/postinstall/postinstall.php @@ -0,0 +1,107 @@ +

+ +

+ +

+ +

+
+
+
+ 'off', + 'label' => 'Identifiant' + ]); ?> +
+
+
+
+ 'off', + 'label' => 'Mot de passe' + ]); ?> +
+
+ 'off', + 'label' => 'Confirmation' + ]); ?> +
+
+ 'off', + 'label' => 'Adresse mail' + ]); ?> +
+
+ 'off', + 'label' => 'Prénom' + ]); ?> +
+
+ 'off', + 'label' => 'Nom' + ]); ?> +
+
+
+ +
+
+ 'buttonGrey', + 'href' => helper::baseUrl(true) . '?install', + 'value' => template::ico('left') + ]); ?> +
+
+ 'Installer' + ]); ?> +
+
+ \ No newline at end of file