Création entity et model d'authorisation. Création de toute la fonctionnalité de modifier le statut et supprimer un user ok fonction et verif bdd

This commit is contained in:
laura.chevillet 2026-02-09 16:03:51 +01:00
parent 3a80108ba5
commit 3af2e8a056
14 changed files with 456 additions and 76 deletions

View file

@ -8,6 +8,8 @@
require("./entities/image_entity.php"); require("./entities/image_entity.php");
require("./models/user_model.php"); require("./models/user_model.php");
require("./entities/user_entity.php"); require("./entities/user_entity.php");
require("./models/authorisation_model.php");
require("./entities/authorisation_entity.php");
require("mother_controller.php"); require("mother_controller.php");
/** /**
@ -23,6 +25,8 @@
header("Location:index.php?ctrl=error&action=error_403"); header("Location:index.php?ctrl=error&action=error_403");
exit; exit;
} }
//gestion de l'user
$objCategoryModel = new CategoryModel; $objCategoryModel = new CategoryModel;
if (!empty($_POST['new_category'])) { if (!empty($_POST['new_category'])) {
@ -42,6 +46,7 @@
exit; exit;
} }
//affichage select des catégories
$arrCategory = $objCategoryModel->findAllCategory(); $arrCategory = $objCategoryModel->findAllCategory();
$arrCategoryToDisplay = array(); $arrCategoryToDisplay = array();
@ -51,8 +56,55 @@
$arrCategoryToDisplay[] = $objCategory; $arrCategoryToDisplay[] = $objCategory;
} }
//gestion de l'user
$objUserModel = new UserModel;
if (!empty($_POST['action'])) {
$intUserId = (int)$_POST['user_id'];
if ($intUserId > 0) {
if ($_POST['action'] === 'update_status' && !empty($_POST['new_status'])) {
$objUser = new User();
$objUser->setId($intUserId);
$objUser->setStatus((int)$_POST['new_status']);
if ($objUserModel->editStatus($objUser)) {
$_SESSION['message_success'] = "Le statut a bien été modifié !";
}
}
elseif ($_POST['action'] === 'delete_user') {
$objUserModel->delete_soft($intUserId);
$_SESSION['message_success'] = "L'utilisateur a été supprimé.";
}
header("Location: index.php?ctrl=admin&action=admin");
exit;
}
}
//affichage select des users
$arrUser = $objUserModel->findAllUsers();
$arrUserToDisplay = array();
foreach($arrUser as $arrDetUser){
$objUser = new User;
$objUser->hydrate($arrDetUser);
$arrUserToDisplay[] = $objUser;
}
//affichage select des authorisations
$objAuthorisationModel = new AuthorisationModel;
$arrAuthorisation = $objAuthorisationModel->findAllAuthorisation();
$arrAuthorisationToDisplay = array();
foreach($arrAuthorisation as $arrDetAuthorisation){
$objAuthorisation = new Authorisation;
$objAuthorisation->hydrate($arrDetAuthorisation);
$arrAuthorisationToDisplay[] = $objAuthorisation;
}
//gérer l'affichage //gérer l'affichage
$this->_arrData['arrCategoryToDisplay'] = $arrCategoryToDisplay; $this->_arrData['arrCategoryToDisplay'] = $arrCategoryToDisplay;
$this->_arrData['arrUserToDisplay'] = $arrUserToDisplay;
$this->_arrData['arrAuthorisationToDisplay'] = $arrAuthorisationToDisplay;
$this->_display("admin"); $this->_display("admin");
} }
} }

View file

@ -0,0 +1,24 @@
<?php
require_once("mother_entity.php");
class Authorisation extends Entity{
private int $_id;
private string $_name = '';
public function __construct(){
$this->_prefix = 'authorisation_';
}
public function getId():int{
return $this->_id;
}
public function setId(int $id){
$this->_id = $id;
}
public function getName():string{
return $this->_name;
}
}

View file

@ -0,0 +1,29 @@
<?php
require_once('mother_model.php');
/**
* Traitement des requêtes pour le status de l'utilisateur
* @author : Laura
*/
class AuthorisationModel extends Connect{
public function __construct(){
parent::__construct();
}
/**
* fonction de récupération des infos d'authorisation
* @return array
*/
public function findAllAuthorisation():array{
$strRq = "SELECT *
FROM authorisation";
return $this->_db->query($strRq)->fetchAll();
}
}

