diff options
| author | polo <ordipolo@gmx.fr> | 2025-10-09 14:40:54 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-10-09 14:40:54 +0200 |
| commit | f0d1cd5d68579b462cf01a4a9f7d558a231bc072 (patch) | |
| tree | 2769cef714275d86781a46c2d1f1a8981e3b4bcf /src/controller | |
| parent | 44f4110d53f58086b17d17afe81b0da0978d2a29 (diff) | |
| download | cms-f0d1cd5d68579b462cf01a4a9f7d558a231bc072.tar.gz cms-f0d1cd5d68579b462cf01a4a9f7d558a231bc072.tar.bz2 cms-f0d1cd5d68579b462cf01a4a9f7d558a231bc072.zip | |
description de page déplacée dans la table page
Diffstat (limited to 'src/controller')
| -rw-r--r-- | src/controller/ArticleController.php | 4 | ||||
| -rw-r--r-- | src/controller/PageManagementController.php | 17 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/controller/ArticleController.php b/src/controller/ArticleController.php index 8bbef19..fabd997 100644 --- a/src/controller/ArticleController.php +++ b/src/controller/ArticleController.php | |||
| @@ -151,10 +151,10 @@ class ArticleController | |||
| 151 | die; | 151 | die; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static public function deleteArticle(EntityManager $entityManager, array $json): Response | 154 | static public function deleteArticle(EntityManager $entityManager, array $data): Response // $data peut être un $_GET ou du JSON |
| 155 | { | 155 | { |
| 156 | $director = new Director($entityManager); | 156 | $director = new Director($entityManager); |
| 157 | if(!$director->makeArticleNode($json['id'], true)){ | 157 | if(!$director->makeArticleNode($data['id'], true)){ |
| 158 | return new Response( | 158 | return new Response( |
| 159 | '{"success": false, "message": "Erreur: pas d\'article à supprimer"}', | 159 | '{"success": false, "message": "Erreur: pas d\'article à supprimer"}', |
| 160 | Response::HTTP_INTERNAL_SERVER_ERROR); // 500 | 160 | Response::HTTP_INTERNAL_SERVER_ERROR); // 500 |
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') |
