Préparation page admin et ajout catégorie par l'admin (controller, model et update entity)
This commit is contained in:
parent
c8458a3150
commit
124381521f
1 changed files with 45 additions and 0 deletions
45
app/controllers/admin_controller.php
Normal file
45
app/controllers/admin_controller.php
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require("../app/models/project_model.php");
|
||||||
|
require("../app/entities/project_entity.php");
|
||||||
|
require("../app/models/category_model.php");
|
||||||
|
require("../app/entities/category_entity.php");
|
||||||
|
require("../app/models/image_model.php");
|
||||||
|
require("../app/entities/image_entity.php");
|
||||||
|
require("../app/models/user_model.php");
|
||||||
|
require("../app/entities/user_entity.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Le controller de la partie accessible uniquement par l'admin
|
||||||
|
* @author Laura
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Admin{
|
||||||
|
|
||||||
|
public function admin() {
|
||||||
|
|
||||||
|
$objCategory = new Category ();
|
||||||
|
$objCategory->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');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue