diff options
Diffstat (limited to 'src/controller/PageManagementController.php')
| -rw-r--r-- | src/controller/PageManagementController.php | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/controller/PageManagementController.php b/src/controller/PageManagementController.php index e811a6a..27bf2c2 100644 --- a/src/controller/PageManagementController.php +++ b/src/controller/PageManagementController.php | |||
| @@ -85,10 +85,7 @@ class PageManagementController | |||
| 85 | $page); | 85 | $page); |
| 86 | $node->useDefaultAttributes(); // fichiers CSS et JS | 86 | $node->useDefaultAttributes(); // fichiers CSS et JS |
| 87 | 87 | ||
| 88 | $data = new NodeData([ | 88 | $data = new NodeData(['description' => trim(htmlspecialchars($_POST["page_description"]))], $node); |
| 89 | // pas de titre, il est dans $page | ||
| 90 | 'description' => trim(htmlspecialchars($_POST["page_description"]))], | ||
| 91 | $node); | ||
| 92 | 89 | ||
| 93 | $bulk_data = $entityManager | 90 | $bulk_data = $entityManager |
| 94 | ->createQuery('SELECT n FROM App\Entity\Image n WHERE n.file_name LIKE :name') | 91 | ->createQuery('SELECT n FROM App\Entity\Image n WHERE n.file_name LIKE :name') |
| @@ -162,9 +159,7 @@ class PageManagementController | |||
| 162 | } | 159 | } |
| 163 | 160 | ||
| 164 | $block = new Node($_POST["bloc_select"], [], $position, $main, $page); | 161 | $block = new Node($_POST["bloc_select"], [], $position, $main, $page); |
| 165 | $data = new NodeData( | 162 | $data = new NodeData(['title' => trim(htmlspecialchars($_POST["bloc_title"]))], $block); |
| 166 | ['title' => trim(htmlspecialchars($_POST["bloc_title"]))], | ||
| 167 | $block); | ||
| 168 | 163 | ||
| 169 | // valeurs par défaut | 164 | // valeurs par défaut |
| 170 | if($_POST["bloc_select"] === 'post_block'){ | 165 | if($_POST["bloc_select"] === 'post_block'){ |
| @@ -268,6 +263,33 @@ class PageManagementController | |||
| 268 | die; | 263 | die; |
| 269 | } | 264 | } |
| 270 | 265 | ||
| 266 | static public function changeArticlesOrder(EntityManager $entityManager, array $json): void | ||
| 267 | { | ||
| 268 | if(isset($json['id']) && isset($json['chrono_order'])){ | ||
| 269 | $director = new Director($entityManager, false); | ||
| 270 | $director->findNodeById($json['id']); | ||
| 271 | |||
| 272 | if($json['chrono_order'] === 'chrono'){ | ||
| 273 | $chrono_order = true; | ||
| 274 | } | ||
| 275 | elseif($json['chrono_order'] === 'antichrono'){ | ||
| 276 | $chrono_order = false; | ||
| 277 | } | ||
| 278 | else{ | ||
| 279 | echo json_encode(['success' => false]); | ||
| 280 | die; | ||
| 281 | } | ||
| 282 | $director->getNode()->getNodeData()->setChronoOrder($chrono_order); | ||
| 283 | $entityManager->flush(); | ||
| 284 | |||
| 285 | echo json_encode(['success' => true, 'chrono_order' => $json['chrono_order']]); | ||
| 286 | } | ||
| 287 | else{ | ||
| 288 | echo json_encode(['success' => false]); | ||
| 289 | } | ||
| 290 | die; | ||
| 291 | } | ||
| 292 | |||
| 271 | static public function changePresentation(EntityManager $entityManager, array $json): void | 293 | static public function changePresentation(EntityManager $entityManager, array $json): void |
| 272 | { | 294 | { |
| 273 | if(isset($json['id']) && isset($json['presentation'])){ | 295 | if(isset($json['id']) && isset($json['presentation'])){ |
| @@ -276,7 +298,6 @@ class PageManagementController | |||
| 276 | 298 | ||
| 277 | if(in_array($json['presentation'], array_keys(Blocks::$presentations))){ | 299 | if(in_array($json['presentation'], array_keys(Blocks::$presentations))){ |
| 278 | $director->getNode()->getNodeData()->setPresentation($json['presentation']); | 300 | $director->getNode()->getNodeData()->setPresentation($json['presentation']); |
| 279 | |||
| 280 | $entityManager->flush(); | 301 | $entityManager->flush(); |
| 281 | 302 | ||
| 282 | $response_data = ['success' => true, 'presentation' => $json['presentation']]; | 303 | $response_data = ['success' => true, 'presentation' => $json['presentation']]; |
