aboutsummaryrefslogtreecommitdiff
path: root/src/controller/PageManagementController.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/controller/PageManagementController.php')
-rw-r--r--src/controller/PageManagementController.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/controller/PageManagementController.php b/src/controller/PageManagementController.php
index 3d7edde..e811a6a 100644
--- a/src/controller/PageManagementController.php
+++ b/src/controller/PageManagementController.php
@@ -135,7 +135,7 @@ class PageManagementController
135 $main = $director->getNode(); 135 $main = $director->getNode();
136 $position = count($main->getChildren()) + 1; // position dans la fraterie 136 $position = count($main->getChildren()) + 1; // position dans la fraterie
137 137
138 if(!in_array($_POST["bloc_select"], Blocks::getNameList(), true)) // 3è param: contrôle du type 138 if(!in_array($_POST["bloc_select"], array_keys(Blocks::$blocks), true)) // 3è param: contrôle du type
139 { 139 {
140 header("Location: " . new URL(['page' => $_GET['page'], 'error' => 'bad_bloc_type'])); 140 header("Location: " . new URL(['page' => $_GET['page'], 'error' => 'bad_bloc_type']));
141 die; 141 die;
@@ -168,13 +168,13 @@ class PageManagementController
168 168
169 // valeurs par défaut 169 // valeurs par défaut
170 if($_POST["bloc_select"] === 'post_block'){ 170 if($_POST["bloc_select"] === 'post_block'){
171 $data->setPresentation(Presentation::findPresentation($entityManager, 'fullwidth')); // pas génial l'utilisation de l'index dans la table 171 $data->setPresentation('fullwidth');
172 } 172 }
173 elseif($_POST["bloc_select"] === 'news_block'){ 173 elseif($_POST["bloc_select"] === 'news_block'){
174 $data->setPresentation(Presentation::findPresentation($entityManager, 'grid')); 174 $data->setPresentation('grid');
175 } 175 }
176 elseif($_POST["bloc_select"] === 'galery'){ 176 elseif($_POST["bloc_select"] === 'galery'){
177 $data->setPresentation(Presentation::findPresentation($entityManager, 'mosaic')); // mieux que carousel pour commencer 177 $data->setPresentation('mosaic'); // mieux que carousel pour commencer
178 } 178 }
179 // else = null par défaut 179 // else = null par défaut
180 180
@@ -274,9 +274,8 @@ class PageManagementController
274 $director = new Director($entityManager, false); 274 $director = new Director($entityManager, false);
275 $director->findNodeById($json['id']); 275 $director->findNodeById($json['id']);
276 276
277 $presentation = Presentation::findPresentation($entityManager, $json['presentation']); 277 if(in_array($json['presentation'], array_keys(Blocks::$presentations))){
278 if($presentation !== null){ 278 $director->getNode()->getNodeData()->setPresentation($json['presentation']);
279 $director->getNode()->getNodeData()->setPresentation($presentation);
280 279
281 $entityManager->flush(); 280 $entityManager->flush();
282 281