aboutsummaryrefslogtreecommitdiff
path: root/src/View/ViewDirector.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/View/ViewDirector.php')
-rw-r--r--src/View/ViewDirector.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/View/ViewDirector.php b/src/View/ViewDirector.php
new file mode 100644
index 0000000..af35179
--- /dev/null
+++ b/src/View/ViewDirector.php
@@ -0,0 +1,30 @@
1<?php
2// src/View/ViewDirector.php
3//
4// génère le HTML avec des Builder
5
6declare(strict_types=1);
7
8namespace App\View;
9
10use App\Entity\Node;
11
12class ViewDirector extends AbstractBuilder // ViewDirector est le premier Builder
13{
14 public Node $root_node;
15
16 public function __construct(){} // surcharge celui de AbstractBuilder
17
18 public function buildHTML(Node $root_node): string
19 {
20 $this->root_node = $root_node;
21 $this->useChildrenBuilder($this->root_node);
22
23 if(isset($_SESSION['flash_message'])){
24 $this->html .= '<script>window.flash_message = "' . $_SESSION['flash_message'] . '";</script>';
25 unset($_SESSION['flash_message']);
26 }
27
28 return $this->html;
29 }
30} \ No newline at end of file