diff options
| author | polo <ordipolo@gmx.fr> | 2025-10-22 15:28:02 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-10-22 15:28:02 +0200 |
| commit | c9aff025aa7e01badaad8467af6165b400cdaac4 (patch) | |
| tree | c6e56a3f13db401c9f75bf9f8e4169f50aaf25b9 /src/controller | |
| parent | 426a1a69cb73007538336debc31b34c4348e1ba1 (diff) | |
| download | cms-c9aff025aa7e01badaad8467af6165b400cdaac4.tar.gz cms-c9aff025aa7e01badaad8467af6165b400cdaac4.tar.bz2 cms-c9aff025aa7e01badaad8467af6165b400cdaac4.zip | |
possibilité d'éditer le texte dans header et footer, class JS InputText, Model::findWhateverNode
Diffstat (limited to 'src/controller')
| -rw-r--r-- | src/controller/HeadFootController.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/controller/HeadFootController.php b/src/controller/HeadFootController.php new file mode 100644 index 0000000..c7a9cec --- /dev/null +++ b/src/controller/HeadFootController.php | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | <?php | ||
| 2 | // src/controller/HeadFootController.php | ||
| 3 | |||
| 4 | declare(strict_types=1); | ||
| 5 | |||
| 6 | //use App\Entity\Node; | ||
| 7 | //use App\Entity\NodeData; | ||
| 8 | //use App\Entity\Image; | ||
| 9 | //use Doctrine\Common\Collections\ArrayCollection; | ||
| 10 | use Doctrine\ORM\EntityManager; | ||
| 11 | |||
| 12 | class HeadFootController | ||
| 13 | { | ||
| 14 | static public function setTextData(EntityManager $entityManager, array $request_params, array $json): void | ||
| 15 | { | ||
| 16 | if(count($request_params) !== 2){ | ||
| 17 | echo json_encode(['success' => false]); | ||
| 18 | die; | ||
| 19 | } | ||
| 20 | |||
| 21 | $model = new Model($entityManager); | ||
| 22 | if($model->findWhateverNode('name_node', $request_params[0])){ | ||
| 23 | $node_data = $model->getNode()->getNodeData(); | ||
| 24 | $node_data->updateData($request_params[1], htmlspecialchars($json['new_text'])); // $request_params[1] n'est pas contrôlé | ||
| 25 | $entityManager->flush(); | ||
| 26 | echo json_encode(['success' => true]); | ||
| 27 | } | ||
| 28 | else{ | ||
| 29 | echo json_encode(['success' => false]); | ||
| 30 | } | ||
| 31 | die; | ||
| 32 | } | ||
| 33 | } \ No newline at end of file | ||
