From bce9fda51d334a547ec5a48f0b7699ed3b5d7944 Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 29 Oct 2025 21:42:39 +0100 Subject: =?UTF-8?q?classe=20Fetcher,=20gestion=20r=C3=A9seaux=20sociaux=20?= =?UTF-8?q?pr=C3=A9sents/absents,=20partie=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/HeadFootController.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src/controller/HeadFootController.php') diff --git a/src/controller/HeadFootController.php b/src/controller/HeadFootController.php index 7597683..a4727e2 100644 --- a/src/controller/HeadFootController.php +++ b/src/controller/HeadFootController.php @@ -22,15 +22,17 @@ class HeadFootController if($model->findWhateverNode('name_node', $params_array[0])){ $node_data = $model->getNode()->getNodeData(); + // liens réseaux sociaux if(in_array($params_array[1], NodeData::$social_networks)){ - $social = $node_data->getData()['social']; + $social = $node_data->getData()['social'] ?? []; $social[$params_array[1]] = $json['new_text']; $node_data->updateData('social', $social); } + // autres textes else{ $node_data->updateData($params_array[1], $json['new_text']); // $params_array[1] n'est pas contrôlé } - + $entityManager->flush(); echo json_encode(['success' => true]); } @@ -120,5 +122,29 @@ class HeadFootController die; } + static public function displaySocialNetwork(EntityManager $entityManager, string $request_params, array $json): void + { + $params_array = explode('_', $request_params); + if(count($params_array) !== 2){ + echo json_encode(['success' => false]); + die; + } + + $model = new Model($entityManager); + if(in_array($params_array[1], NodeData::$social_networks) && $model->findWhateverNode('name_node', $params_array[0])){ + $node_data = $model->getNode()->getNodeData(); + $social_show = $node_data->getData()['social_show'] ?? []; + $social_show[$params_array[1]] = $json['checked']; + $node_data->updateData('social_show', $social_show); + + $entityManager->flush(); + echo json_encode(['success' => true, 'checked' => $json['checked']]); + } + else{ + echo json_encode(['success' => false]); + } + die; + } + //static public function uploadImage(EntityManager $entityManager, array $request_params): void } \ No newline at end of file -- cgit v1.2.3