Merge pull request #16 from Yasder5/laura

Ajout de la page user fonctionnelle (ctrl, model associé etc) update …
This commit is contained in:
Yass 2026-02-11 16:29:37 +01:00 committed by GitHub
commit 7fbf005fdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 471 additions and 364 deletions

View file

@ -181,7 +181,7 @@
$objProject->hydrate($arrProject);
$this->_arrData["objProject"] = $objProject;
$this->_display("projet_display");
$this->_display("project_display");
} else {
header("Location: index.php?ctrl=project&action=home");
exit;

View file

@ -3,6 +3,8 @@
require("models/user_model.php");
require("entities/user_entity.php");
require("mother_controller.php");
require("./models/project_model.php");
require("./entities/project_entity.php");
class UserCtrl extends MotherCtrl {
@ -147,4 +149,43 @@ class UserCtrl extends MotherCtrl {
// Affichage de la vue inscription
$this->_display("inscription");
}
/**
* le controlleur affichage de la page user
*/
public function user(){
$intId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if ($intId <= 0) {
header("Location: index.php");
exit;
}
//affichage info utilisateur
$objUserModel = new UserModel;
$arrUserData = $objUserModel->findUserById($intId);
if ($arrUserData === false) {
header("Location: index.php");
exit;
}
$objUser = new User;
$objUser->hydrate($arrUserData);
//affichage projet de l'utilisateur
$objProjectModel = new ProjectModel;
$arrProjects = $objProjectModel->findAll(0,'',$intId);
$arrProjectToDisplay = array();
foreach($arrProjects as $projectData) {
$objProject = new Project();
$objProject->hydrate($projectData);
$arrProjectToDisplay[] = $objProject;
}
$this->_arrData['user'] = $objUser;
$this->_arrData['arrProjectToDisplay'] = $arrProjectToDisplay;
$this->_display("user");
}
}

View file

@ -104,9 +104,9 @@
/**
* Fonction de recherche d'un seul projet
* @param int $intId
* @return
* @return array
*/
public function findOne(int $intId) {
public function findOne(int $intId) :array{
$strRq = "SELECT project.*,
CONCAT(users.user_firstname, ' ', users.user_name) AS 'project_creatorname',
users.user_image,
@ -150,4 +150,26 @@
return $this->_db->query($strRq);
}
/**
* Fonction de mise à jour d'un projet en BDD
* @param object $objProject L'objet utilisateur
* @return bool Est-ce que la requête s'est bien passée
*/
public function updateProject(object $objProject):bool{
$strRq = "UPDATE project
SET project_title = :title, project_description = :description, project_content = :content
WHERE project_id = :id";
$rqPrep = $this->_db->prepare($strRq);
$rqPrep->bindValue(":title", $objProject->getTitle(), PDO::PARAM_STR);
$rqPrep->bindValue(":description", $objProject->getDescription(), PDO::PARAM_STR);
$rqPrep->bindValue(":content", $objProject->getContent(), PDO::PARAM_STR);
// Executer la requête
return $rqPrep->execute();
}
}

View file

@ -117,4 +117,20 @@
$rqPrep->bindValue(":id", $intId, PDO::PARAM_INT);
return $rqPrep->execute();
}
/**
* Récupère les informations d'un utilisateur par son ID
* @param int $intId L'identifiant de l'utilisateur
* @return array Tableau associatif (ou false si pas trouvé)
*/
public function findUserById(int $intId): array|bool {
$strRq = "SELECT * FROM users WHERE user_id = :id";
$prep = $this->_db->prepare($strRq);
$prep->bindValue(':id', $intId, PDO::PARAM_INT);
$prep->execute();
return $prep->fetch();
}
}

View file

