From 967d8c929c005f745f6436c529d78e90a8d123ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Sun, 28 Aug 2022 19:37:58 +0200 Subject: [PATCH] =?UTF-8?q?dev004=20Int=C3=A9gration=20des=20aides=20des?= =?UTF-8?q?=20ic=C3=B4nes=20du=20core=20dans=20le=20template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/class/template.class.php | 17 ++++- core/core.php | 136 ++++++++++++++++++++++++++-------- 2 files changed, 120 insertions(+), 33 deletions(-) diff --git a/core/class/template.class.php b/core/class/template.class.php index d18b2d62..f2784a55 100644 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -417,10 +417,14 @@ class template { /** * Crée un icône + * @Array : * @param string $ico Classe de l'icône * @param string $margin Ajoute un margin autour de l'icône (choix : left, right, all) * @param bool $animate Ajoute une animation à l'icône * @param string $fontSize Taille de la police + * @param string $href lien vers une url + * @param string $help popup d'aide + * @param string $id de l'élement * @return string */ // public static function ico($ico, $margin = '', $animate = false, $fontSize = '1em') { @@ -428,10 +432,17 @@ class template { // Attributs par défaut $attributes = array_merge([ 'margin' => '', - 'animate' => false, - 'fontSize' => '1em' + 'animate' => false, + 'fontSize' => '1em', + 'href' => '', + 'attr' => '', + 'help' => '', + 'id' => '' ], $attributes); - return ''; + $item = $attributes['href'] ? '' : ''; + $item .= ''; + $item .= ($attributes['href']) ? '' : ''; + return $item; } /** diff --git a/core/core.php b/core/core.php index 7cd68115..f3a219b3 100644 --- a/core/core.php +++ b/core/core.php @@ -1520,21 +1520,43 @@ class common { ) OR $this->getUrl(0) === 'theme' ) { - $items .= 'getUrl(0) === 'theme' ? 'class="displayNone"' : '') . - '> | ' . template::ico('login') .''; + $items .= 'getUrl(0) === 'theme' ? 'class="displayNone">' : '>') . + ' | '. + template::ico('login', [ + 'href' => helper::baseUrl() . 'user/login/' . strip_tags(str_replace('/', '_', $this->getUrl())) , + 'attr' => 'rel="nofollow"', + 'help' => 'Connexion', + 'fontSize' => '1.5em' + ]) . ''; } // Affichage de la barre de membre simple if ( $this->getUser('group') === self::GROUP_MEMBER && $this->getData(['theme','footer','memberBar']) === true ) { $items .= 'getData(['theme','footer','displaymemberAccount']) === false ? ' class="displayNone"' : ''; - $items .= '> | ' . template::ico('user', ['margin' => 'all']) . ''; - if( $this->getData(['user', $this->getUser('id') , 'files']) === true) $items .= '' . template::ico('folder') . ''; - $items .= '' . template::ico('logout',['margin' => 'left']) . ''; + $items .= $this->getData(['theme','footer','displaymemberAccount']) === false ? ' class="displayNone">' : '>'; + $items .= ' | ' . + template::ico('user', [ + 'margin' => 'all', + 'help' => 'Mon compte', + 'href' => helper::baseUrl() . 'user/edit/' . $this->getUser('id'). '/' . $_SESSION['csrf'] + ]); + if ( + $this->getData(['user', $this->getUser('id') , 'files']) === true + ) { + $items .= '' . template::ico('folder', [ + 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json'), + 'margin' => 'all', + 'attr' => 'data-lity', + 'help' => 'Fichiers du site' + ]); + } + $items .= ''. template::ico('logout', [ + 'margin' => 'all', + 'help' => 'Déconnecter', + 'href' => helper::baseUrl() . 'user/logout' + ]); $items .= ''; } // Fermeture du bloc copyright @@ -1638,19 +1660,37 @@ class common { ) OR $this->getUrl(0) === 'theme' ) { - $itemsRight .= ''; + $itemsRight .= ''; } // Commandes pour les membres simples if($this->getUser('group') == self::GROUP_MEMBER && $this->getData(['theme','menu','memberBar']) === true ) { - if( $this->getData(['user', $this->getUser('id') , 'files']) === true) $itemsRight .= '
  • ' . template::ico('folder') . '
  • '; - $itemsRight .= '
  • ' . template::ico('user', ['margin' => 'right']) . '
  • '; - $itemsRight .= '
  • ' . template::ico('logout') . '
  • '; + if ( + $this->getData(['user', $this->getUser('id') , 'files']) === true + ) { + $itemsRight .= '
  • ' . template::ico('folder', [ + 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json'), + 'attr' => 'data-lity', + 'help' => 'Fichiers du site' + ]). '
  • '; + } + $itemsRight .= '
  • ' . template::ico('user', [ + 'help' => 'Mon compte', + 'margin' => 'right', + 'href' => helper::baseUrl() . 'user/edit/' . $this->getUser('id'). '/' . $_SESSION['csrf'] + ]) . '
  • '; + $itemsRight .= '
  • ' . + template::ico('logout', [ + 'help' => 'Déconnecter', + 'href' => helper::baseUrl() . 'user/logout', + 'id' => 'barLogout' + ]) . '
  • '; } // Retourne les items du menu echo '