diff options
| author | polo <ordipolo@gmx.fr> | 2025-04-13 13:30:31 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-04-13 13:30:31 +0200 |
| commit | 75f2c543e7fe45c1a3dcea842650a5d13a0235f0 (patch) | |
| tree | 82461287eac3ae23728a74a2b90d6f574f3ddb37 /src/view/NavBuilder.php | |
| parent | 27bd4f380f76d5494fd9be81d3d0edac9a0aa2cc (diff) | |
| download | cms-75f2c543e7fe45c1a3dcea842650a5d13a0235f0.tar.gz cms-75f2c543e7fe45c1a3dcea842650a5d13a0235f0.tar.bz2 cms-75f2c543e7fe45c1a3dcea842650a5d13a0235f0.zip | |
menu et fil d'ariane gèrent le champ reachable dans page
Diffstat (limited to 'src/view/NavBuilder.php')
| -rw-r--r-- | src/view/NavBuilder.php | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/view/NavBuilder.php b/src/view/NavBuilder.php index e7254b1..2ef6bc8 100644 --- a/src/view/NavBuilder.php +++ b/src/view/NavBuilder.php | |||
| @@ -22,20 +22,12 @@ class NavBuilder extends AbstractBuilder | |||
| 22 | 22 | ||
| 23 | foreach($nav_data->getChildren() as $data) | 23 | foreach($nav_data->getChildren() as $data) |
| 24 | { | 24 | { |
| 25 | $class = ''; | 25 | $li_class = ''; |
| 26 | if(isset($current[$level]) && $data->getEndOfPath() === $current[$level]->getEndOfPath()){ | 26 | if(isset($current[$level]) && $data->getEndOfPath() === $current[$level]->getEndOfPath()){ |
| 27 | $class = ' current'; | 27 | $li_class = 'current'; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | if(count($data->getChildren()) > 0) // titre de catégorie | 30 | if($data->isReachable()) |
| 31 | { | ||
| 32 | $nav_html .= '<li class="drop-down'. $class . '"><p>' . $data->getPageName() . '</p><ul class="sub-menu">' . "\n"; | ||
| 33 | $level++; | ||
| 34 | $nav_html .= $this->navMainHTML($data, $current); | ||
| 35 | $level--; | ||
| 36 | $nav_html .= '</ul></li>' . "\n"; | ||
| 37 | } | ||
| 38 | else | ||
| 39 | { | 31 | { |
| 40 | $target = ''; | 32 | $target = ''; |
| 41 | if(str_starts_with($data->getEndOfPath(), 'http')) // lien vers autre site | 33 | if(str_starts_with($data->getEndOfPath(), 'http')) // lien vers autre site |
| @@ -47,14 +39,28 @@ class NavBuilder extends AbstractBuilder | |||
| 47 | { | 39 | { |
| 48 | $link = new URL(['page' => $data->getPagePath()]); // $link = objet | 40 | $link = new URL(['page' => $data->getPagePath()]); // $link = objet |
| 49 | } | 41 | } |
| 50 | /*else | 42 | $nav_html .= '<a href="' . $link . '"' . $target . '>'; |
| 51 | { | 43 | } |
| 52 | echo "else page d'accueil" . '<br>'; | 44 | else{ |
| 53 | $link = new URL; // page d'accueil | 45 | $nav_html .= '<a>'; |
| 54 | }*/ | ||
| 55 | |||
| 56 | $nav_html .= '<a href="' . $link . '"' . $target . '><li class="'. $class . '"><p>' . $data->getPageName() . '</p></li></a>' . "\n"; | ||
| 57 | } | 46 | } |
| 47 | |||
| 48 | if(count($data->getChildren()) > 0) // titre de catégorie | ||
| 49 | { | ||
| 50 | $li_class = $data->getParent() == null ? 'drop-down' : 'drop-right'; | ||
| 51 | |||
| 52 | $nav_html .= '<li class="'. $li_class . '"><p>' . $data->getPageName() . '</p><ul class="sub-menu">' . "\n"; | ||
| 53 | $level++; | ||
| 54 | $nav_html .= $this->navMainHTML($data, $current); | ||
| 55 | $level--; | ||
| 56 | $nav_html .= '</ul></li>' . "\n"; | ||
| 57 | } | ||
| 58 | else | ||
| 59 | { | ||
| 60 | $nav_html .= '<li class="'. $li_class . '"><p>' . $data->getPageName() . '</p></li>' . "\n"; | ||
| 61 | } | ||
| 62 | |||
| 63 | $nav_html .= "</a>\n"; | ||
| 58 | } | 64 | } |
| 59 | return $nav_html; | 65 | return $nav_html; |
| 60 | } | 66 | } |
