diff options
| author | polo <ordipolo@gmx.fr> | 2025-05-09 01:02:23 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-05-09 01:02:23 +0200 |
| commit | d2bdfa7d0f746f060090a9e8c8ad6e376b5a1480 (patch) | |
| tree | 985e8aca070a0f4ad56bea31ceb19b759828027c /src/controller/ajax.php | |
| parent | 0f497d215de8e16739263e2718bd39640a6cc4d8 (diff) | |
| download | cms-d2bdfa7d0f746f060090a9e8c8ad6e376b5a1480.tar.gz cms-d2bdfa7d0f746f060090a9e8c8ad6e376b5a1480.tar.bz2 cms-d2bdfa7d0f746f060090a9e8c8ad6e376b5a1480.zip | |
mode modif page terminé!
Diffstat (limited to 'src/controller/ajax.php')
| -rw-r--r-- | src/controller/ajax.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/controller/ajax.php b/src/controller/ajax.php index a6786d9..a64c39b 100644 --- a/src/controller/ajax.php +++ b/src/controller/ajax.php | |||
| @@ -378,7 +378,43 @@ if($_SERVER['CONTENT_TYPE'] === 'application/json' && isset($_GET['bloc_edit'])) | |||
| 378 | } | 378 | } |
| 379 | die; | 379 | die; |
| 380 | } | 380 | } |
| 381 | // inversion des positions de deux blocs | ||
| 382 | elseif($_GET['bloc_edit'] === 'switch_blocs_positions') | ||
| 383 | { | ||
| 384 | if(isset($json['id1']) && is_int($json['id1']) && isset($json['id2']) && is_int($json['id2']) && isset($_GET['page'])){ | ||
| 385 | $director = new Director($entityManager, true); | ||
| 386 | $director->findUniqueNodeByName('main'); | ||
| 387 | $director->findItsChildren(); | ||
| 388 | $main = $director->getNode(); | ||
| 389 | $main->sortChildren(true); // régénère les positions avant inversion | ||
| 390 | |||
| 391 | $bloc1; $bloc2; | ||
| 392 | foreach($main->getChildren() as $child){ | ||
| 393 | if($child->getId() === $json['id1']){ | ||
| 394 | $bloc1 = $child; | ||
| 395 | break; | ||
| 396 | } | ||
| 397 | } | ||
| 398 | foreach($main->getChildren() as $child){ | ||
| 399 | if($child->getId() === $json['id2']){ | ||
| 400 | $bloc2 = $child; | ||
| 401 | break; | ||
| 402 | } | ||
| 403 | } | ||
| 381 | 404 | ||
| 405 | // inversion | ||
| 406 | $tmp = $bloc1->getPosition(); | ||
| 407 | $bloc1->setPosition($bloc2->getPosition()); | ||
| 408 | $bloc2->setPosition($tmp); | ||
| 409 | |||
| 410 | $entityManager->flush(); | ||
| 411 | echo json_encode(['success' => true]); | ||
| 412 | } | ||
| 413 | else{ | ||
| 414 | echo json_encode(['success' => false]); | ||
| 415 | } | ||
| 416 | die; | ||
| 417 | } | ||
| 382 | } | 418 | } |
| 383 | 419 | ||
| 384 | 420 | ||