View file

@ -22,7 +22,8 @@
public function findAllUsers():array{ public function findAllUsers():array{
// Ecrire la requête // Ecrire la requête
$strRq = "SELECT user_id, user_firstname, user_name, user_image, user_status, authorisation_name $strRq = "SELECT user_id, user_firstname, user_name, user_image, user_status, authorisation_name
FROM users INNER JOIN authorisation ON authorisation.authorisation_id = users.user_status"; FROM users INNER JOIN authorisation ON authorisation.authorisation_id = users.user_status
WHERE user_deleted_at IS NULL";
// Lancer la requête et récupérer les résultats // Lancer la requête et récupérer les résultats
return $this->_db->query($strRq)->fetchAll(); return $this->_db->query($strRq)->fetchAll();
} }
@ -50,7 +51,6 @@
} }
} }
//public function insert(string $strName, string $strFirstname, string $strMail, string $strPwd):int{
/** /**
* Fonction d'insertion d'un utilisateur en BDD * Fonction d'insertion d'un utilisateur en BDD
* @param object $objUser L'objet utilisateur * @param object $objUser L'objet utilisateur
@ -75,13 +75,10 @@
$rqPrep->bindValue(':location', $objUser->getLocation() ?? "", PDO::PARAM_STR); $rqPrep->bindValue(':location', $objUser->getLocation() ?? "", PDO::PARAM_STR);
$rqPrep->bindValue(':description', $objUser->getDescription() ?? "", PDO::PARAM_STR); $rqPrep->bindValue(':description', $objUser->getDescription() ?? "", PDO::PARAM_STR);
// 3. Executer la requête
//var_dump($strRq);die;
//return $db->exec($strRq);
return $rqPrep->execute(); return $rqPrep->execute();
} }
public function mailExists(string $mail): bool public function mailExists(string $mail): bool
{ {
$rq = $this->_db->prepare("SELECT 1 FROM users WHERE user_mail = :mail LIMIT 1"); $rq = $this->_db->prepare("SELECT 1 FROM users WHERE user_mail = :mail LIMIT 1");
@ -90,4 +87,38 @@
return (bool)$rq->fetchColumn(); return (bool)$rq->fetchColumn();
} }
/**
* Fonction de changement de status d'un utilisateur
* @param object $objUser L'objet utilisateur
* @return bool Est-ce que la requête s'est bien passée (true/false)
*/
public function editStatus(object $objUser):bool{
$strRq = "UPDATE users
SET user_status = :status
WHERE user_id = :id";
$rqPrep = $this->_db->prepare($strRq);
$rqPrep->bindValue(":id", $objUser->getId(), PDO::PARAM_INT);
$rqPrep->bindValue(":status", $objUser->getStatus(), PDO::PARAM_INT);
return $rqPrep->execute();
}
/**
* Fonction permettant de supprimer un utilisateur avec une date de suppression
* @param int $intId L'identifiant de l'utilisateur
* @return bool Est-ce que la requête s'est bien passée (true/false)
*/
public function delete_soft(int $intId):bool{
$strRq = "UPDATE users
SET user_deleted_at = NOW()
WHERE user_id = :id";
$rqPrep = $this->_db->prepare($strRq);
$rqPrep->bindValue(":id", $intId, PDO::PARAM_INT);
return $rqPrep->execute();
}
} }

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-09 13:22:09 /* Smarty version 5.7.0, created on 2026-02-09 14:54:13
from 'file:views/login.tpl' */ from 'file:views/login.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_6989df814ecac5_82975272', 'unifunc' => 'content_6989f5152cc653_86103445',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -20,18 +20,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array ( array (
), ),
))) { ))) {
function content_6989df814ecac5_82975272 (\Smarty\Template $_smarty_tpl) { function content_6989f5152cc653_86103445 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true); $_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?> ?>
<?php <?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_10819558166989df814817a5_66837906', "content"); $_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_15010700106989f5152c2920_08155243', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
} }
/* {block "content"} */ /* {block "content"} */
class Block_10819558166989df814817a5_66837906 extends \Smarty\Runtime\Block class Block_15010700106989f5152c2920_08155243 extends \Smarty\Runtime\Block
{ {
public function callBlock(\Smarty\Template $_smarty_tpl) { public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-09 13:26:33 /* Smarty version 5.7.0, created on 2026-02-09 15:02:29
from 'file:views/layout.tpl' */ from 'file:views/layout.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_6989e0891f99a9_84268185', 'unifunc' => 'content_6989f7051730f9_04925440',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -22,21 +22,21 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:views/_partial/footer.tpl' => 1, 'file:views/_partial/footer.tpl' => 1,
), ),
))) { ))) {
function content_6989e0891f99a9_84268185 (\Smarty\Template $_smarty_tpl) { function content_6989f7051730f9_04925440 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, false); $_smarty_tpl->getInheritance()->init($_smarty_tpl, false);
$_smarty_tpl->renderSubTemplate("file:views/_partial/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir); $_smarty_tpl->renderSubTemplate("file:views/_partial/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
?> ?>
<?php <?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1226719426989e0891f66b5_10703637', "content"); $_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_15212756776989f70516f3e1_13586621', "content");
?> ?>
<?php $_smarty_tpl->renderSubTemplate("file:views/_partial/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir); <?php $_smarty_tpl->renderSubTemplate("file:views/_partial/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
} }
/* {block "content"} */ /* {block "content"} */
class Block_1226719426989e0891f66b5_10703637 extends \Smarty\Runtime\Block class Block_15212756776989f70516f3e1_13586621 extends \Smarty\Runtime\Block
{ {
public function callBlock(\Smarty\Template $_smarty_tpl) { public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';

View file

@ -1,18 +1,18 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-09 13:26:32 /* Smarty version 5.7.0, created on 2026-02-09 15:02:28
from 'file:views/admin.tpl' */ from 'file:views/admin.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_6989e088f38338_64666135', 'unifunc' => 'content_6989f704df71e4_04792390',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
'ac77f39f91cdf26a0eb3f0963ead4008a7bda8fb' => 'ac77f39f91cdf26a0eb3f0963ead4008a7bda8fb' =>
array ( array (
0 => 'views/admin.tpl', 0 => 'views/admin.tpl',
1 => 1770643565, 1 => 1770649348,
2 => 'file', 2 => 'file',
), ),
), ),
@ -20,18 +20,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array ( array (
), ),
))) { ))) {
function content_6989e088f38338_64666135 (\Smarty\Template $_smarty_tpl) { function content_6989f704df71e4_04792390 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true); $_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?> ?>
<?php <?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_19184882506989e088f2e080_15773704', "content"); $_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_3881550706989f704ddce33_55904583', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
} }
/* {block "content"} */ /* {block "content"} */
class Block_19184882506989e088f2e080_15773704 extends \Smarty\Runtime\Block class Block_3881550706989f704ddce33_55904583 extends \Smarty\Runtime\Block
{ {
public function callBlock(\Smarty\Template $_smarty_tpl) { public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
@ -124,29 +124,48 @@ $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3"> <div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<div class="container-fluid pt-2"> <div class="container-fluid pt-2">
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-2">
<img src="./assests/img/Logo-Wordmark.svg" alt="" width="100"> <img src="./assests/img/Logo-Wordmark.svg" alt="" width="100">
</div> </div>
<form method="POST">
<div class="col-4"> <div class="col-4">
<select class="form-select" aria-label="Default select example"> <select class="form-select" aria-label="Default select example" name="user_id">
<option value="0" selected>Modifier le statut de l'Utilisateur...</option> <option value="0">Choisir un utilisateur</option>
<?php <?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrStatusToDisplay'), 'arrDetStatus'); $_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrUserToDisplay'), 'user');
$foreach0DoElse = true; $foreach0DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('arrDetStatus')->value) { foreach ($_from ?? [] as $_smarty_tpl->getVariable('user')->value) {
$foreach0DoElse = false; $foreach0DoElse = false;
?> ?>
<option value="<?php echo $_smarty_tpl->getValue('arrDetStatus')->getId();?> <option value="<?php echo $_smarty_tpl->getValue('user')->getId();?>
"><?php echo $_smarty_tpl->getValue('arrDetStatus')->getStatusName();?> "><?php echo $_smarty_tpl->getValue('user')->getName();?>
<?php echo $_smarty_tpl->getValue('user')->getFirstname();?>
</option>
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</select>
<select class="form-select" aria-label="Default select example" name="new_status">
<option value="0" selected>Modifier le statut de l'Utilisateur...</option>
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrAuthorisationToDisplay'), 'arrDetAuthorisation');
$foreach1DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('arrDetAuthorisation')->value) {
$foreach1DoElse = false;
?>
<option value="<?php echo $_smarty_tpl->getValue('arrDetAuthorisation')->getId();?>
"><?php echo $_smarty_tpl->getValue('arrDetAuthorisation')->getName();?>
</option> </option>
<?php <?php
} }
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?> $_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</select> </select>
</div> </div>
<div class="col-4"> <div class="col-2">
<button class="btn bg-danger text-light rounded-circle">X</button> <button type="submit" name="action" value="update_status" class="btn bg-success text-light"> Valider</button>
<button type="submit" name="action" value="delete_user" class="btn bg-danger text-light">Supprimer l'utilisateur</button>
</div> </div>
</form>
</div> </div>
</div> </div>
</div> </div>
@ -160,9 +179,9 @@ $_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
<option value="0">Modifier un catégorie existante</option> <option value="0">Modifier un catégorie existante</option>
<?php <?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrCategoryToDisplay'), 'category'); $_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrCategoryToDisplay'), 'category');
$foreach1DoElse = true; $foreach2DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('category')->value) { foreach ($_from ?? [] as $_smarty_tpl->getVariable('category')->value) {
$foreach1DoElse = false; $foreach2DoElse = false;
?> ?>
<option value="<?php echo $_smarty_tpl->getValue('category')->getId();?> <option value="<?php echo $_smarty_tpl->getValue('category')->getId();?>
"><?php echo $_smarty_tpl->getValue('category')->getName();?> "><?php echo $_smarty_tpl->getValue('category')->getName();?>
@ -179,12 +198,11 @@ $_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</div> </div>
<br> <br>
<br> <br>
<br>
<div class="row"> <div class="row">
<!-- creation cat--> <!-- creation cat-->
<div class="col-6"> <div class="col-6">
<form method="POST"> <form method="POST">
<label>Créer une nouvelle catégorie</label> <p>Créer une nouvelle catégorie</p>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="text" class="form-control" id="floatingInput" name="new_category"> <input type="text" class="form-control" id="floatingInput" name="new_category">
<label for="floatingInput">Créer une nouvelle catégorie</label> <label for="floatingInput">Créer une nouvelle catégorie</label>

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-09 13:26:33 /* Smarty version 5.7.0, created on 2026-02-09 15:02:29
from 'file:views/_partial/footer.tpl' */ from 'file:views/_partial/footer.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_6989e0893afd86_56926620', 'unifunc' => 'content_6989f705319402_84731853',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array ( array (
), ),
))) { ))) {
function content_6989e0893afd86_56926620 (\Smarty\Template $_smarty_tpl) { function content_6989f705319402_84731853 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial';
?> ?>
<footer class="footer container-fluid d-flex justify-content-around"> <footer class="footer container-fluid d-flex justify-content-around">

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-09 13:26:33 /* Smarty version 5.7.0, created on 2026-02-09 15:02:29
from 'file:views/_partial/header.tpl' */ from 'file:views/_partial/header.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_6989e0892c1ac1_16523199', 'unifunc' => 'content_6989f705231fa9_63622618',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array ( array (
), ),
))) { ))) {
function content_6989e0892c1ac1_16523199 (\Smarty\Template $_smarty_tpl) { function content_6989f705231fa9_63622618 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial';
?><!DOCTYPE html> ?><!DOCTYPE html>
<html lang="fr"> <html lang="fr">

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-09 13:25:02 /* Smarty version 5.7.0, created on 2026-02-09 14:54:18
from 'file:views/_partial/preview.tpl' */ from 'file:views/_partial/preview.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_6989e02ebdb495_34139226', 'unifunc' => 'content_6989f51a5fd501_76959549',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array ( array (
), ),
))) { ))) {
function content_6989e02ebdb495_34139226 (\Smarty\Template $_smarty_tpl) { function content_6989f51a5fd501_76959549 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial';
?> ?>

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-09 13:25:02 /* Smarty version 5.7.0, created on 2026-02-09 14:54:18
from 'file:views/home.tpl' */ from 'file:views/home.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_6989e02e94a704_31389377', 'unifunc' => 'content_6989f51a3af749_66573336',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -21,20 +21,20 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:views/_partial/preview.tpl' => 1, 'file:views/_partial/preview.tpl' => 1,
), ),
))) { ))) {
function content_6989e02e94a704_31389377 (\Smarty\Template $_smarty_tpl) { function content_6989f51a3af749_66573336 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true); $_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?> ?>
<?php <?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_6558155986989e02e945ff4_36336799', "content"); $_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_17367792036989f51a3abb88_04857391', "content");
?> ?>
<?php $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); <?php $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
} }
/* {block "content"} */ /* {block "content"} */
class Block_6558155986989e02e945ff4_36336799 extends \Smarty\Runtime\Block class Block_17367792036989f51a3abb88_04857391 extends \Smarty\Runtime\Block
{ {
public function callBlock(\Smarty\Template $_smarty_tpl) { public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';

View file

@ -1,11 +1,11 @@
<?php <?php
/* Smarty version 5.7.0, created on 2026-02-09 13:24:46 /* Smarty version 5.7.0, created on 2026-02-09 14:54:09
from 'file:views/search.tpl' */ from 'file:views/search.tpl' */
/* @var \Smarty\Template $_smarty_tpl */ /* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0', 'version' => '5.7.0',
'unifunc' => 'content_6989e01e399336_22269044', 'unifunc' => 'content_6989f51198b742_67072597',
'has_nocache_code' => false, 'has_nocache_code' => false,
'file_dependency' => 'file_dependency' =>
array ( array (
@ -21,18 +21,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:views/_partial/preview.tpl' => 1, 'file:views/_partial/preview.tpl' => 1,
), ),
))) { ))) {
function content_6989e01e399336_22269044 (\Smarty\Template $_smarty_tpl) { function content_6989f51198b742_67072597 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true); $_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?> ?>
<?php <?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_17525989336989e01e3837e7_64042990', "content"); $_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_2211957246989f511978f29_13934431', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
} }
/* {block "content"} */ /* {block "content"} */
class Block_17525989336989e01e3837e7_64042990 extends \Smarty\Runtime\Block class Block_2211957246989f511978f29_13934431 extends \Smarty\Runtime\Block
{ {
public function callBlock(\Smarty\Template $_smarty_tpl) { public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';

View file

@ -0,0 +1,218 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-09 14:49:06
from 'file:views/inscription.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6989f3e29dbce4_20550543',
'has_nocache_code' => false,
'file_dependency' =>
array (
'ee86afd5d4dff200944f3436866afa34a71b920e' =>
array (
0 => 'views/inscription.tpl',
1 => 1770634036,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6989f3e29dbce4_20550543 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?>
<?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_18645663486989f3e29da446_83083224', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_18645663486989f3e29da446_83083224 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
?>
<!-- Page : Inscription -->
<main class="container py-5">
<!-- Centrage horizontal du formulaire -->
<div class="row justify-content-center">
<div class="col-12 col-md-10 col-lg-6">
<!-- Carte contenant le formulaire d'inscription -->
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
<!-- Titre principal de la page -->
<h1 class="h3 fw-bold mb-1">Inscription</h1>
<!-- Texte descriptif -->
<p class="text-secondary mb-4">
Créez votre compte utilisateur.
</p>
<!-- Formulaire d'inscription -->
<!-- Les données seront traitées côté serveur en PHP via la méthode POST -->
<form method="POST">
<div class="row g-3">
<!-- Champ : prénom de l'utilisateur -->
<div class="col-md-6">
<label class="form-label" for="user_firstname">
Prénom *
</label>
<input
class="form-control"
type="text"
id="user_firstname"
name="user_firstname"
required >
</div>
<!-- Champ : nom de l'utilisateur -->
<div class="col-md-6">
<label class="form-label" for="user_name">
Nom *
</label>
<input
class="form-control"
type="text"
id="user_name"
name="user_name"
required
>
</div>
<!-- Champ : pseudo -->
<div class="col-12">
<label class="form-label" for="user_pseudo">
Pseudo *
</label>
<div class="input-group">
<span class="input-group-text">@</span>
<input
class="form-control"
type="text"
id="user_pseudo"
name="user_pseudo"
required
>
</div>
</div>
<!-- Champ : adresse e-mail -->
<div class="col-12">
<label class="form-label" for="user_mail">
Adresse e-mail *
</label>
<input
class="form-control"
type="email"
id="user_mail"
name="user_mail"
required
>
</div>
<!-- Champ : mot de passe -->
<div class="col-12">
<label class="form-label" for="user_password">
Mot de passe *
</label>
<input
class="form-control"
type="password"
id="user_password"
name="user_password"
required
>
</div>
<!-- Champ optionnel : numéro de téléphone -->
<div class="col-12">
<label class="form-label" for="user_phone">
Téléphone
</label>
<input
class="form-control"
type="text"
id="user_phone"
name="user_phone"
>
</div>
<!-- Champ optionnel : profession de l'utilisateur -->
<div class="col-12">
<label class="form-label" for="user_work">
Profession
</label>
<input
class="form-control"
type="text"
id="user_work"
name="user_work"
>
</div>
<!-- Champ optionnel : localisation de l'utilisateur -->
<div class="col-12">
<label class="form-label" for="user_location">
Localisation
</label>
<input
class="form-control"
type="text"
id="user_location"
name="user_location"
>
</div>
<!-- Champ optionnel : phrase d'accroche -->
<div class="col-12">
<label class="form-label" for="user_description">
Phrase d'accroche
</label>
<textarea
class="form-control"
id="user_description"
name="user_description"
rows="3"
></textarea>
</div>
<!-- Bouton de soumission du formulaire -->
<div class="col-12 d-grid mt-2">
<button type="submit" class="btn btn-primary btn-lg rounded-3">
Créer mon compte
</button>
</div>
<!-- Lien vers la page de connexion -->
<div class="col-12 text-center">
<small class="text-secondary">
Déjà un compte ?
<a href="index.php?ctrl=user&action=login">Se connecter</a>
</small>
</div>
</form>
</div>
</div>
</div>
</div>
</main>
<?php
}
}
/* {/block "content"} */
}

View file

@ -86,20 +86,29 @@
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3"> <div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<div class="container-fluid pt-2"> <div class="container-fluid pt-2">
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-2">
<img src="./assests/img/Logo-Wordmark.svg" alt="" width="100"> <img src="./assests/img/Logo-Wordmark.svg" alt="" width="100">
</div> </div>
<form method="POST">
<div class="col-4"> <div class="col-4">
<select class="form-select" aria-label="Default select example"> <select class="form-select" aria-label="Default select example" name="user_id">
<option value="0">Choisir un utilisateur</option>
{foreach from=$arrUserToDisplay item=user}
<option value="{$user->getId()}">{$user->getName()} {$user->getFirstname()}</option>
{/foreach}
</select>
<select class="form-select" aria-label="Default select example" name="new_status">
<option value="0" selected>Modifier le statut de l'Utilisateur...</option> <option value="0" selected>Modifier le statut de l'Utilisateur...</option>
{foreach from=$arrStatusToDisplay item=arrDetStatus} {foreach from=$arrAuthorisationToDisplay item=arrDetAuthorisation}
<option value="{$arrDetStatus->getId()}">{$arrDetStatus->getStatusName()}</option> <option value="{$arrDetAuthorisation->getId()}">{$arrDetAuthorisation->getName()}</option>
{/foreach} {/foreach}
</select> </select>
</div> </div>
<div class="col-4"> <div class="col-2">
<button class="btn bg-danger text-light rounded-circle">X</button> <button type="submit" name="action" value="update_status" class="btn bg-success text-light"> Valider</button>
<button type="submit" name="action" value="delete_user" class="btn bg-danger text-light">Supprimer l'utilisateur</button>
</div> </div>
</form>
</div> </div>
</div> </div>
</div> </div>
@ -123,12 +132,11 @@
</div> </div>
<br> <br>
<br> <br>
<br>
<div class="row"> <div class="row">
<!-- creation cat--> <!-- creation cat-->
<div class="col-6"> <div class="col-6">
<form method="POST"> <form method="POST">
<label>Créer une nouvelle catégorie</label> <p>Créer une nouvelle catégorie</p>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="text" class="form-control" id="floatingInput" name="new_category"> <input type="text" class="form-control" id="floatingInput" name="new_category">
<label for="floatingInput">Créer une nouvelle catégorie</label> <label for="floatingInput">Créer une nouvelle catégorie</label>