getName() . '.php'; if(file_exists($viewFile)) { /*if(!empty($node->getNodeData()->getData())) { extract($node->getNodeData()->getData()); }*/ if($_SESSION['admin']) { $this->unfoldMenu(Director::$menu_data, 0 - $this->margin_left_multiplier); } else{ header('Location: ' . new URL); die; } ob_start(); require $viewFile; $this->html = ob_get_clean(); // pas de concaténation ici, on écrase } } private function unfoldMenu(Page $menu, int $margin_left): void { $margin_left += $this->margin_left_multiplier; $this->html .= '
' . "\n"; foreach($menu->getChildren() as $entry) { $div_style = 'margin-left: ' . $margin_left . 'px;'; $checked = $entry->isHidden() ? '' : 'checked'; $this->html .= '
'; if(str_starts_with($entry->getEndOfPath(), 'http')){ $this->html .= ' ' . $entry->getEndOfPath() . ' '; } else{ $this->html .= '' . $entry->getPagePath() . ''; } /* => flèche gauche: position = position du parent + 1, parent = grand-parent, recalculer les positions => flèche droite: position = nombre d'éléments de la fraterie + 1, l'élément précédent devient le parent */ if(count($entry->getChildren()) > 0){ $this->unfoldMenu($entry, $margin_left); } $this->html .= '
' . "\n"; } $this->html .= "
\n"; $margin_left -= $this->margin_left_multiplier; } }