diff options
| author | polo <ordipolo@gmx.fr> | 2025-10-29 21:42:39 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-10-29 21:42:39 +0100 |
| commit | bce9fda51d334a547ec5a48f0b7699ed3b5d7944 (patch) | |
| tree | f4b3b57414a22c2b9542195bfd76eaf6e2853293 /src/controller | |
| parent | 822f526fd7f4e89043e64b435961720b622bdb6e (diff) | |
| download | cms-bce9fda51d334a547ec5a48f0b7699ed3b5d7944.tar.gz cms-bce9fda51d334a547ec5a48f0b7699ed3b5d7944.tar.bz2 cms-bce9fda51d334a547ec5a48f0b7699ed3b5d7944.zip | |
classe Fetcher, gestion réseaux sociaux présents/absents, partie 2
Diffstat (limited to 'src/controller')
| -rw-r--r-- | src/controller/HeadFootController.php | 30 |
1 files changed, 28 insertions, 2 deletions
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 | |||
| 22 | if($model->findWhateverNode('name_node', $params_array[0])){ | 22 | if($model->findWhateverNode('name_node', $params_array[0])){ |
| 23 | $node_data = $model->getNode()->getNodeData(); | 23 | $node_data = $model->getNode()->getNodeData(); |
| 24 | 24 | ||
| 25 | // liens réseaux sociaux | ||
| 25 | if(in_array($params_array[1], NodeData::$social_networks)){ | 26 | if(in_array($params_array[1], NodeData::$social_networks)){ |
| 26 | $social = $node_data->getData()['social']; | 27 | $social = $node_data->getData()['social'] ?? []; |
| 27 | $social[$params_array[1]] = $json['new_text']; | 28 | $social[$params_array[1]] = $json['new_text']; |
| 28 | $node_data->updateData('social', $social); | 29 | $node_data->updateData('social', $social); |
| 29 | } | 30 | } |
| 31 | // autres textes | ||
| 30 | else{ | 32 | else{ |
| 31 | $node_data->updateData($params_array[1], $json['new_text']); // $params_array[1] n'est pas contrôlé | 33 | $node_data->updateData($params_array[1], $json['new_text']); // $params_array[1] n'est pas contrôlé |
| 32 | } | 34 | } |
| 33 | 35 | ||
| 34 | $entityManager->flush(); | 36 | $entityManager->flush(); |
| 35 | echo json_encode(['success' => true]); | 37 | echo json_encode(['success' => true]); |
| 36 | } | 38 | } |
| @@ -120,5 +122,29 @@ class HeadFootController | |||
| 120 | die; | 122 | die; |
| 121 | } | 123 | } |
| 122 | 124 | ||
| 125 | static public function displaySocialNetwork(EntityManager $entityManager, string $request_params, array $json): void | ||
| 126 | { | ||
| 127 | $params_array = explode('_', $request_params); | ||
| 128 | if(count($params_array) !== 2){ | ||
| 129 | echo json_encode(['success' => false]); | ||
| 130 | die; | ||
| 131 | } | ||
| 132 | |||
| 133 | $model = new Model($entityManager); | ||
| 134 | if(in_array($params_array[1], NodeData::$social_networks) && $model->findWhateverNode('name_node', $params_array[0])){ | ||
| 135 | $node_data = $model->getNode()->getNodeData(); | ||
| 136 | $social_show = $node_data->getData()['social_show'] ?? []; | ||
| 137 | $social_show[$params_array[1]] = $json['checked']; | ||
| 138 | $node_data->updateData('social_show', $social_show); | ||
| 139 | |||
| 140 | $entityManager->flush(); | ||
| 141 | echo json_encode(['success' => true, 'checked' => $json['checked']]); | ||
| 142 | } | ||
| 143 | else{ | ||
| 144 | echo json_encode(['success' => false]); | ||
| 145 | } | ||
| 146 | die; | ||
| 147 | } | ||
| 148 | |||
| 123 | //static public function uploadImage(EntityManager $entityManager, array $request_params): void | 149 | //static public function uploadImage(EntityManager $entityManager, array $request_params): void |
| 124 | } \ No newline at end of file | 150 | } \ No newline at end of file |
