html .= "
\n"; // page article: cas particulier où l'article est greffé sur main if(Director::$page_path->getLast()->getEndOfPath() === 'article'){ // pas censé arriver if(!isset($_GET['id'])){ header('Location: ' . new URL); die; } if($node->getAdoptedChild() == null){ $date = new \DateTime; $article = new Article('', $date); $new = new Node('new', 'i' . (string)$date->getTimestamp(), [], 0, null, null, $article); } else{ $new = $node->getAdoptedChild(); } //$builder_name = $this->snakeToPascalCase($new->getName()) . 'Builder'; $builder_name = 'NewBuilder'; $builder = new $builder_name($new); $this->html .= $builder->render(); } else{ // si action = "modif_page", affiche des commandes supplémentaires if($_SESSION['admin'] && self::$modif_mode){ // ajouter un contrôle du champ in_menu $this->viewEditBlocks($node); } // dans tous les cas $this->useChildrenBuilder($node); } $this->html .= "
\n"; } // mode modification de page uniquement private function viewEditBlocks($node): void { //$viewFile = self::VIEWS_PATH . $node->getName() . '.php'; // mode modification uniquement $viewFile = self::VIEWS_PATH . 'modify_page.php'; // mode modification uniquement $blocks = Blocks::getTypeNamePairs(); $options = ''; for($i = 0; $i < count($blocks); $i++){ $options .= '\n"; } //$page_id = Director::$page_path->getLast()->getId(); $head_node = null; foreach(ViewController::$root_node->getChildren() as $first_level_node){ if($first_level_node->getName() === 'head'){ $head_node = $first_level_node; // normalement c'est le 1er enfant break; } } $bloc_edit = ''; foreach($node->getChildren() as $child_node){ // mettre tout ça dans une vue modify_block.php // => pourrait être déplacé au niveau des articles // renommage d'un bloc $bloc_edit .= '

'. "\n"; // déplacement d'un bloc $bloc_edit .= '

' . "\n"; // suppression d'un bloc $bloc_edit .= '
'. "\n"; if($child_node->getNodeData()->getPresentation() !== null){ // select mode de présentation $bloc_edit .= '

'; // select largeur minimale colonnes mode grid $bloc_edit .= '

'; $bloc_edit .= ''; /*$bloc_edit .= '';*/ $bloc_edit .= ' pixels
'; } $bloc_edit .= "
\n"; } ob_start(); require $viewFile; $this->html .= ob_get_clean(); } private function makePresentationOptions(string $presentation): string { $options = ''; foreach(Presentation::$option_list as $key => $value){ $options .= ''; } return $options; } }