From 690b862cce76878ead677e172bd11f1f686ad403 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 7 Mar 2023 09:32:04 +0100 Subject: [PATCH] =?UTF-8?q?R=C3=A9partition=20des=20classes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.php | 2063 +---------------------- core/include/layout.class.php | 1160 +++++++++++++ core/include/router.class.php | 908 ++++++++++ core/layout/blank.php | 21 +- core/layout/common.css | 2 +- core/layout/light.php | 23 +- core/layout/main.php | 39 +- core/module/config/view/index/index.css | 2 +- 8 files changed, 2120 insertions(+), 2098 deletions(-) create mode 100644 core/include/layout.class.php create mode 100644 core/include/router.class.php diff --git a/core/core.php b/core/core.php index 142b486e..705ee9a0 100644 --- a/core/core.php +++ b/core/core.php @@ -1267,2061 +1267,12 @@ class common } $zip->close(); } - - // Layout remplace la classe précédente - - /** - * Affiche le consentement aux cookies - */ - public function showCookies() - { - // La gestion des cookies est externalisée - if ($this->getData(['config', 'cookieConsent']) === false) { - return; - } - // Le cookie est déjà validé - if ($this->getInput('ZWII_COOKIE_CONSENT') === 'true') { - return; - } - $item = '
'; - // Bouton de fermeture - $item .= '
'; - $item .= template::ico('cancel'); - $item .= '
'; - // Texte de la popup - $item .= '

' . $this->getData(['locale', 'cookies', 'titleLabel']) . '

'; - $item .= '

' . $this->getData(['locale', 'cookies', 'mainLabel']) . '

'; - // Formulaire de réponse - if ( - $this->getData(['locale', 'homePageId']) === $this->getUrl(0) - ) { - $item .= '
'; - } else { - $item .= ''; - } - $item .= '

'; - $item .= ''; - $item .= '
'; - // mentions légales si la page est définie - $legalPage = $this->getData(['locale', 'legalPageId']); - if ($legalPage !== 'none') { - $item .= '

' . $this->getData(['locale', 'cookies', 'linkLegalLabel']) . '

'; - } - $item .= '
'; - echo $item; - } - - /** - * Formate le contenu de la page selon les gabarits - * @param Page par defaut - */ - public function showSection() - { - echo '
'; - // Récupérer la config de la page courante - $blocks = is_null($this->getData(['page', $this->getUrl(0), 'block'])) ? '12' : $this->getData(['page', $this->getUrl(0), 'block']); - $blocks = explode('-', $blocks); - // Initialiser - $blockleft = ''; - $blockright = ''; - switch (sizeof($blocks)) { - case 1: // une colonne - $content = 'col' . $blocks[0]; - break; - case 2: // 2 blocs - if ($blocks[0] < $blocks[1]) { // détermine la position de la colonne - $blockleft = 'col' . $blocks[0]; - $content = 'col' . $blocks[1]; - } else { - $content = 'col' . $blocks[0]; - $blockright = 'col' . $blocks[1]; - } - break; - case 3: // 3 blocs - $blockleft = 'col' . $blocks[0]; - $content = 'col' . $blocks[1]; - $blockright = 'col' . $blocks[2]; - } - // Page pleine pour la configuration des modules et l'édition des pages sauf l'affichage d'un article de blog - $pattern = ['config', 'edit', 'add', 'comment', 'data']; - if ( - (sizeof($blocks) === 1 || - in_array($this->getUrl(1), $pattern)) - ) { // Pleine page en mode configuration - $this->showContent(); - } else { - echo '
'; - /** - * Barre gauche - */ - if ($blockleft !== "") { - echo '
"; - } - /** - * Contenu de page - */ - echo '
'; - $this->showContent(); - echo '
'; - /** - * Barre droite - */ - if ($blockright !== "") { - echo '
'; - } - echo '
'; - } - echo '
'; - } - - /** - * Affiche le contenu - * @param Page par défaut - */ - public function showContent() - { - if ( - $this->output['title'] - and ($this->getData(['page', $this->getUrl(0)]) === null - or $this->getData(['page', $this->getUrl(0), 'hideTitle']) === false - or $this->getUrl(1) === 'config' - ) - ) { - echo '

' . $this->output['title'] . '

'; - } - - echo $this->output['content']; - } - - /** - * Affiche le pied de page - */ - public function showFooter() - { - // Déterminer la position - $positionFixed = ''; - if ( - $this->getData(['theme', 'footer', 'position']) === 'site' - // Affiche toujours le pied de page pour l'édition du thème - or ($this->getData(['theme', 'footer', 'position']) === 'hide' - and $this->getUrl(0) === 'theme' - ) - ) { - $position = 'site'; - } else { - $position = 'body'; - if ($this->getData(['theme', 'footer', 'fixed']) === true) { - $positionFixed = ' footerbodyFixed'; - } - // Sortir de la division précédente - echo ''; - } - - echo $this->getData(['theme', 'footer', 'position']) === 'hide' ? '