diff options
| author | polo <ordipolo@gmx.fr> | 2025-04-22 00:39:54 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-04-22 00:39:54 +0200 |
| commit | a3ba7dde60dc1c94b7170ec28266a966e5004d33 (patch) | |
| tree | 279699afbf52270780dff8d1a4756efe217c15f6 /src/view | |
| parent | eb3e1eb8c8365d3b3d1d39f24314ba420255afc2 (diff) | |
| download | cms-a3ba7dde60dc1c94b7170ec28266a966e5004d33.tar.gz cms-a3ba7dde60dc1c94b7170ec28266a966e5004d33.tar.bz2 cms-a3ba7dde60dc1c94b7170ec28266a966e5004d33.zip | |
page menu et chemin, partie 2
Diffstat (limited to 'src/view')
| -rw-r--r-- | src/view/MenuBuilder.php | 9 | ||||
| -rw-r--r-- | src/view/NavBuilder.php | 59 |
2 files changed, 32 insertions, 36 deletions
diff --git a/src/view/MenuBuilder.php b/src/view/MenuBuilder.php index 0fcfbe5..5a010d5 100644 --- a/src/view/MenuBuilder.php +++ b/src/view/MenuBuilder.php | |||
| @@ -22,8 +22,6 @@ class MenuBuilder extends AbstractBuilder | |||
| 22 | extract($node->getNodeData()->getData()); | 22 | extract($node->getNodeData()->getData()); |
| 23 | }*/ | 23 | }*/ |
| 24 | 24 | ||
| 25 | // ajouter un article | ||
| 26 | $new_article = ''; | ||
| 27 | if($_SESSION['admin']) | 25 | if($_SESSION['admin']) |
| 28 | { | 26 | { |
| 29 | $this->unfoldMenu(Director::$menu_data, 0 - $this->margin_left_multiplier); | 27 | $this->unfoldMenu(Director::$menu_data, 0 - $this->margin_left_multiplier); |
| @@ -47,7 +45,7 @@ class MenuBuilder extends AbstractBuilder | |||
| 47 | foreach($menu->getChildren() as $entry) | 45 | foreach($menu->getChildren() as $entry) |
| 48 | { | 46 | { |
| 49 | $div_style = 'margin-left: ' . $margin_left . 'px;'; | 47 | $div_style = 'margin-left: ' . $margin_left . 'px;'; |
| 50 | $checked = $entry->IsInMenu() ? 'checked' : ''; | 48 | $checked = $entry->isHidden() ? '' : 'checked'; |
| 51 | $this->html .= '<div id="' . $entry->getId() . '" style="' . $div_style . '"> | 49 | $this->html .= '<div id="' . $entry->getId() . '" style="' . $div_style . '"> |
| 52 | <img class="move_entry_icon" onclick="" src="assets/arrow-left.svg"> | 50 | <img class="move_entry_icon" onclick="" src="assets/arrow-left.svg"> |
| 53 | <img class="move_entry_icon" onclick="" src="assets/arrow-right.svg"> | 51 | <img class="move_entry_icon" onclick="" src="assets/arrow-right.svg"> |
| @@ -67,14 +65,9 @@ class MenuBuilder extends AbstractBuilder | |||
| 67 | $this->html .= '<i>' . $entry->getPagePath() . '</i>'; | 65 | $this->html .= '<i>' . $entry->getPagePath() . '</i>'; |
| 68 | } | 66 | } |
| 69 | 67 | ||
| 70 | |||
| 71 | // supprimer me label "visible" et griser le texte et bouton en JS à la place | ||
| 72 | |||
| 73 | /* | 68 | /* |
| 74 | => flèche gauche: position = position du parent + 1, parent = grand-parent, recalculer les positions | 69 | => flèche gauche: position = position du parent + 1, parent = grand-parent, recalculer les positions |
| 75 | => flèche droite: position = nombre d'éléments de la fraterie + 1, l'élément précédent devient le parent | 70 | => flèche droite: position = nombre d'éléments de la fraterie + 1, l'élément précédent devient le parent |
| 76 | => flèches haut et bas: inversement de position, comme pour les noeuds, mais dans la table page | ||
| 77 | => checkbox: in_menu ^= 1 | ||
| 78 | */ | 71 | */ |
| 79 | 72 | ||
| 80 | if(count($entry->getChildren()) > 0){ | 73 | if(count($entry->getChildren()) > 0){ |
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 | } |