@ -0,0 +1,99 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-10 13:47:21
from 'file:views/user.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_698b36e931d9d8_07796633',
'has_nocache_code' => false,
'file_dependency' =>
array (
'32d027bc6f198a0e3016434b0dddc13d6ee22b4c' =>
array (
0 => 'views/user.tpl',
1 => 1770729421,
2 => 'file',
),
),
'includes' =>
array (
'file:views/_partial/preview.tpl' => 1,
),
))) {
function content_698b36e931d9d8_07796633 (\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_2035018945698b36e930efe0_69529586', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_2035018945698b36e930efe0_69529586 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
?>
<section class="user-profile mb-5">
<div class="row">
<div class="col-md-4 text-center">
<img src="" alt="Avatar de <?php echo $_smarty_tpl->getValue('user')->getPseudo();?>
" class="img-fluid rounded-circle mb-3" style="max-width: 200px">
</div>
<div class="col-md-8">
<h1><?php echo $_smarty_tpl->getValue('user')->getPseudo();?>
</h1>
<p class="text-muted"><?php echo $_smarty_tpl->getValue('user')->getMail();?>
</p>
<?php if ($_smarty_tpl->getValue('user')->getWork()) {?>
<p><?php echo $_smarty_tpl->getValue('user')->getWork();?>
</p>
<?php }?>
<?php if ($_smarty_tpl->getValue('user')->getLocation()) {?>
<p><?php echo $_smarty_tpl->getValue('user')->getLocation();?>
</p>
<?php }?>
<p class="mt-3"><?php echo $_smarty_tpl->getValue('user')->getDescription();?>
</p>
</div>
</div>
</section>
<section>
<h2 class="mb-4 border-bottom pb-2">Les projets de <?php echo $_smarty_tpl->getValue('user')->getPseudo();?>
</h2>
<div class="row">
<?php if ($_smarty_tpl->getSmarty()->getModifierCallback('count')($_smarty_tpl->getValue('arrProjectToDisplay')) > 0) {?>
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrProjectToDisplay'), 'objProject');
$foreach0DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('objProject')->value) {
$foreach0DoElse = false;
?>
<div class="col-md-4 mb-4">
<?php $_smarty_tpl->renderSubTemplate("file:views/_partial/preview.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
?>
</div>
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
<?php } else { ?>
<p class="alert alert-info">Cet utilisateur n'a pas encore publié de projets.</p>
<?php }?>
</div>
</section>
<?php
}
}
/* {/block "content"} */
}

View file

@ -1,11 +1,11 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-10 08:17:39
/* Smarty version 5.7.0, created on 2026-02-10 12:38:57
from 'file:views/project.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_698ae9a3ee5104_18468093',
'unifunc' => 'content_698b26e1f18ff9_58457550',
'has_nocache_code' => false,
'file_dependency' =>
array (
@ -21,18 +21,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:../app/views/partials/preview.tpl' => 1,
),
))) {
function content_698ae9a3ee5104_18468093 (\Smarty\Template $_smarty_tpl) {
function content_698b26e1f18ff9_58457550 (\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_2126029828698ae9a3edc808_29541958', "content");
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1455455414698b26e1f12061_00705481', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_2126029828698ae9a3edc808_29541958 extends \Smarty\Runtime\Block
class Block_1455455414698b26e1f12061_00705481 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';

View file

@ -1,11 +1,11 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-10 08:32:47
/* Smarty version 5.7.0, created on 2026-02-10 13:47:21
from 'file:views/layout.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_698aed2fd402f7_78850375',
'unifunc' => 'content_698b36e945e8a9_68963664',
'has_nocache_code' => false,
'file_dependency' =>
array (
@ -22,21 +22,21 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:views/_partial/footer.tpl' => 1,
),
))) {
function content_698aed2fd402f7_78850375 (\Smarty\Template $_smarty_tpl) {
function content_698b36e945e8a9_68963664 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
$_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);
?>
<?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_691069574698aed2fd3d8f8_28027733', "content");
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1250254212698b36e945d469_86185066', "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);
}
/* {block "content"} */
class Block_691069574698aed2fd3d8f8_28027733 extends \Smarty\Runtime\Block
class Block_1250254212698b36e945d469_86185066 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';

View file

