From 124381521f226c66dce9f4701413460b5306c001 Mon Sep 17 00:00:00 2001 From: "laura.chevillet" Date: Fri, 23 Jan 2026 14:24:35 +0100 Subject: [PATCH] =?UTF-8?q?Pr=C3=A9paration=20page=20admin=20et=20ajout=20?= =?UTF-8?q?cat=C3=A9gorie=20par=20l'admin=20(controller,=20model=20et=20up?= =?UTF-8?q?date=20entity)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.php | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 app/controllers/admin_controller.php diff --git a/app/controllers/admin_controller.php b/app/controllers/admin_controller.php new file mode 100644 index 0000000..511e117 --- /dev/null +++ b/app/controllers/admin_controller.php @@ -0,0 +1,45 @@ +setName($_POST['category_name'] ?? ""); + $objCategory->setParent($_POST['category_parent'] ?? ""); + + $objCategoryModel = new CategoryModel(); + $boolInsert = $objCategoryModel->insert($objCategory); + + /* EN ATTENTE + if ($boolInsert === true) { + $_SESSION['success'] = "Catégorie ajoutée avec succès"; + header("Location:index.php?ctrl=admin&action=admin"); + exit; + } else { + // Erreur globale + $arrError['global'] = "Erreur lors de l'ajout"; + } + */ + + include('../app/views/partials/header.php'); + include('../app/views/admin.php'); + include('../app/views/partials/footer.php'); + + } + + } \ No newline at end of file