Merge branch 'main' into guillaume
This commit is contained in:
commit
9c19aa5525
24 changed files with 598 additions and 121 deletions
|
|
@ -25,6 +25,7 @@
|
|||
header("Location:index.php?ctrl=error&action=error_403");
|
||||
exit;
|
||||
}
|
||||
var_dump($_SESSION);
|
||||
|
||||
//gestion de l'user
|
||||
$objCategoryModel = new CategoryModel;
|
||||
|
|
@ -33,6 +34,7 @@
|
|||
$newCat = new Category();
|
||||
$newCat->setName($_POST['new_category']);
|
||||
$objCategoryModel->insertCategory($newCat);
|
||||
$_SESSION['success'] = "La catégorie a bien été ajoutée";
|
||||
header('Location: index.php?ctrl=admin&action=admin');
|
||||
exit;
|
||||
}
|
||||
|
|
@ -68,12 +70,12 @@
|
|||
$objUser->setId($intUserId);
|
||||
$objUser->setStatus((int)$_POST['new_status']);
|
||||
if ($objUserModel->editStatus($objUser)) {
|
||||
$_SESSION['message_success'] = "Le statut a bien été modifié !";
|
||||
$_SESSION['success'] = "Le statut a bien été modifié !";
|
||||
}
|
||||
}
|
||||
elseif ($_POST['action'] === 'delete_user') {
|
||||
$objUserModel->delete_soft($intUserId);
|
||||
$_SESSION['message_success'] = "L'utilisateur a été supprimé.";
|
||||
$_SESSION['success'] = "L'utilisateur a été supprimé.";
|
||||
}
|
||||
header("Location: index.php?ctrl=admin&action=admin");
|
||||
exit;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
/**
|
||||
* Méthode d'affichage des pages
|
||||
*/
|
||||
protected function _display($strView){
|
||||
protected function _display($strView, bool $boolDisplay = true){
|
||||
// Création de l'objet Smarty
|
||||
$objSmarty = new Smarty();
|
||||
// Ajouter le var_dump au modificateur de smarty : vardump est le nom appelé après le |
|
||||
|
|
@ -32,8 +32,18 @@
|
|||
// Message de succès
|
||||
$objSmarty->assign("success_message", $_SESSION['success']??'');
|
||||
unset($_SESSION['success']);
|
||||
|
||||
if (isset($_SESSION['error'])){
|
||||
$objSmarty->assign("arrError", array($_SESSION['error']));
|
||||
unset($_SESSION['error']);
|
||||
}
|
||||
|
||||
if ($boolDisplay){
|
||||
$objSmarty->display("views/".$strView.".tpl");
|
||||
}else{
|
||||
return $objSmarty->fetch("views/".$strView.".tpl");
|
||||
}
|
||||
|
||||
$objSmarty->display("views/".$strView.".tpl");
|
||||
|
||||
|
||||
// inclusion du header
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue