From efd79d15adef2a27347c25ebb19754e9937f9715 Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 10 Sep 2025 01:02:36 +0200 Subject: =?UTF-8?q?modification=20d'une=20URL=20page=20Menu=20et=20chemin,?= =?UTF-8?q?=20htmlspecialchars=20sur=20les=20URL=20du=20menu=20=C3=A0=20l'?= =?UTF-8?q?affichage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/MenuBuilder.php | 30 +++++++++++++++++++----------- src/view/NavBuilder.php | 2 +- src/view/templates/menu.php | 11 +++++------ 3 files changed, 25 insertions(+), 18 deletions(-) (limited to 'src/view') diff --git a/src/view/MenuBuilder.php b/src/view/MenuBuilder.php index 9d4dda1..bc64e30 100644 --- a/src/view/MenuBuilder.php +++ b/src/view/MenuBuilder.php @@ -13,18 +13,13 @@ class MenuBuilder extends AbstractBuilder //private int $margin_left_multiplier = 29; private string $options = ''; - public function __construct(Node $node = null, bool $template = true) + public function __construct(Node $node, bool $template = true) { - //parent::__construct($node); + // impossible de me rappeler pourquoi j'ai écrit ce test sur $node, pourquoi $node serait null? $viewFile = $node === null ? self::VIEWS_PATH . 'menu.php' : self::VIEWS_PATH . $node->getName() . '.php'; if(file_exists($viewFile)) { - /*if(!empty($node->getNodeData()->getData())) - { - extract($node->getNodeData()->getData()); - }*/ - if($_SESSION['admin']){ $this->unfoldMenu(Director::$menu_data); @@ -63,13 +58,26 @@ class MenuBuilder extends AbstractBuilder '; + // seul la modification des URL est possible pour l'instant, les noms des entrées de menu attendront if(str_starts_with($entry->getEndOfPath(), 'http')){ - $this->html .= ' - ' . $entry->getEndOfPath() . ' -
+ $this->html .= ' -
'; + + + + + '; + + // code à recycler pour pouvoir modifier le nom de l'entrée de menu correspondant aux liens + /*$this->html .= ' + + + + + + + ';*/ } else{ $this->html .= '' . $entry->getPagePath() . ''; diff --git a/src/view/NavBuilder.php b/src/view/NavBuilder.php index a9cf49c..2cbdef9 100644 --- a/src/view/NavBuilder.php +++ b/src/view/NavBuilder.php @@ -38,7 +38,7 @@ class NavBuilder extends AbstractBuilder { if(str_starts_with($data->getEndOfPath(), 'http')) // lien vers autre site { - $link .= ''; + $link .= ''; } elseif($data->getEndOfPath() != '') // lien relatif { diff --git a/src/view/templates/menu.php b/src/view/templates/menu.php index 55c9ff9..d78c665 100644 --- a/src/view/templates/menu.php +++ b/src/view/templates/menu.php @@ -2,18 +2,18 @@ \ No newline at end of file -- cgit v1.2.3