@ -1,18 +1,18 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-10 08:32:47
/* Smarty version 5.7.0, created on 2026-02-10 12:54:17
from 'file:views/admin.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_698aed2fac7079_66630300',
'unifunc' => 'content_698b2a791a5267_98917235',
'has_nocache_code' => false,
'file_dependency' =>
array (
'ac77f39f91cdf26a0eb3f0963ead4008a7bda8fb' =>
array (
0 => 'views/admin.tpl',
1 => 1770712365,
1 => 1770728055,
2 => 'file',
),
),
@ -20,213 +20,138 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array (
),
))) {
function content_698aed2fac7079_66630300 (\Smarty\Template $_smarty_tpl) {
function content_698b2a791a5267_98917235 (\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_701047722698aed2faa98f9_91663021', "content");
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_510378351698b2a7919aa53_66812766', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_701047722698aed2faa98f9_91663021 extends \Smarty\Runtime\Block
class Block_510378351698b2a7919aa53_66812766 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
?>
<section class="sb-nav-fixed">
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark">
<a class="navbar-brand ps-3" href="index.php?ctrl=project&action=home"><img src="assests/img/Logo-Wordmark.svg" alt="Logo du site" width="150px"></a>
<button class="btn btn-link btn-sm order-1 order-lg-0 me-4 me-lg-0" id="sidebarToggle" href="#!"><i class="fas fa-bars"></i></button>
<form class="d-none d-md-inline-block form-inline ms-auto me-0 me-md-3 my-2 my-md-0">
<div class="input-group">
<input class="form-control" type="text" placeholder="Recherche par pseudo..." aria-label="Recherche pseudo" aria-describedby="btnNavbarSearch" />
<button class="btn btn-primary" id="btnNavbarSearch" type="button"><i class="fas fa-search"></i></button>
</div>
</form>
<!-- Navbar - User-->
<ul class="navbar-nav ms-auto ms-md-0 me-3 me-lg-4">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdown" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"><i class="fas fa-user fa-fw"></i></a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="/option.php">Paramètre</a></li>
<li><hr class="dropdown-divider" /></li>
<li><a class="dropdown-item" href="/deconnexion.php">Déconnexion</a></li>
</ul>
</li>
</ul>
</nav>
<!-- SideNav Infos -->
<div id="layoutSidenav">
<div id="layoutSidenav_nav">
<nav class="sb-sidenav accordion sb-sidenav-dark" id="sidenavAccordion">
<div class="sb-sidenav-menu">
<div class="nav">
<div class="sb-sidenav-menu-heading"></div>
<a class="nav-link" href="index.html">
<div class="sb-nav-link-icon"><i class="fas fa-tachometer-alt"></i></div>
Rafraichir la page
</a>
<div class="sb-sidenav-menu-heading"></div>
<div class="collapse" id="collapseLayouts" aria-labelledby="headingOne" data-bs-parent="#sidenavAccordion">
</div>
<form action="post">
<div class="container-fluid ps-2">
<div class="row">
<div class="col-6">
<label for="checkbox1">Par date</label>
</div>
<div class="col-6 text-center">
<input type="checkbox" name="search_date" id="">
</div>
<div class="col-6">
<label for="checkbox2">Par date de creation de compte</label>
</div>
<div class="col-6 text-center">
<input type="checkbox" name="search_creationdate" id="">
</div>
<div class="col-6">
<label for="checkbox3">Recherche par date</label>
</div>
<div class="col-6 text-center">
<input type="checkbox" name="search_date" id="">
</div>
<div class="col-12 text-center">
<button type="submit" class="btn mt-3 bg-primary text-light">Recherche</button>
</div>
</div>
</div>
</form>
<section>
<div id="layoutSidenav_content">
<div class="container-fluid px-4">
<h1 class="mt-4">Dashboard</h1>
<div class="container-fluid px-4">
<!-- USER MODIF -->
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<div class="container-fluid pt-2">
<h2>Gestion de l'utilsateur</h2>
<p>Changer le statut ou supprimer un utilisateur</p>
<div class="row">
<div class="col-2">
<img src="./assests/img/Logo-Wordmark.svg" alt="" width="100">
</div>
</div>
<div class="sb-sidenav-footer">
<div class="small">Connecté avec le compte : <?php echo $_SESSION['user']['user_name'];?>
<?php echo $_SESSION['user']['user_firstname'];?>
</div>
</div>
</nav>
</div>
<div id="layoutSidenav_content">
<main>
<div class="container-fluid px-4">
<h1 class="mt-4">Dashboard</h1>
<div class="container-fluid px-4">
<!-- USER MODIF -->
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<div class="container-fluid pt-2">
<h2>Gestion de l'utilsateur</h2>
<p>Changer le statut ou supprimer un utilisateur</p>
<div class="row">
<div class="col-2">
<img src="./assests/img/Logo-Wordmark.svg" alt="" width="100">
</div>
<form method="POST">
<div class="col-6">
<select class="form-select" aria-label="Default select example" name="user_id">
<option value="0">Choisir un utilisateur</option>
<?php
<form method="POST">
<div class="col-6">
<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('user')->value) {
$foreach0DoElse = false;
?>
<option value="<?php echo $_smarty_tpl->getValue('user')->getId();?>
<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>
<select class="form-select" aria-label="Default select example" name="new_status">
<option value="0" selected>Modifier le statut de l'Utilisateur...</option>
<?php
</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();?>
<option value="<?php echo $_smarty_tpl->getValue('arrDetAuthorisation')->getId();?>
"><?php echo $_smarty_tpl->getValue('arrDetAuthorisation')->getName();?>
</option>
<?php
<?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>
</select>
</div>
</div>
<!-- catégorie modif -->
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<div class="container-fluid pt-2">
<h2>Gestion des catégories</h2>
<div class="row">
<div class="col-6">
<form method="post">
<p>Modifier une catégorie existante</p>
<select class="form-select" aria-label="Default select example" name="id_to_edit">
<option value="0">Choix de la catégorie</option>
<?php
<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>
<!-- catégorie modif -->
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<div class="container-fluid pt-2">
<h2>Gestion des catégories</h2>
<div class="row">
<div class="col-6">
<form method="post">
<p>Modifier une catégorie existante</p>
<select class="form-select" aria-label="Default select example" name="id_to_edit">
<option value="0">Choix de la catégorie</option>
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrCategoryToDisplay'), 'category');
$foreach2DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('category')->value) {
$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();?>
</option>
<?php
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</select>
<br>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="floatingInput" name="new_name">
<label for="floatingInput">Nouveau nom de la catégorie</label>
</div>
<button type="submit" class="btn bg-success text-light rounded-circle"> </button>
</form>
<div>
</div>
</select>
<br>
<br>
<div class="row">
<!-- creation cat-->
<div class="col-6">
<form method="POST">
<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">Nom de la nouvelle catégorie</label>
</div>
<div class="col-2">
<button type="submit" class="btn bg-success text-light rounded-circle"> </button>
</div>
</form>
</div>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="floatingInput" name="new_name">
<label for="floatingInput">Nouveau nom de la catégorie</label>
</div>
</div>
</form>
<button type="submit" class="btn bg-success text-light rounded-circle"> </button>
</form>
<div>
</div>
<br>
<br>
<div class="row">
<!-- creation cat-->
<div class="col-6">
<form method="POST">
<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">Nom de la nouvelle catégorie</label>
</div>
<div class="col-2">
<button type="submit" class="btn bg-success text-light rounded-circle"> </button>
</div>
</form>
</div>
</div>
</div>
</main>
</form>
</div>
</section>
</div>
</div>
<div class="small">Connecté avec le compte : <?php echo $_SESSION['user']['user_name'];?>
<?php echo $_SESSION['user']['user_firstname'];?>
</section>
<?php
}

View file

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

View file

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

View file

@ -1,18 +1,18 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-10 08:16:45
/* Smarty version 5.7.0, created on 2026-02-10 13:47:21
from 'file:views/_partial/preview.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_698ae96d52fa95_22666517',
'unifunc' => 'content_698b36e9636399_70389179',
'has_nocache_code' => false,
'file_dependency' =>
array (
'b70ee0d22061ca6100f647634a5658ae38c7b520' =>
array (
0 => 'views/_partial/preview.tpl',
1 => 1770634036,
1 => 1770730137,
2 => 'file',
),
),
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array (
),
))) {
function content_698ae96d52fa95_22666517 (\Smarty\Template $_smarty_tpl) {
function content_698b36e9636399_70389179 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial';
?>
@ -38,32 +38,57 @@ $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial';
<div class="d-flex align-items-start gap-3">
<img src=".<?php echo $_smarty_tpl->getValue('objProject')->getUser_image();?>
<img src=".<?php echo $_smarty_tpl->getValue('objProject')->getUser_image();?>
"
class="rounded-circle flex-shrink-0 mt-2 ml-5"
style="width: 48px; height: 48px; object-fit: cover;"
alt="Photo de profil">
class="rounded-circle flex-shrink-0 mt-2 ml-5"
style="width: 48px; height: 48px; object-fit: cover;"
alt="Photo de profil">
<div class="flex-grow-1 card-body p-3">
<h3 class="h6 mb-1"><?php echo $_smarty_tpl->getValue('objProject')->getTitle();?>
<div class="flex-grow-1 card-body p-3">
<h3 class="h6 mb-1"><?php echo $_smarty_tpl->getValue('objProject')->getTitle();?>
</h3>
<small class="text-body-secondary d-block mb-1">
<time><?php echo $_smarty_tpl->getValue('objProject')->getCreation_date();?>
<small class="text-body-secondary d-block mb-1">
<time><?php echo $_smarty_tpl->getValue('objProject')->getCreation_date();?>
</time>
<?php echo $_smarty_tpl->getValue('objProject')->getCreatorname();?>
</small>
<a href="index.php?ctrl=project&action=display&id=<?php echo $_smarty_tpl->getValue('objProject')->getId();?>
<a href="index.php?ctrl=user&action=user&id=<?php echo $_smarty_tpl->getValue('objProject')->getUser();?>
"
class="stretched-link small">
Lire la suite
</a>
</div>
class="text-decoration-none"
style="position: relative; z-index: 2;">
<?php echo $_smarty_tpl->getValue('objProject')->getCreatorname();?>
</div>
</a>
</small>
<a href="index.php?ctrl=project&action=display&id=<?php echo $_smarty_tpl->getValue('objProject')->getId();?>
"
class="stretched-link small">
Lire la suite
</a>
<?php if ($_SESSION['user']['user_id'] == $_smarty_tpl->getValue('objProject')->getUser()) {?>
<a href="index.php?ctrl=project&action=display&id=<?php echo $_smarty_tpl->getValue('objProject')->getId();?>
"
class="stretched-link small">
Editer
</a>
<?php }?>
</div>
</div>
</div>
<?php if ((true && (true && null !== ($_SESSION['user'] ?? null))) && $_SESSION['user']['user_status'] == 2 && $_smarty_tpl->getValue('objProject')->getStatus() == "en_attente") {?>
<div class="border rounded text-center">
<a class="btn btn-sm m-1 btn-success" href="?ctrl=project&action=accept&id=<?php echo $_smarty_tpl->getValue('objProject')->getId();?>
" name="toPublished">Accepter</a>
<a class="btn btn-sm m-1 btn-warning" href="?ctrl=project&action=refuse&id=<?php echo $_smarty_tpl->getValue('objProject')->getId();?>
" name="toRefused">Refuser</a>
<a class="btn btn-sm m-1 btn-danger" href="?ctrl=project&action=delete&id=<?php echo $_smarty_tpl->getValue('objProject')->getId();?>
" name="toDelete">Supprimer</a>
</div>
<?php } elseif ($_smarty_tpl->getValue('projectStatus') == "refusé") {?>
<p class="text-danger fw-bold">Portfolio refusé</p>
<?php }?>
</article><?php }
}

View file

@ -1,11 +1,11 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-10 07:13:04
/* Smarty version 5.7.0, created on 2026-02-10 13:29:06
from 'file:views/search.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_698ada80e47fc8_23614044',
'unifunc' => 'content_698b32a2af19c0_80830560',
'has_nocache_code' => false,
'file_dependency' =>
array (
@ -21,18 +21,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:views/_partial/preview.tpl' => 1,
),
))) {
function content_698ada80e47fc8_23614044 (\Smarty\Template $_smarty_tpl) {
function content_698b32a2af19c0_80830560 (\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_1614324265698ada80a61e02_00521357', "content");
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1683455369698b32a2adef91_98812453', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_1614324265698ada80a61e02_00521357 extends \Smarty\Runtime\Block
class Block_1683455369698b32a2adef91_98812453 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';

View file

@ -26,13 +26,24 @@
<small class="text-body-secondary d-block mb-1">
<time>{$objProject->getCreation_date()}</time>
{$objProject->getCreatorname()}
<a href="index.php?ctrl=user&action=user&id={$objProject->getUser()}"
class="text-decoration-none"
style="position: relative; z-index: 2;">
{$objProject->getCreatorname()}
</a>
</small>
<a href="index.php?ctrl=project&action=display&id={$objProject->getId()}"
class="stretched-link small">
Lire la suite →
class="stretched-link small">
Lire la suite →
</a>
{if $smarty.session.user.user_id == $objProject->getUser()}
<a href="index.php?ctrl=project&action=display&id={$objProject->getId()}"
class="stretched-link small">
Editer
</a>
{/if}
</div>
</div>

View file

@ -2,164 +2,89 @@
{block name="content"}
<section class="sb-nav-fixed">
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark">
<a class="navbar-brand ps-3" href="index.php?ctrl=project&action=home"><img src="assests/img/Logo-Wordmark.svg" alt="Logo du site" width="150px"></a>
<button class="btn btn-link btn-sm order-1 order-lg-0 me-4 me-lg-0" id="sidebarToggle" href="#!"><i class="fas fa-bars"></i></button>
<form class="d-none d-md-inline-block form-inline ms-auto me-0 me-md-3 my-2 my-md-0">
<div class="input-group">
<input class="form-control" type="text" placeholder="Recherche par pseudo..." aria-label="Recherche pseudo" aria-describedby="btnNavbarSearch" />
<button class="btn btn-primary" id="btnNavbarSearch" type="button"><i class="fas fa-search"></i></button>
<section>
<div id="layoutSidenav_content">
<div class="container-fluid px-4">
<h1 class="mt-4">Dashboard</h1>
<div class="container-fluid px-4">
<!-- USER MODIF -->
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<div class="container-fluid pt-2">
<h2>Gestion de l'utilsateur</h2>
<p>Changer le statut ou supprimer un utilisateur</p>
<div class="row">
<div class="col-2">
<img src="./assests/img/Logo-Wordmark.svg" alt="" width="100">
</div>
<form method="POST">
<div class="col-6">
<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>
{foreach from=$arrAuthorisationToDisplay item=arrDetAuthorisation}
<option value="{$arrDetAuthorisation->getId()}">{$arrDetAuthorisation->getName()}</option>
{/foreach}
</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>
</form>
<!-- Navbar - User-->
<ul class="navbar-nav ms-auto ms-md-0 me-3 me-lg-4">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdown" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"><i class="fas fa-user fa-fw"></i></a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="/option.php">Paramètre</a></li>
<li><hr class="dropdown-divider" /></li>
<li><a class="dropdown-item" href="/deconnexion.php">Déconnexion</a></li>
</ul>
</li>
</ul>
</nav>
<!-- SideNav Infos -->
<div id="layoutSidenav">
<div id="layoutSidenav_nav">
<nav class="sb-sidenav accordion sb-sidenav-dark" id="sidenavAccordion">
<div class="sb-sidenav-menu">
<div class="nav">
<div class="sb-sidenav-menu-heading"></div>
<a class="nav-link" href="index.html">
<div class="sb-nav-link-icon"><i class="fas fa-tachometer-alt"></i></div>
Rafraichir la page
</a>
<div class="sb-sidenav-menu-heading"></div>
<div class="collapse" id="collapseLayouts" aria-labelledby="headingOne" data-bs-parent="#sidenavAccordion">
</div>
<form action="post">
<div class="container-fluid ps-2">
<div class="row">
<div class="col-6">
<label for="checkbox1">Par date</label>
</div>
<div class="col-6 text-center">
<input type="checkbox" name="search_date" id="">
</div>
<div class="col-6">
<label for="checkbox2">Par date de creation de compte</label>
</div>
<div class="col-6 text-center">
<input type="checkbox" name="search_creationdate" id="">
</div>
<div class="col-6">
<label for="checkbox3">Recherche par date</label>
</div>
<div class="col-6 text-center">
<input type="checkbox" name="search_date" id="">
</div>
<div class="col-12 text-center">
<button type="submit" class="btn mt-3 bg-primary text-light">Recherche</button>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="sb-sidenav-footer">
<div class="small">Connecté avec le compte : {$smarty.session.user.user_name} {$smarty.session.user.user_firstname}</div>
</div>
</nav>
</div>
<div id="layoutSidenav_content">
<main>
<div class="container-fluid px-4">
<h1 class="mt-4">Dashboard</h1>
<div class="container-fluid px-4">
<!-- USER MODIF -->
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<div class="container-fluid pt-2">
<h2>Gestion de l'utilsateur</h2>
<p>Changer le statut ou supprimer un utilisateur</p>
<div class="row">
<!-- catégorie modif -->
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<div class="container-fluid pt-2">
<h2>Gestion des catégories</h2>
<div class="row">
<div class="col-6">
<form method="post">
<p>Modifier une catégorie existante</p>
<select class="form-select" aria-label="Default select example" name="id_to_edit">
<option value="0">Choix de la catégorie</option>
{foreach from=$arrCategoryToDisplay item=category}
<option value="{$category->getId()}">{$category->getName()}</option>
{/foreach}
</select>
<br>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="floatingInput" name="new_name">
<label for="floatingInput">Nouveau nom de la catégorie</label>
</div>
<button type="submit" class="btn bg-success text-light rounded-circle"> ✓</button>
</form>
<div>
</div>
<br>
<br>
<div class="row">
<!-- creation cat-->
<div class="col-6">
<form method="POST">
<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">Nom de la nouvelle catégorie</label>
</div>
<div class="col-2">
<img src="./assests/img/Logo-Wordmark.svg" alt="" width="100">
<button type="submit" class="btn bg-success text-light rounded-circle"> ✓</button>
</div>
<form method="POST">
<div class="col-6">
<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>
{foreach from=$arrAuthorisationToDisplay item=arrDetAuthorisation}
<option value="{$arrDetAuthorisation->getId()}">{$arrDetAuthorisation->getName()}</option>
{/foreach}
</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>
</form>
</div>
</div>
<!-- catégorie modif -->
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<div class="container-fluid pt-2">
<h2>Gestion des catégories</h2>
<div class="row">
<div class="col-6">
<form method="post">
<p>Modifier une catégorie existante</p>
<select class="form-select" aria-label="Default select example" name="id_to_edit">
<option value="0">Choix de la catégorie</option>
{foreach from=$arrCategoryToDisplay item=category}
<option value="{$category->getId()}">{$category->getName()}</option>
{/foreach}
</select>
<br>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="floatingInput" name="new_name">
<label for="floatingInput">Nouveau nom de la catégorie</label>
</div>
<button type="submit" class="btn bg-success text-light rounded-circle"> ✓</button>
</form>
<div>
</div>
<br>
<br>
<div class="row">
<!-- creation cat-->
<div class="col-6">
<form method="POST">
<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">Nom de la nouvelle catégorie</label>
</div>
<div class="col-2">
<button type="submit" class="btn bg-success text-light rounded-circle"> ✓</button>
</div>
</form>
</div>
</div>
</div>
</form>
</div>
</div>
</main>
</form>
</div>
</section>
</div>
</div>
<div class="small">Connecté avec le compte : {$smarty.session.user.user_name} {$smarty.session.user.user_firstname}
</section>
{/block}

View file

@ -58,11 +58,11 @@
<!-- Sidebar : informations du créateur -->
<div class="col-lg-4">
<div class="card text-center shadow-sm p-4">
<img src=".{$objProject->getUser_image()}"
class="rounded-circle mb-3 mx-auto"
style="width:100px;height:100px;object-fit:cover;">
<a href="index.php?ctrl=user&action=user&id={$objProject->getUser()}" class="text-decoration-none text-dark">
<img src=".{$objProject->getUser_image()}"
class="rounded-circle mb-3 mx-auto"
style="width:100px;height:100px;object-fit:cover;">
</a>
<h5>{$objProject->getCreatorName()}</h5>
<p class="text-muted small">

43
views/user.tpl Normal file
View file

@ -0,0 +1,43 @@
{extends file="views/layout.tpl"}
{block name="content"}
<section class="user-profile mb-5">
<div class="row">
<div class="col-md-4 text-center">
<img src="" alt="Avatar de {$user->getPseudo()}" class="img-fluid rounded-circle mb-3" style="max-width: 200px">
</div>
<div class="col-md-8">
<h1>{$user->getPseudo()}</h1>
<p class="text-muted">{$user->getMail()}</p>
{if $user->getWork()}
<p>{$user->getWork()}</p>
{/if}
{if $user->getLocation()}
<p>{$user->getLocation()}</p>
{/if}
<p class="mt-3">{$user->getDescription()}</p>
</div>
</div>
</section>
<section>
<h2 class="mb-4 border-bottom pb-2">Les projets de {$user->getPseudo()}</h2>
<div class="row">
{if count($arrProjectToDisplay) > 0}
{foreach $arrProjectToDisplay as $objProject}
<div class="col-md-4 mb-4">
{include file="views/_partial/preview.tpl"}
</div>
{/foreach}
{else}
<p class="alert alert-info">Cet utilisateur n'a pas encore publié de projets.</p>
{/if}
</div>
</section>
{/block}