diff --git a/core/core.php b/core/core.php index 753f0ad0..d9eb6b44 100755 --- a/core/core.php +++ b/core/core.php @@ -587,7 +587,9 @@ class common { if ($sampleSite === true) { foreach(init::$siteContent as $key => $value) { // Creation du contenu de la page - file_put_contents(self::DATA_DIR . $lang . '/content/' . $this->getData(['page', $key, 'content']), $value); + if (!empty($this->getData(['page', $key, 'content'])) ) { + file_put_contents(self::DATA_DIR . $lang . '/content/' . $this->getData(['page', $key, 'content']), $value); + } } } else { // Créer la page d'accueil diff --git a/core/module/install/install.php b/core/module/install/install.php index 14acc361..11f61db7 100755 --- a/core/module/install/install.php +++ b/core/module/install/install.php @@ -22,6 +22,8 @@ class install extends common { 'update' => self::GROUP_ADMIN ]; + // Thèmes proposés à l'installation + public static $themes = []; public static $newVersion; @@ -52,8 +54,11 @@ class install extends common { $userLastname = $this->getInput('installLastname', helper::FILTER_STRING_SHORT, true); $userMail = $this->getInput('installMail', helper::FILTER_MAIL, true); $userId = $this->getInput('installId', helper::FILTER_ID, true); + + // Création de l'utilisateur si les données sont complétées. // success retour de l'enregistrement des données + $success = $this->setData([ 'user', $userId, @@ -68,6 +73,7 @@ class install extends common { 'password' => $this->getInput('installPassword', helper::FILTER_PASSWORD, true) ] ]); + // Compte créé, envoi du mail et création des données du site if ($success) { // Formulaire complété envoi du mail // Envoie le mail @@ -115,6 +121,16 @@ class install extends common { $this->setData(['core', 'baseUrl', helper::baseUrl(false,false) ]); // Créer sitemap $this->createSitemap(); + + // Installation du thème + $dataThemes = file_get_contents("core/module/install/ressource/themes/themes.json"); + $dataThemes = json_decode($dataThemes, true); + $themeId = $dataThemes [$this->getInput('installTheme', helper::FILTER_STRING_SHORT)]['filename']; + if ($themeId !== 'default' ) { + $theme = new theme; + $theme->import('core/module/install/ressource/themes/' . $themeId); + } + // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl(false), @@ -123,7 +139,11 @@ class install extends common { ]); } } - + // Récupération de la liste des thèmes + $dataThemes = file_get_contents('core/module/install/ressource/themes/themes.json'); + $dataThemes = json_decode($dataThemes, true); + self::$themes = helper::arrayCollumn($dataThemes, 'name'); + // Valeurs en sortie $this->addOutput([ 'display' => self::DISPLAY_LAYOUT_LIGHT, diff --git a/core/module/install/ressource/files.tar.gz b/core/module/install/ressource/files.tar.gz index d2143eca..717c37ab 100644 Binary files a/core/module/install/ressource/files.tar.gz and b/core/module/install/ressource/files.tar.gz differ diff --git a/core/module/install/ressource/themes/theme_affaire.zip b/core/module/install/ressource/themes/theme_affaire.zip new file mode 100644 index 00000000..d35a4240 Binary files /dev/null and b/core/module/install/ressource/themes/theme_affaire.zip differ diff --git a/core/module/install/ressource/themes/themes.json b/core/module/install/ressource/themes/themes.json new file mode 100644 index 00000000..e64088ac --- /dev/null +++ b/core/module/install/ressource/themes/themes.json @@ -0,0 +1,10 @@ +{ + "defaut" : { + "name": "Par défaut", + "filename": "" + }, + "affaire": { + "name": "Affaire", + "filename": "theme_affaire.zip" + } +} \ 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 9c60b0eb..79d90194 100644 --- a/core/module/install/view/index/index.php +++ b/core/module/install/view/index/index.php @@ -36,6 +36,13 @@ ]); ?> +