From 2ae3afb47f08cb47296d89d3f0bf578622a444d1 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Mon, 25 Oct 2021 17:51:30 +0200 Subject: [PATCH] Initialisation --- core/core.php | 215 ++++++++++++++++++++++++++++++++++--------- core/layout/main.php | 124 +------------------------ 2 files changed, 173 insertions(+), 166 deletions(-) diff --git a/core/core.php b/core/core.php index 54953ac8..3b2875e0 100755 --- a/core/core.php +++ b/core/core.php @@ -1185,11 +1185,108 @@ class common { } } + /** + * 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 = explode('-',$this->getData(['page',$this->getUrl(0),'block'])); + // 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(); + if (file_exists(self::DATA_DIR . 'body.inc.html')) { + include( self::DATA_DIR . 'body.inc.html'); + } + } else { + echo '
'; + /** + * Barre gauche + */ + if ($blockleft !== "") { + echo '
"; + } + /** + * Contenu de page + */ + echo '
'; + $this->showContent(); + if (file_exists(self::DATA_DIR . 'body.inc.html')) { + include(self::DATA_DIR . 'body.inc.html'); + } + echo '
'; + /** + * Barre droite + */ + if ($blockright !== "") { + echo '
'; + } + echo '
'; + } + echo '
'; + } + /** * Affiche le contenu * @param Page par défaut */ - public function showContent() { + private function showContent() { if( $this->output['title'] AND ( @@ -1222,55 +1319,85 @@ class common { } } - - /** - * Affiche le contenu de la barre gauche - * + * Affiche le pied de page */ - public function showBarContentLeft() { - // Détermine si le menu est présent - if ($this->getData(['page',$this->getData(['page',$this->getUrl(0),'barLeft']),'displayMenu']) === 'none') { - // Pas de menu - echo $this->output['contentLeft']; - } else { - // $mark contient 0 le menu est positionné à la fin du contenu - $contentLeft = str_replace ('[]','[MENU]',$this->output['contentLeft']); - $contentLeft = str_replace ('[menu]','[MENU]',$contentLeft); - $mark = strrpos($contentLeft,'[MENU]') !== false ? strrpos($contentLeft,'[MENU]') : strlen($contentLeft); - echo substr($contentLeft,0,$mark); - echo ''; - echo substr($contentLeft,$mark+6,strlen($contentLeft)); + 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' ? '