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

@ -1,18 +1,18 @@
<?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' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6989e088f38338_64666135',
'unifunc' => 'content_6989f704df71e4_04792390',
'has_nocache_code' => false,
'file_dependency' =>
array (
'ac77f39f91cdf26a0eb3f0963ead4008a7bda8fb' =>
array (
0 => 'views/admin.tpl',
1 => 1770643565,
1 => 1770649348,
2 => 'file',
),
),
@ -20,18 +20,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, 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_tpl->getInheritance()->init($_smarty_tpl, true);
?>
<?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);
}
/* {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) {
$_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="container-fluid pt-2">
<div class="row">
<div class="col-4">
<div class="col-2">
<img src="./assests/img/Logo-Wordmark.svg" alt="" width="100">
</div>
<div class="col-4">
<select class="form-select" aria-label="Default select example">
<option value="0" selected>Modifier le statut de l'Utilisateur...</option>
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrStatusToDisplay'), 'arrDetStatus');
<form method="POST">
<div class="col-4">
<select class="form-select" aria-label="Default select example" name="user_id">
<option value="0">Choisir un utilisateur</option>
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrUserToDisplay'), 'user');
$foreach0DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('arrDetStatus')->value) {
foreach ($_from ?? [] as $_smarty_tpl->getVariable('user')->value) {
$foreach0DoElse = false;
?>
<option value="<?php echo $_smarty_tpl->getValue('arrDetStatus')->getId();?>
"><?php echo $_smarty_tpl->getValue('arrDetStatus')->getStatusName();?>
<option value="<?php echo $_smarty_tpl->getValue('user')->getId();?>
"><?php echo $_smarty_tpl->getValue('user')->getName();?>
<?php echo $_smarty_tpl->getValue('user')->getFirstname();?>
</option>
<?php
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</select>
</div>
<div class="col-4">
<button class="btn bg-danger text-light rounded-circle">X</button>
</div>
</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>
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</select>
</div>
<div class="col-2">
<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>
</form>
</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>
<?php
$_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) {
$foreach1DoElse = false;
$foreach2DoElse = false;
?>
<option value="<?php echo $_smarty_tpl->getValue('category')->getId();?>
"><?php echo $_smarty_tpl->getValue('category')->getName();?>
@ -179,12 +198,11 @@ $_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</div>
<br>
<br>
<br>
<div class="row">
<!-- creation cat-->
<div class="col-6">
<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">
<input type="text" class="form-control" id="floatingInput" name="new_category">
<label for="floatingInput">Créer une nouvelle catégorie</label>