diff options
Diffstat (limited to 'src/view/NavBuilder.php')
-rw-r--r-- | src/view/NavBuilder.php | 59 |
1 files changed, 31 insertions, 28 deletions
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 | |||
27 | 27 | ||
28 | foreach($nav_data->getChildren() as $data) | 28 | foreach($nav_data->getChildren() as $data) |
29 | { | 29 | { |
30 | $li_class = ''; | 30 | if(!$data->isHidden()){ |
31 | if(isset($current[$level]) && $data->getEndOfPath() === $current[$level]->getEndOfPath()){ | 31 | $li_class = ''; |
32 | $li_class = 'current '; | 32 | if(isset($current[$level]) && $data->getEndOfPath() === $current[$level]->getEndOfPath()){ |
33 | } | 33 | $li_class = 'current '; |
34 | } | ||
34 | 35 | ||
35 | $link = ''; | 36 | $link = ''; |
36 | if($data->isReachable()) | 37 | if($data->isReachable()) // titre de catégorie du menu non clicable |
37 | { | ||
38 | if(str_starts_with($data->getEndOfPath(), 'http')) // lien vers autre site | ||
39 | { | 38 | { |
40 | $link .= '<a href="' . $data->getEndOfPath() . '" target="_blank">'; | 39 | if(str_starts_with($data->getEndOfPath(), 'http')) // lien vers autre site |
40 | { | ||
41 | $link .= '<a href="' . $data->getEndOfPath() . '" target="_blank">'; | ||
42 | } | ||
43 | elseif($data->getEndOfPath() != '') // lien relatif | ||
44 | { | ||
45 | $link .= '<a href="' . new URL(['page' => $data->getPagePath()]) . '">'; | ||
46 | } | ||
47 | } | ||
48 | else{ | ||
49 | $link .= '<a>'; | ||
41 | } | 50 | } |
42 | elseif($data->getEndOfPath() != '') // lien relatif | 51 | |
52 | if(count($data->getChildren()) > 0) // titre de catégorie | ||
43 | { | 53 | { |
44 | $link .= '<a href="' . new URL(['page' => $data->getPagePath()]) . '">'; | 54 | $li_class .= $data->getParent() == null ? 'drop-down' : 'drop-right'; |
55 | |||
56 | $nav_html .= '<li class="'. $li_class . '">' . $link . '<p>' . $data->getPageName() . '</p></a><ul class="sub-menu">' . "\n"; | ||
57 | $level++; | ||
58 | $nav_html .= $this->navMainHTML($data, $current); | ||
59 | $level--; | ||
60 | $nav_html .= '</ul></li>' . "\n"; | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | $nav_html .= '<li class="'. $li_class . '">' . $link . '<p>' . $data->getPageName() . '</p></a></li>' . "\n"; | ||
45 | } | 65 | } |
46 | } | ||
47 | else{ | ||
48 | $link .= '<a>'; | ||
49 | } | 66 | } |
50 | 67 | ||
51 | if(count($data->getChildren()) > 0) // titre de catégorie | ||
52 | { | ||
53 | $li_class .= $data->getParent() == null ? 'drop-down' : 'drop-right'; | ||
54 | |||
55 | $nav_html .= '<li class="'. $li_class . '">' . $link . '<p>' . $data->getPageName() . '</p></a><ul class="sub-menu">' . "\n"; | ||
56 | $level++; | ||
57 | $nav_html .= $this->navMainHTML($data, $current); | ||
58 | $level--; | ||
59 | $nav_html .= '</ul></li>' . "\n"; | ||
60 | } | ||
61 | else | ||
62 | { | ||
63 | $nav_html .= '<li class="'. $li_class . '">' . $link . '<p>' . $data->getPageName() . '</p></a></li>' . "\n"; | ||
64 | } | ||
65 | } | 68 | } |
66 | return $nav_html; | 69 | return $nav_html; |
67 | } | 70 | } |