diff options
Diffstat (limited to 'src/controller/PageManagementController.php')
-rw-r--r-- | src/controller/PageManagementController.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/controller/PageManagementController.php b/src/controller/PageManagementController.php index 8efcb79..e6886b1 100644 --- a/src/controller/PageManagementController.php +++ b/src/controller/PageManagementController.php | |||
@@ -45,25 +45,26 @@ class PageManagementController | |||
45 | 45 | ||
46 | static public function setPageDescription(EntityManager $entityManager, array $json): void | 46 | static public function setPageDescription(EntityManager $entityManager, array $json): void |
47 | { | 47 | { |
48 | $node_data = $entityManager->find('App\Entity\NodeData', $json['node_data_id']); | 48 | $page = $entityManager->find('App\Entity\Page', $json['page_id']); |
49 | $node_data->updateData('description', htmlspecialchars($json['description'])); | 49 | $page->setDescription(htmlspecialchars($json['description'])); |
50 | $entityManager->flush(); | 50 | $entityManager->flush(); |
51 | echo json_encode(['success' => true, 'description' => $node_data->getData()['description']]); | 51 | echo json_encode(['success' => true, 'description' => $page->getDescription()]); |
52 | die; | 52 | die; |
53 | } | 53 | } |
54 | 54 | ||
55 | static public function newPage(EntityManager $entityManager): void | 55 | static public function newPage(EntityManager $entityManager, array $post): void |
56 | { | 56 | { |
57 | // titre et chemin | 57 | // titre et chemin |
58 | $director = new Director($entityManager); | 58 | $director = new Director($entityManager); |
59 | $director->makeMenuAndPaths(); | 59 | $director->makeMenuAndPaths(); |
60 | //Director::$menu_data = new Menu($entityManager); | 60 | //Director::$menu_data = new Menu($entityManager); |
61 | $previous_page = Director::$menu_data->findPageById((int)$_POST["page_location"]); // (int) à cause de declare(strict_types=1); | 61 | $previous_page = Director::$menu_data->findPageById((int)$post["page_location"]); // (int) à cause de declare(strict_types=1); |
62 | $parent = $previous_page->getParent(); | 62 | $parent = $previous_page->getParent(); |
63 | 63 | ||
64 | $page = new Page( | 64 | $page = new Page( |
65 | trim(htmlspecialchars($_POST["page_name"])), | 65 | trim(htmlspecialchars($post["page_name"])), |
66 | trim(htmlspecialchars($_POST["page_name_path"])), | 66 | trim(htmlspecialchars($post["page_name_path"])), |
67 | trim(htmlspecialchars($post["page_description"])), | ||
67 | true, true, false, | 68 | true, true, false, |
68 | $previous_page->getPosition(), | 69 | $previous_page->getPosition(), |
69 | $parent); // peut et DOIT être null si on est au 1er niveau | 70 | $parent); // peut et DOIT être null si on est au 1er niveau |
@@ -86,7 +87,7 @@ class PageManagementController | |||
86 | $page); | 87 | $page); |
87 | $node->useDefaultAttributes(); // fichiers CSS et JS | 88 | $node->useDefaultAttributes(); // fichiers CSS et JS |
88 | 89 | ||
89 | $data = new NodeData(['description' => trim(htmlspecialchars($_POST["page_description"]))], $node); | 90 | $data = new NodeData([], $node); |
90 | 91 | ||
91 | $bulk_data = $entityManager | 92 | $bulk_data = $entityManager |
92 | ->createQuery('SELECT n FROM App\Entity\Image n WHERE n.file_name LIKE :name') | 93 | ->createQuery('SELECT n FROM App\Entity\Image n WHERE n.file_name LIKE :name') |