From f27cca08ff786ceff1870147f6d6bad14d71117f Mon Sep 17 00:00:00 2001 From: polo Date: Fri, 23 Oct 2026 00:47:32 +0200 Subject: =?UTF-8?q?dossiers=20avec=20majuscule,=20namespace=20pour=20toute?= =?UTF-8?q?s=20les=20classes,=20autoload=20psr-4,=20UserDataService::creat?= =?UTF-8?q?eZip=20d=C3=A9plac=C3=A9=20dans=20Backup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/View/MainBuilder.php | 99 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 src/View/MainBuilder.php (limited to 'src/View/MainBuilder.php') diff --git a/src/View/MainBuilder.php b/src/View/MainBuilder.php new file mode 100644 index 0000000..b5b9b00 --- /dev/null +++ b/src/View/MainBuilder.php @@ -0,0 +1,99 @@ +html .= "
\n"; + + // page article: cas particulier où l'article est greffé sur main + if(Model::$page_path->getLast()->getEndOfPath() === 'article'){ + // pas censé arriver + if(!isset($_GET['id'])){ + header('Location: ' . new URL); + die; + } + + // nouvel article + if($node->getAdoptedChild() == null){ + $date = new \DateTime; + $article = new Article('', $date); + $new = new Node('new', 0, null, null, $article); + } + // modification + else{ + $new = $node->getAdoptedChild(); + } + //$builder_name = 'App\View\\' . $this->snakeToPascalCase($new->getName()) . 'Builder'; + $builder_name = 'App\View\NewBuilder'; + $builder = new $builder_name($new); + $this->html .= $builder->render(); + } + else{ + // si action = "modif_page", affiche des commandes supplémentaires + if(IS_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 $node): void + { + $options = ''; + foreach(Presentation::BLOCKS as $key => $value){ + $options .= '\n"; + } + + // ceci pourrait être déplacé au début des blocs + $bloc_edit = ''; + foreach($node->getChildren() as $child_node){ + // ordre des articles 'news' + if($child_node->getName() === 'news_block'){ + $order = $child_node->getNodeData()->getChronoOrder() ? 'chrono' : 'antichrono'; + } + + // présentation par défaut + if(Presentation::hasPresentation($child_node->getName()) && $child_node->getNodeData()->getPresentation() === null){ + $child_node->getNodeData()->setPresentation('full_width'); // pas de persistence ici + } + + ob_start(); + require self::VIEWS_PATH . 'modify_block.php'; + $bloc_edit .= ob_get_clean(); + } + + ob_start(); + require self::VIEWS_PATH . 'modify_page.php'; + $this->html .= ob_get_clean(); + } + + // utilisée dans modify_block.php + private function makePresentationOptions(string $presentation): string + { + $options = ''; + foreach(Presentation::PRESENTATIONS as $key => $value){ + $options .= ''; + } + return $options; + } +} \ No newline at end of file -- cgit v1.2.3