diff options
| author | polo <ordipolo@gmx.fr> | 2025-06-26 11:11:24 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-06-26 11:11:24 +0200 |
| commit | f60a9d046088b3bad3e97ff568fc83fecc67ccde (patch) | |
| tree | 7ed05b051abf68c21997e8fab70457ebb8af4b60 /src/controller/post.php | |
| parent | 3e17f6ef6983a9f24ca658fd1b9f856d3f09fcd7 (diff) | |
| download | cms-f60a9d046088b3bad3e97ff568fc83fecc67ccde.tar.gz cms-f60a9d046088b3bad3e97ff568fc83fecc67ccde.tar.bz2 cms-f60a9d046088b3bad3e97ff568fc83fecc67ccde.zip | |
ajout dans css_array à la création d'un bloc
Diffstat (limited to 'src/controller/post.php')
| -rw-r--r-- | src/controller/post.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/controller/post.php b/src/controller/post.php index 3ba0656..7e6ed53 100644 --- a/src/controller/post.php +++ b/src/controller/post.php | |||
| @@ -132,8 +132,32 @@ if($_SERVER['REQUEST_METHOD'] === 'POST' && $_SESSION['admin'] === true) | |||
| 132 | $main = $director->getNode(); | 132 | $main = $director->getNode(); |
| 133 | $position = count($main->getChildren()) + 1; // position dans la fraterie | 133 | $position = count($main->getChildren()) + 1; // position dans la fraterie |
| 134 | 134 | ||
| 135 | $blocs_true_names = ['blog', 'grid', 'calendar', 'galery', 'form']; // même liste dans FormBuilder.php | ||
| 136 | if(!in_array($_POST["bloc_select"], $blocs_true_names, true)) // 3è param: contrôle du type | ||
| 137 | { | ||
| 138 | header("Location: " . new URL(['page' => $_GET['page'], 'error' => 'bad_bloc_type'])); | ||
| 139 | die; | ||
| 140 | } | ||
| 141 | |||
| 142 | if($_POST["bloc_select"] === 'calendar'){ | ||
| 143 | $dql = 'SELECT n FROM App\Entity\Node n WHERE n.page = :page AND n.name_node = :name'; // noeud 'head' de la page | ||
| 144 | $bulk_data = $entityManager | ||
| 145 | ->createQuery($dql) | ||
| 146 | ->setParameter('page', $page) | ||
| 147 | ->setParameter('name', 'head') | ||
| 148 | ->getResult(); | ||
| 149 | |||
| 150 | if(count($bulk_data) != 1){ // 1 head par page | ||
| 151 | header("Location: " . new URL(['page' => $_GET['page'], 'error' => 'head_node_not_found'])); | ||
| 152 | die; | ||
| 153 | } | ||
| 154 | |||
| 155 | $bulk_data[0]->addAttribute('css_array', 'calendar'); | ||
| 156 | $entityManager->persist($bulk_data[0]); | ||
| 157 | } | ||
| 158 | |||
| 135 | $bloc = new Node( | 159 | $bloc = new Node( |
| 136 | trim(htmlspecialchars($_POST["bloc_select"])), | 160 | $_POST["bloc_select"], |
| 137 | null, [], | 161 | null, [], |
| 138 | $position, | 162 | $position, |
| 139 | $main, | 163 | $main, |
