From a3ba7dde60dc1c94b7170ec28266a966e5004d33 Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 22 Apr 2025 00:39:54 +0200 Subject: page menu et chemin, partie 2 --- src/view/NavBuilder.php | 59 ++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 28 deletions(-) (limited to 'src/view/NavBuilder.php') diff --git a/src/view/NavBuilder.php b/src/view/NavBuilder.php index 2718569..f4fb651 100644 --- a/src/view/NavBuilder.php +++ b/src/view/NavBuilder.php @@ -27,41 +27,44 @@ class NavBuilder extends AbstractBuilder foreach($nav_data->getChildren() as $data) { - $li_class = ''; - if(isset($current[$level]) && $data->getEndOfPath() === $current[$level]->getEndOfPath()){ - $li_class = 'current '; - } + if(!$data->isHidden()){ + $li_class = ''; + if(isset($current[$level]) && $data->getEndOfPath() === $current[$level]->getEndOfPath()){ + $li_class = 'current '; + } - $link = ''; - if($data->isReachable()) - { - if(str_starts_with($data->getEndOfPath(), 'http')) // lien vers autre site + $link = ''; + if($data->isReachable()) // titre de catégorie du menu non clicable { - $link .= ''; + if(str_starts_with($data->getEndOfPath(), 'http')) // lien vers autre site + { + $link .= ''; + } + elseif($data->getEndOfPath() != '') // lien relatif + { + $link .= ''; + } + } + else{ + $link .= ''; } - elseif($data->getEndOfPath() != '') // lien relatif + + if(count($data->getChildren()) > 0) // titre de catégorie { - $link .= ''; + $li_class .= $data->getParent() == null ? 'drop-down' : 'drop-right'; + + $nav_html .= '
  • ' . $link . '

    ' . $data->getPageName() . '

  • ' . "\n"; + } + else + { + $nav_html .= '
  • ' . $link . '

    ' . $data->getPageName() . '

  • ' . "\n"; } - } - else{ - $link .= ''; } - if(count($data->getChildren()) > 0) // titre de catégorie - { - $li_class .= $data->getParent() == null ? 'drop-down' : 'drop-right'; - - $nav_html .= '
  • ' . $link . '

    ' . $data->getPageName() . '

  • ' . "\n"; - } - else - { - $nav_html .= '
  • ' . $link . '

    ' . $data->getPageName() . '

  • ' . "\n"; - } } return $nav_html; } -- cgit v1.2.3