aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/controller/ArticleController.php7
-rw-r--r--src/controller/PageManagementController.php12
-rw-r--r--src/controller/ViewController.php7
-rw-r--r--src/model/Blocks.php17
-rw-r--r--src/model/Model.php3
-rw-r--r--src/model/entities/EmailForm.php1
-rw-r--r--src/model/entities/Node.php20
-rw-r--r--src/model/entities/NodeData.php20
-rw-r--r--src/model/entities/Presentation.php133
-rw-r--r--src/service/Backup.php1
-rw-r--r--src/service/Router.php4
-rw-r--r--src/view/FooterBuilder.php2
-rw-r--r--src/view/MainBuilder.php8
-rw-r--r--src/view/templates/modify_block.php4
14 files changed, 182 insertions, 57 deletions
diff --git a/src/controller/ArticleController.php b/src/controller/ArticleController.php
index 7019f5c..0ddb0e1 100644
--- a/src/controller/ArticleController.php
+++ b/src/controller/ArticleController.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
5 5
6use App\Entity\Node; 6use App\Entity\Node;
7use App\Entity\Article; 7use App\Entity\Article;
8use App\Entity\Presentation;
8use Doctrine\ORM\EntityManager; 9use Doctrine\ORM\EntityManager;
9use Symfony\Component\HttpFoundation\Request; 10use Symfony\Component\HttpFoundation\Request;
10use Symfony\Component\HttpFoundation\Response; 11use Symfony\Component\HttpFoundation\Response;
@@ -21,7 +22,7 @@ class ArticleController
21 $model->findNodeById($id); 22 $model->findNodeById($id);
22 $parent_block = $model->getNode(); 23 $parent_block = $model->getNode();
23 24
24 if(Blocks::hasPresentation($parent_block->getName())){ 25 if(Presentation::hasPresentation($parent_block->getName())){
25 $get_articles_return = $model->getNextArticles($parent_block, $request); 26 $get_articles_return = $model->getNextArticles($parent_block, $request);
26 $bulk_data = $get_articles_return[0]; 27 $bulk_data = $get_articles_return[0];
27 28
@@ -44,11 +45,11 @@ class ArticleController
44 return new JsonResponse(['success' => true, 'html' => $html, 'truncated' => $get_articles_return[1]]); 45 return new JsonResponse(['success' => true, 'html' => $html, 'truncated' => $get_articles_return[1]]);
45 } 46 }
46 else{ 47 else{
47 return new JsonResponse(['success' => false, 'error' => 'server side error']); 48 return new JsonResponse(['success' => false, 'error' => 'server side error'], JsonResponse::HTTP_INTERNAL_SERVER_ERROR);
48 } 49 }
49 } 50 }
50 else{ 51 else{
51 return new JsonResponse(['success' => false, 'error' => 'bad parameters']); 52 return new JsonResponse(['success' => false, 'error' => 'bad parameters'], JsonResponse::HTTP_BAD_REQUEST);
52 } 53 }
53 } 54 }
54 55
diff --git a/src/controller/PageManagementController.php b/src/controller/PageManagementController.php
index c575077..bfad474 100644
--- a/src/controller/PageManagementController.php
+++ b/src/controller/PageManagementController.php
@@ -7,6 +7,7 @@ use App\Entity\Page;
7use App\Entity\Node; 7use App\Entity\Node;
8use App\Entity\NodeData; 8use App\Entity\NodeData;
9use App\Entity\EmailForm; 9use App\Entity\EmailForm;
10use App\Entity\Presentation;
10//use App\Entity\Image; 11//use App\Entity\Image;
11use Doctrine\ORM\EntityManager; 12use Doctrine\ORM\EntityManager;
12use Symfony\Component\HttpFoundation\InputBag; 13use Symfony\Component\HttpFoundation\InputBag;
@@ -131,7 +132,7 @@ class PageManagementController
131 $main = $model->getNode(); 132 $main = $model->getNode();
132 $position = count($main->getChildren()) + 1; // position dans la fraterie 133 $position = count($main->getChildren()) + 1; // position dans la fraterie
133 134
134 if(!in_array($request->request->get("bloc_select"), array_keys(Blocks::$blocks), true)){ // 3è param: contrôle du type 135 if(!in_array($request->request->get("bloc_select"), array_keys(Presentation::$blocks), true)){ // 3è param: contrôle du type
135 // utiliser une flash error 136 // utiliser une flash error
136 return new RedirectResponse((string)new URL(['page' => $request->query->get('page'), 'error' => 'bad_bloc_type'])); 137 return new RedirectResponse((string)new URL(['page' => $request->query->get('page'), 'error' => 'bad_bloc_type']));
137 } 138 }
@@ -146,7 +147,12 @@ class PageManagementController
146 147
147 $block = new Node($request->request->get("bloc_select"), $position, $main, $page); 148 $block = new Node($request->request->get("bloc_select"), $position, $main, $page);
148 149
149 $DataClass = $request->request->get("bloc_select") === 'form' ? EmailForm::class : NodeData::class; // cas particulier avec bloc 'email_form' 150 $DataClass = match($request->request->get("bloc_select")){
151 'form' => EmailForm::class,
152 'post_block', 'news_block' => Presentation::class,
153 'calendar' => NodeData::class,
154 default => throw new InvalidArgumentException("Erreur: type de bloc inconnu"),
155 };
150 $data = new $DataClass(['title' => trim(htmlspecialchars($request->request->get("bloc_title")))], $block); 156 $data = new $DataClass(['title' => trim(htmlspecialchars($request->request->get("bloc_title")))], $block);
151 157
152 // valeurs par défaut 158 // valeurs par défaut
@@ -305,7 +311,7 @@ class PageManagementController
305 $model = new Model($entityManager); 311 $model = new Model($entityManager);
306 $model->findNodeById($json['id']); 312 $model->findNodeById($json['id']);
307 313
308 if(in_array($json['presentation'], array_keys(Blocks::$presentations))){ 314 if(in_array($json['presentation'], array_keys(Presentation::$presentations))){
309 $model->getNode()->getNodeData()->setPresentation($json['presentation']); 315 $model->getNode()->getNodeData()->setPresentation($json['presentation']);
310 $entityManager->flush(); 316 $entityManager->flush();
311 317
diff --git a/src/controller/ViewController.php b/src/controller/ViewController.php
index 43db6a6..d1aaee7 100644
--- a/src/controller/ViewController.php
+++ b/src/controller/ViewController.php
@@ -8,8 +8,9 @@ use Symfony\Component\HttpFoundation\Request;
8use Symfony\Component\HttpFoundation\Response; 8use Symfony\Component\HttpFoundation\Response;
9use Symfony\Component\HttpFoundation\RedirectResponse; 9use Symfony\Component\HttpFoundation\RedirectResponse;
10 10
11class ViewController 11class ViewController{
12{ 12 const SPECIAL_PAGES = ['article', 'new_page', 'menu_paths', 'user_edit', 'connection', 'emails', 'maintenance'];
13
13 static function getWebPage(EntityManager $entityManager, Request $request): Response 14 static function getWebPage(EntityManager $entityManager, Request $request): Response
14 { 15 {
15 /* 1/ 1er contrôle des paramètres */ 16 /* 1/ 1er contrôle des paramètres */
@@ -17,7 +18,7 @@ class ViewController
17 // mode modification d'une page 18 // mode modification d'une page
18 if(IS_ADMIN 19 if(IS_ADMIN
19 && $request->query->has('mode') && $request->query->get('mode') === 'page_modif' 20 && $request->query->has('mode') && $request->query->get('mode') === 'page_modif'
20 && !in_array(CURRENT_PAGE, ['article', 'new_page', 'menu_paths', 'user_edit', 'connection'])) 21 && !in_array(CURRENT_PAGE, self::SPECIAL_PAGES))
21 { 22 {
22 MainBuilder::$modif_mode = true; 23 MainBuilder::$modif_mode = true;
23 } 24 }
diff --git a/src/model/Blocks.php b/src/model/Blocks.php
deleted file mode 100644
index 786ec74..0000000
--- a/src/model/Blocks.php
+++ /dev/null
@@ -1,17 +0,0 @@
1<?php
2// src/model/Blocks.php
3
4class Blocks{
5 static public array $blocks = ['post_block' => 'Articles libres', 'news_block' => 'Actualités',
6 //'galery' => 'Galerie',
7 'calendar' => 'Calendrier', 'form' => 'Formulaire'];
8
9 static public array $presentations = ['fullwidth' => 'Pleine largeur', 'grid' => 'Grille', 'mosaic' => 'Mosaïque'
10 //, 'carousel' => 'Carrousel'
11 ];
12
13 static public function hasPresentation(string $block): bool
14 {
15 return in_array($block, ['post_block', 'news_block']) ? true : false;
16 }
17} \ No newline at end of file
diff --git a/src/model/Model.php b/src/model/Model.php
index 1054d57..15ff12a 100644
--- a/src/model/Model.php
+++ b/src/model/Model.php
@@ -9,6 +9,7 @@ declare(strict_types=1);
9use Doctrine\ORM\EntityManager; 9use Doctrine\ORM\EntityManager;
10use App\Entity\Page; 10use App\Entity\Page;
11use App\Entity\Node; 11use App\Entity\Node;
12use App\Entity\Presentation;
12use Doctrine\ORM\QueryBuilder; 13use Doctrine\ORM\QueryBuilder;
13use Symfony\Component\HttpFoundation\Request; 14use Symfony\Component\HttpFoundation\Request;
14 15
@@ -60,7 +61,7 @@ class Model
60 61
61 foreach($bulk_data as $parent_block){ 62 foreach($bulk_data as $parent_block){
62 // groupes d'articles triés par bloc, permet de paginer par bloc 63 // groupes d'articles triés par bloc, permet de paginer par bloc
63 if(Blocks::hasPresentation($parent_block->getName())){ // = post_block ou news_block 64 if(Presentation::hasPresentation($parent_block->getName())){ // = post_block ou news_block
64 $bulk_data = array_merge($bulk_data, $this->getNextArticles($parent_block, $request)[0]); 65 $bulk_data = array_merge($bulk_data, $this->getNextArticles($parent_block, $request)[0]);
65 } 66 }
66 67
diff --git a/src/model/entities/EmailForm.php b/src/model/entities/EmailForm.php
index 466a389..0dcdeec 100644
--- a/src/model/entities/EmailForm.php
+++ b/src/model/entities/EmailForm.php
@@ -6,7 +6,6 @@ declare(strict_types=1);
6namespace App\Entity; 6namespace App\Entity;
7 7
8use Doctrine\ORM\Mapping as ORM; 8use Doctrine\ORM\Mapping as ORM;
9//use Doctrine\Common\Collections\ArrayCollection;
10 9
11#[ORM\Entity] 10#[ORM\Entity]
12#[ORM\Table(name: TABLE_PREFIX . "email_form")] 11#[ORM\Table(name: TABLE_PREFIX . "email_form")]
diff --git a/src/model/entities/Node.php b/src/model/entities/Node.php
index fb2d867..7932efc 100644
--- a/src/model/entities/Node.php
+++ b/src/model/entities/Node.php
@@ -5,7 +5,6 @@ declare(strict_types=1);
5 5
6namespace App\Entity; 6namespace App\Entity;
7 7
8use Config;
9use Doctrine\ORM\Mapping as ORM; 8use Doctrine\ORM\Mapping as ORM;
10 9
11#[ORM\Entity] 10#[ORM\Entity]
@@ -48,6 +47,9 @@ class Node
48 #[ORM\OneToOne(targetEntity: EmailForm::class, mappedBy: "node", cascade: ['persist'])] // pas de remove, les e-mails sont associés au EmailForm 47 #[ORM\OneToOne(targetEntity: EmailForm::class, mappedBy: "node", cascade: ['persist'])] // pas de remove, les e-mails sont associés au EmailForm
49 private ?EmailForm $email_form = null; 48 private ?EmailForm $email_form = null;
50 49
50 #[ORM\OneToOne(targetEntity: Presentation::class, mappedBy: "node", cascade: ['persist', 'remove'])]
51 private ?Presentation $presentation = null;
52
51 // attributs non destinés à doctrine 53 // attributs non destinés à doctrine
52 private array $children = []; // tableau de Node 54 private array $children = []; // tableau de Node
53 private ?self $adopted = null; // = "new" est un enfant de "main" lorsque la page est "article" 55 private ?self $adopted = null; // = "new" est un enfant de "main" lorsque la page est "article"
@@ -111,11 +113,15 @@ class Node
111 113
112 // une interface serait cool! 114 // une interface serait cool!
113 // OU possible un "héritage doctrine", faire en sorte que Node soit la mère de NodeData, EmailForm, Article... 115 // OU possible un "héritage doctrine", faire en sorte que Node soit la mère de NodeData, EmailForm, Article...
114 // une seulle instance est matérialisée par plusieurs tables en même temps 116 // une seule instance est matérialisée par plusieurs tables en même temps
115 public function getNodeData(): NodeData|EmailForm|null 117 public function getNodeData(): NodeData|EmailForm|Presentation|null
116 { 118 {
117 // limite du polymorphisme avec doctrine => impossible d'avoir une unique variable $node_data 119 // pour du polymorphisme (une unique variable $node_data): opter pour l'héritage
118 return $this->name_node === 'form' ? $this->email_form : $this->node_data; 120 return match($this->name_node){
121 'form' => $this->email_form,
122 'post_block', 'news_block' => $this->presentation,
123 default => $this->node_data, // inclut 'calendar'
124 };
119 } 125 }
120 public function getChildren(): array 126 public function getChildren(): array
121 { 127 {
@@ -134,7 +140,7 @@ class Node
134 { 140 {
135 $this->children[] = $child; 141 $this->children[] = $child;
136 142
137 if(!\Blocks::hasPresentation($this->getName())){ // post_block et news_block ont leurs enfants ordonnés avec ORDER BY 143 if(!Presentation::hasPresentation($this->getName())){ // post_block et news_block ont leurs enfants ordonnés avec ORDER BY
138 $this->sortChildren(false); 144 $this->sortChildren(false);
139 } 145 }
140 } 146 }
diff --git a/src/model/entities/NodeData.php b/src/model/entities/NodeData.php
index c55f6a1..f6d6b01 100644
--- a/src/model/entities/NodeData.php
+++ b/src/model/entities/NodeData.php
@@ -24,7 +24,7 @@ class NodeData
24 // inverseBy fait le lien avec $node_data dans Node (qui a "mappedBy") 24 // inverseBy fait le lien avec $node_data dans Node (qui a "mappedBy")
25 #[ORM\OneToOne(targetEntity: Node::class, inversedBy: "node_data")] 25 #[ORM\OneToOne(targetEntity: Node::class, inversedBy: "node_data")]
26 #[ORM\JoinColumn(name: "node_id", referencedColumnName: "id_node", onDelete: "CASCADE")] 26 #[ORM\JoinColumn(name: "node_id", referencedColumnName: "id_node", onDelete: "CASCADE")]
27 private Node $node; 27 private ?Node $node;
28 28
29 #[ORM\Column(type: "json")] 29 #[ORM\Column(type: "json")]
30 private array $data; 30 private array $data;
@@ -44,18 +44,12 @@ class NodeData
44 #[ORM\OneToMany(mappedBy: 'node_data', targetEntity: AssetEmployment::class, cascade: ['persist', 'remove'])] 44 #[ORM\OneToMany(mappedBy: 'node_data', targetEntity: AssetEmployment::class, cascade: ['persist', 'remove'])]
45 private Collection $asset_employment; 45 private Collection $asset_employment;
46 46
47 private int $nb_pages = 1;
48 private array $emails = []; // => noeud "show_emails" 47 private array $emails = []; // => noeud "show_emails"
49 48
50 public function __construct(array $data, Node $node, Collection $asset_employment = new ArrayCollection, ?string $presentation = null, ?bool $chrono_order = null) 49 public function __construct(array $data, Node $node, Collection $asset_employment = new ArrayCollection){
51 {
52 $this->data = $data; 50 $this->data = $data;
53 $this->node = $node; 51 $this->node = $node;
54 $this->asset_employment = $asset_employment; 52 $this->asset_employment = $asset_employment;
55 if(!empty($presentation) && $presentation === 'grid'){
56 $this->grid_cols_min_width = 250;
57 }
58 $this->chrono_order = $chrono_order ?? null;
59 } 53 }
60 54
61 public function getId(): int 55 public function getId(): int
@@ -82,7 +76,7 @@ class NodeData
82 } 76 }
83 77
84 // spécifique aux blocs contenant des articles 78 // spécifique aux blocs contenant des articles
85 public function getPresentation(): ?string 79 /*public function getPresentation(): ?string
86 { 80 {
87 return $this->presentation; 81 return $this->presentation;
88 } 82 }
@@ -117,6 +111,7 @@ class NodeData
117 { 111 {
118 $this->pagination_limit = $pagination_limit; 112 $this->pagination_limit = $pagination_limit;
119 } 113 }
114 private int $nb_pages = 1;
120 public function getNumberOfPages(): int 115 public function getNumberOfPages(): int
121 { 116 {
122 return $this->nb_pages; 117 return $this->nb_pages;
@@ -124,13 +119,12 @@ class NodeData
124 public function setNumberOfPages(int $nb_pages): void 119 public function setNumberOfPages(int $nb_pages): void
125 { 120 {
126 $this->nb_pages = $nb_pages; 121 $this->nb_pages = $nb_pages;
127 } 122 }*/
128 123
129 /*public function setNode(Node $node): void 124 public function setNode(?Node $node): void
130 { 125 {
131 $this->node = $node; 126 $this->node = $node;
132 }*/ 127 }
133
134 128
135 public function getNodeDataAssets(): Collection 129 public function getNodeDataAssets(): Collection
136 { 130 {
diff --git a/src/model/entities/Presentation.php b/src/model/entities/Presentation.php
new file mode 100644
index 0000000..912c19e
--- /dev/null
+++ b/src/model/entities/Presentation.php
@@ -0,0 +1,133 @@
1<?php
2// src/model/entities/Presentation.php
3
4declare(strict_types=1);
5
6namespace App\Entity;
7
8use Doctrine\ORM\Mapping as ORM;
9
10#[ORM\Entity]
11#[ORM\Table(name: TABLE_PREFIX . "presentation")]
12class Presentation{
13 #[ORM\Id]
14 #[ORM\GeneratedValue]
15 #[ORM\Column(type: "integer")]
16 private int $id_presentation;
17
18 // inverseBy fait le lien avec $presentation dans Node (qui a "mappedBy")
19 #[ORM\OneToOne(targetEntity: Node::class, inversedBy: "presentation")]
20 #[ORM\JoinColumn(name: "node_id", referencedColumnName: "id_node")]
21 private ?Node $node;
22
23 #[ORM\Column(type: "json")]
24 private array $data;
25
26 #[ORM\Column(type: "string", length: 255, nullable: true)]
27 private ?string $presentation;
28
29 #[ORM\Column(type: "boolean", length: 255, nullable: true)]
30 private ?bool $chrono_order = null;
31
32 #[ORM\Column(type: "integer", nullable: true)]
33 private ?int $grid_cols_min_width = null; // pour le mode grille
34
35 #[ORM\Column(type: "integer", nullable: true)]
36 private ?int $pagination_limit = null; // pour les post_block et news_block
37
38 private int $nb_pages = 1;
39
40 public function __construct(array $data, Node $node
41 //, ?string $presentation = null, ?bool $chrono_order = null
42 ){
43 $this->data = $data;
44 $this->node = $node;
45 /*if(!empty($presentation) && $presentation === 'grid'){
46 $this->grid_cols_min_width = 250;
47 }
48 $this->chrono_order = $chrono_order ?? null;*/
49 }
50
51 /*public function getId(): int
52 {
53 return $this->id_presentation;
54 }*/
55
56 public function setNode(?Node $node): void
57 {
58 $this->node = $node;
59 }
60
61 // un trait pour ça
62 public function getData(): array
63 {
64 return $this->data;
65 }
66 public function updateData(string $key, string|int|bool|array $value = ''): void
67 {
68 if($value !== ''){
69 $this->data[$key] = $value;
70 }
71 // si $value est vide, supprime la clé
72 elseif(isset($this->data[$key])){
73 unset($this->data[$key]);
74 }
75 }
76
77 // spécifique aux blocs contenant des articles
78 public function getPresentation(): ?string
79 {
80 return $this->presentation;
81 }
82 public function setPresentation(string $presentation): void
83 {
84 $this->presentation = $presentation;
85 }
86 public function getColsMinWidth(): int
87 {
88 $default = 320; // pixels
89 return $this->grid_cols_min_width === null ? $default : $this->grid_cols_min_width;
90 }
91 public function setColsMinWidth(int $columns): void
92 {
93 $this->grid_cols_min_width = $columns;
94 }
95 public function getChronoOrder(): bool
96 {
97 return $this->chrono_order ?? false;
98 }
99 public function setChronoOrder(bool $reverse_order): void
100 {
101 $this->chrono_order = $reverse_order;
102 }
103
104 public function getPaginationLimit(): ?int
105 {
106 $default = 12; // si 0 pas de pagination, 12 rend bien avec des grilles de 2, 3 ou 4 colonnes
107 return $this->pagination_limit === null ? $default : $this->pagination_limit;
108 }
109 public function setPaginationLimit(int $pagination_limit): void
110 {
111 $this->pagination_limit = $pagination_limit;
112 }
113 public function getNumberOfPages(): int
114 {
115 return $this->nb_pages;
116 }
117 public function setNumberOfPages(int $nb_pages): void
118 {
119 $this->nb_pages = $nb_pages;
120 }
121
122 static public array $blocks = ['post_block' => 'Articles libres', 'news_block' => 'Actualités',
123 //'galery' => 'Galerie',
124 'calendar' => 'Calendrier', 'form' => 'Formulaire'
125 ];
126 static public array $presentations = ['fullwidth' => 'Pleine largeur', 'grid' => 'Grille', 'mosaic' => 'Mosaïque'
127 //, 'carousel' => 'Carrousel'
128 ];
129 static public function hasPresentation(string $block): bool
130 {
131 return in_array($block, ['post_block', 'news_block']) ? true : false;
132 }
133} \ No newline at end of file
diff --git a/src/service/Backup.php b/src/service/Backup.php
index c30ce5b..2ee69c1 100644
--- a/src/service/Backup.php
+++ b/src/service/Backup.php
@@ -224,6 +224,7 @@ class Backup
224 } 224 }
225 if($elem === TABLE_PREFIX . $excluded){ 225 if($elem === TABLE_PREFIX . $excluded){
226 unset($tables[$key]); 226 unset($tables[$key]);
227 break; // petite optimisation
227 } 228 }
228 } 229 }
229 } 230 }
diff --git a/src/service/Router.php b/src/service/Router.php
index 907baf4..28a6c39 100644
--- a/src/service/Router.php
+++ b/src/service/Router.php
@@ -106,7 +106,7 @@ class Router{
106 return ContactFormController::sendVisitorEmail($this->entityManager, $json); 106 return ContactFormController::sendVisitorEmail($this->entityManager, $json);
107 } 107 }
108 /*else{ 108 /*else{
109 return new JsonResponse(['success' => false, 'error' => 'tu fais quoi là mec?']); 109 return new JsonResponse(['success' => false, 'error' => 'tu fais quoi là mec?'], JsonResponse::HTTP_BAD_REQUEST);
110 }*/ 110 }*/
111 } 111 }
112 112
@@ -183,7 +183,7 @@ class Router{
183 return MaintenanceController::eraseLogs($this->entityManager); 183 return MaintenanceController::eraseLogs($this->entityManager);
184 184
185 default: 185 default:
186 return new JsonResponse(['success' => false]); 186 return new JsonResponse(['success' => false, 'error' => 'bad parameters'], JsonResponse::HTTP_BAD_REQUEST);
187 } 187 }
188 } 188 }
189 189
diff --git a/src/view/FooterBuilder.php b/src/view/FooterBuilder.php
index da16758..bb99c13 100644
--- a/src/view/FooterBuilder.php
+++ b/src/view/FooterBuilder.php
@@ -99,7 +99,7 @@ class FooterBuilder extends AbstractBuilder
99 private function makePageModifModeButton(): string 99 private function makePageModifModeButton(): string
100 { 100 {
101 $link_edit_page = new URL(['page' => CURRENT_PAGE]); 101 $link_edit_page = new URL(['page' => CURRENT_PAGE]);
102 if(!in_array(CURRENT_PAGE, ['article', 'new_page', 'menu_paths', 'maintenance'])) // ajouter 'user_edit' et 'connection' le jour où ces pages auront un footer 102 if(!in_array(CURRENT_PAGE, ViewController::SPECIAL_PAGES)) // cas impossibles: 'user_edit' et 'connection' qui n'ont pas de footer
103 { 103 {
104 if(MainBuilder::$modif_mode){ 104 if(MainBuilder::$modif_mode){
105 $link_edit_label = 'Sortir du mode modification'; 105 $link_edit_label = 'Sortir du mode modification';
diff --git a/src/view/MainBuilder.php b/src/view/MainBuilder.php
index b488703..b888a56 100644
--- a/src/view/MainBuilder.php
+++ b/src/view/MainBuilder.php
@@ -53,10 +53,10 @@ class MainBuilder extends AbstractBuilder
53 } 53 }
54 54
55 // mode modification de page uniquement 55 // mode modification de page uniquement
56 private function viewEditBlocks($node): void 56 private function viewEditBlocks(Node $node): void
57 { 57 {
58 $options = ''; 58 $options = '';
59 foreach(Blocks::$blocks as $key => $value){ 59 foreach(Presentation::$blocks as $key => $value){
60 $options .= '<option value= "' . $key . '">' . $value . "</option>\n"; 60 $options .= '<option value= "' . $key . '">' . $value . "</option>\n";
61 } 61 }
62 62
@@ -69,7 +69,7 @@ class MainBuilder extends AbstractBuilder
69 } 69 }
70 70
71 // présentation par défaut 71 // présentation par défaut
72 if(Blocks::hasPresentation($child_node->getName()) && $child_node->getNodeData()->getPresentation() === null){ 72 if(Presentation::hasPresentation($child_node->getName()) && $child_node->getNodeData()->getPresentation() === null){
73 $child_node->getNodeData()->setPresentation('full_width'); // pas de persistence ici 73 $child_node->getNodeData()->setPresentation('full_width'); // pas de persistence ici
74 } 74 }
75 75
@@ -87,7 +87,7 @@ class MainBuilder extends AbstractBuilder
87 private function makePresentationOptions(string $presentation): string 87 private function makePresentationOptions(string $presentation): string
88 { 88 {
89 $options = ''; 89 $options = '';
90 foreach(Blocks::$presentations as $key => $value){ 90 foreach(Presentation::$presentations as $key => $value){
91 $options .= '<option value="' . $key . '" ' . ($presentation === $key ? 'selected' : '') . '>' . $value . '</option>'; 91 $options .= '<option value="' . $key . '" ' . ($presentation === $key ? 'selected' : '') . '>' . $value . '</option>';
92 } 92 }
93 return $options; 93 return $options;
diff --git a/src/view/templates/modify_block.php b/src/view/templates/modify_block.php
index d855a4a..1da3176 100644
--- a/src/view/templates/modify_block.php
+++ b/src/view/templates/modify_block.php
@@ -1,7 +1,7 @@
1<?php declare(strict_types=1); ?> 1<?php declare(strict_types=1); ?>
2<div class="modify_one_block" id="bloc_edit_<?= $child_node->getId() ?>"> 2<div class="modify_one_block" id="bloc_edit_<?= $child_node->getId() ?>">
3 <div class="block_options"> 3 <div class="block_options">
4 <label for="bloc_rename_<?= $child_node->getId() ?>">Type <b><?= Blocks::$blocks[$child_node->getName()] ?? '<i>erreur base de données</i>' ?></b> 4 <label for="bloc_rename_<?= $child_node->getId() ?>">Type <b><?= App\Entity\Presentation::$blocks[$child_node->getName()] ?? '<i>erreur base de données</i>' ?></b>
5 </label> 5 </label>
6 <p> 6 <p>
7 <input type="text" id="bloc_rename_<?= $child_node->getId() ?>" name="bloc_rename_title" value="<?= $child_node->getNodeData()->getdata()['title'] ?>" required> 7 <input type="text" id="bloc_rename_<?= $child_node->getId() ?>" name="bloc_rename_title" value="<?= $child_node->getNodeData()->getdata()['title'] ?>" required>
@@ -31,7 +31,7 @@ if($child_node->getName() === 'news_block'){
31 </div> 31 </div>
32<?php 32<?php
33} 33}
34if(Blocks::hasPresentation($child_node->getName())){ 34if(App\Entity\Presentation::hasPresentation($child_node->getName())){
35?> 35?>
36 <div class="grid_options"> 36 <div class="grid_options">
37 <div> 37 <div>