From 1d8836f230cf2a37b0a911a15209f1dbeec033bb Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 30 Aug 2023 20:02:23 +0200 Subject: [PATCH] =?UTF-8?q?Int=C3=A9gration=20module=20nav=20dans=20core?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/class/layout.class.php | 74 +++++++++++++- core/core.php | 15 +++ core/module/page/page.php | 18 ++++ core/module/page/view/edit/edit.js.php | 3 + core/module/page/view/edit/edit.php | 32 +++++-- module/nav/enum.json | 1 - module/nav/nav.php | 128 ------------------------- module/nav/view/config/config.css | 15 --- module/nav/view/config/config.php | 34 ------- module/nav/view/index/index.php | 20 ---- 10 files changed, 134 insertions(+), 206 deletions(-) delete mode 100644 module/nav/enum.json delete mode 100644 module/nav/nav.php delete mode 100644 module/nav/view/config/config.css delete mode 100644 module/nav/view/config/config.php delete mode 100644 module/nav/view/index/index.php diff --git a/core/class/layout.class.php b/core/class/layout.class.php index 7df8a56f..c6b0f56e 100644 --- a/core/class/layout.class.php +++ b/core/class/layout.class.php @@ -88,13 +88,19 @@ class layout extends common (sizeof($blocks) === 1 || in_array($this->getUrl(1), $pattern)) ) { // Pleine page en mode configuration + if ($this->getData(['page', $this->getUrl(0), 'navLeft']) === 'top' || $this->getData(['page', $this->getUrl(0), 'navRight']) === 'top') { + $this->showNavButtons('top'); + } $this->showContent(); + if ($this->getData(['page', $this->getUrl(0), 'navLeft']) === 'bottom' || $this->getData(['page', $this->getUrl(0), 'navRight']) === 'bottom') { + $this->showNavButtons('bottom'); + } } else { echo '
'; /** * Barre gauche */ - if ($blockleft !== "") { + if ($blockleft !== '') { echo '
+
diff --git a/module/nav/enum.json b/module/nav/enum.json deleted file mode 100644 index eb56f910..00000000 --- a/module/nav/enum.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"nav","realName":"Navigation","version":"0.1","update":"0.0","delete":true,"dataDirectory":""} \ No newline at end of file diff --git a/module/nav/nav.php b/module/nav/nav.php deleted file mode 100644 index b7fc56d6..00000000 --- a/module/nav/nav.php +++ /dev/null @@ -1,128 +0,0 @@ - - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2023, Frédéric Tempez - * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International - * @link http://zwiicms.fr/ - */ - -class nav extends common -{ - - - const VERSION = '0.1'; - const REALNAME = 'Navigation'; - - public static $actions = [ - 'index' => self::GROUP_VISITOR, - 'config' => self::GROUP_EDITOR, - ]; - - public static $previousPage = ''; - public static $nextPage = ''; - - public static $iconTemplate = [ - 'open' => [ - 'left' => 'left-open', - 'right' => 'right-open', - ], - 'dir' => [ - 'left' => 'left', - 'right' => 'right-dir', - ], - 'big' => [ - 'left' => 'left-big', - 'right' => 'right-big', - ], - ]; - - public static $iconTemplateName = [ - 'dir' => 'Triangle', - 'open' => 'Ouverte', - 'big' => 'Flèche', - ]; - - public static $leftButton = 'left'; - public static $rightButton = 'right-dir'; - - public function index() - { - $hierarchy = array(); - foreach ($this->getHierarchy() as $parentKey => $parentValue) { - $hierarchy[] = $parentKey; - foreach ($parentValue as $childKey) { - $hierarchy[] = $childKey; - } - } - // Parcourir la hiérarchie et rechercher les éléments avant et après - $elementToFind = $this->getUrl(0); - - // Trouver la clé de l'élément recherché - $key = array_search($elementToFind, $hierarchy); - - if ($key !== false) { - // Trouver l'élément précédent - $previousKey = ($key > 0) ? $key - 1 : null; - $previousValue = ($previousKey !== null) ? $hierarchy[$previousKey] : null; - - // Trouver l'élément suivant - $nextKey = ($key < count($hierarchy) - 1) ? $key + 1 : null; - $nextValue = ($nextKey !== null) ? $hierarchy[$nextKey] : null; - - self::$previousPage = $previousValue; - self::$nextPage = $nextValue; - } - - // Jeux d'icônes - if ($this->getData(['module', $this->getUrl(0), 'iconTemplate'])) { - self::$leftButton = self::$iconTemplate[$this->getData(['module', $this->getUrl(0), 'iconTemplate'])]['left']; - self::$rightButton = self::$iconTemplate[$this->getData(['module', $this->getUrl(0), 'iconTemplate'])]['right']; - } - - - // Valeurs en sortie - $this->addOutput([ - 'showBarEditButton' => true, - 'showPageContent' => true, - 'view' => 'index', - ]); - } - - public function config() - { - - // Soumission du formulaire - if ( - $this->getUser('permission', __CLASS__, __FUNCTION__) === true && - $this->isPost() - ) { - $this->setData([ - 'module', - $this->getUrl(0), - [ - 'iconTemplate' => $this->getInput('navConfigIconTemplate', null), - ] - ]); - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'notification' => 'Modifications enregistrées', - 'state' => true - ]); - } - - // Valeurs en sortie - $this->addOutput([ - 'title' => 'Configuration du module', - 'view' => 'config' - ]); - - } - -} \ No newline at end of file diff --git a/module/nav/view/config/config.css b/module/nav/view/config/config.css deleted file mode 100644 index 7fde7ab5..00000000 --- a/module/nav/view/config/config.css +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file is part of Zwii. - * - * For full copyright and license information, please see the LICENSE - * file that was distributed with this source code. - * - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2023, Frédéric Tempez - * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International - * @link http://zwiicms.fr/ - */ - -/** NE PAS EFFACER -* admin.css -*/ \ No newline at end of file diff --git a/module/nav/view/config/config.php b/module/nav/view/config/config.php deleted file mode 100644 index 8c71f9b2..00000000 --- a/module/nav/view/config/config.php +++ /dev/null @@ -1,34 +0,0 @@ - -
-
- 'buttonGrey', - 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), - 'value' => template::ico('left') - ]); ?> -
-
- -
-
-
-
-
-

- -

-
-
- 'Icônes', - 'selected' => $this->getData(['module', $this->getUrl(0), 'iconTemplate']) - ]); ?> -
-
-
-
-
- -
Version n° - -
\ No newline at end of file diff --git a/module/nav/view/index/index.php b/module/nav/view/index/index.php deleted file mode 100644 index b6506247..00000000 --- a/module/nav/view/index/index.php +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file