From 7f13ca69bb71a0eb477cbf4f4bfcd08b2843bf9b Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 31 Mar 2025 22:50:11 +0200 Subject: inversion de deux articles --- src/controller/ajax.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/controller') diff --git a/src/controller/ajax.php b/src/controller/ajax.php index 130c4c6..bcba3f2 100644 --- a/src/controller/ajax.php +++ b/src/controller/ajax.php @@ -58,6 +58,23 @@ if($_SERVER['CONTENT_TYPE'] === 'application/json' && isset($_GET['action'])) } die; } + // inversion de la position de deux noeuds + elseif($_GET['action'] === 'switch_positions' && isset($json['id1']) && isset($json['id2'])) + { + $director = new Director($entityManager); + $director->makeArticleNode($json['id1']); + $node1 = $director->getRootNode(); + $director->makeArticleNode($json['id2']); + $node2 = $director->getRootNode(); + + $tmp = $node1->getPosition(); + $node1->setPosition($node2->getPosition()); + $node2->setPosition($tmp); + $entityManager->flush(); + + echo json_encode(['success' => true]); + die; + } } // détection des requêtes d'upload d'image de tinymce -- cgit v1.2.3