récupération du back up

This commit is contained in:
laura.chevillet 2026-02-09 13:35:44 +01:00
parent 6ed4394dda
commit 2535d13d7c
10 changed files with 852 additions and 8 deletions

View file

@ -54,7 +54,6 @@
$arrCategoryToDisplay[] = $objCategory;
}
// Il faudra donner à maman et gérer l'affichage quand Smarty sera prêt
$this->_arrData['arrCategoryToDisplay'] = $arrCategoryToDisplay;
//$this->_arrData['intCategory'] = $objCategoryModel->;
$this->_display("admin");

View file

@ -27,21 +27,59 @@
/**
* fonction d'insertion d'une nouvelle catégorie dans la bdd
* @param object $objUser L'objet utilisateur
* @param object $objCategory l'objet catégorie
* @return bool Est-ce que la requête s'est bien passée (true/false)
*/
public function insert(object $objCategory):bool{
public function insertCategory(object $objCategory):bool{
$strRq = "INSERT INTO category (category_name, category_parent)
VALUES (:name, :parent)";
$strRq = "INSERT INTO category (category_name)
VALUES (:name)";
$rqPrep = $this->_db->prepare($strRq);
$rqPrep->bindValue(":name", $objCategory->getName(), PDO::PARAM_STR);
$rqPrep->bindValue(":parent", $objCategory->getParent(), PDO::PARAM_STR);
return $rqPrep->execute();
}
}
/**
* fonction de suppression d'une catégorie dans la bdd
* @param object $objCategory l'objet catégorie
* @return bool Est-ce que la requête s'est bien passée (true/false)
*/
public function deleteCategory(object $objCategory):bool{
$strRq = "DELETE FROM category
WHERE category_id= :id";
$rqPrep = $this->_db->prepare($strRq);
$rqPrep->bindValue(":id", $objCategory->getId(), PDO::PARAM_INT);
return $rqPrep->execute();
}
/**
* fonction de modification d'une catégorie dans la bdd
* @param object $objCategory l'objet catégorie
* @return bool Est-ce que la requête s'est bien passée (true/false)
*/
public function editCategory(object $objCategory):bool{
$strRq = "UPDATE category
SET category_name = :name
WHERE category_id = :id";
$rqPrep = $this->_db->prepare($strRq);
$rqPrep->bindValue(":id", $objCategory->getId(), PDO::PARAM_INT);
$rqPrep->bindValue(":name", $objCategory->getName(), PDO::PARAM_STR);
return $rqPrep->execute();
}
}

View file

@ -0,0 +1,50 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-09 12:29:17
from 'file:views/layout.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6989d31d7d28c9_01506908',
'has_nocache_code' => false,
'file_dependency' =>
array (
'947d9aa54bf412a952e2af2d8a8255035d91b950' =>
array (
0 => 'views/layout.tpl',
1 => 1770634036,
2 => 'file',
),
),
'includes' =>
array (
'file:views/_partial/header.tpl' => 1,
'file:views/_partial/footer.tpl' => 1,
),
))) {
function content_6989d31d7d28c9_01506908 (\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_8131712286989d31d7cfb58_06071603', "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_8131712286989d31d7cfb58_06071603 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
?>
<?php
}
}
/* {/block "content"} */
}

View file

@ -0,0 +1,230 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-09 12:29: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_6989d31d65c3a2_79771570',
'has_nocache_code' => false,
'file_dependency' =>
array (
'ac77f39f91cdf26a0eb3f0963ead4008a7bda8fb' =>
array (
0 => 'views/admin.tpl',
1 => 1770640156,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6989d31d65c3a2_79771570 (\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_20302301596989d31d64f310_54306383', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_20302301596989d31d64f310_54306383 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>
</div>
</div>
<div class="sb-sidenav-footer">
<div class="small">Connecté avec le compte :</div>
<?php echo $_SESSION['user']['user_name'];?>
</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">
<div class="row">
<div class="col-4">
<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');
$foreach0DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('arrDetStatus')->value) {
$foreach0DoElse = false;
?>
<option value="<?php echo $_smarty_tpl->getValue('arrDetStatus')->getId();?>
"><?php echo $_smarty_tpl->getValue('arrDetStatus')->getStatusName();?>
</option>
<?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>
</div>
</div>
</div>
<!-- catégorie modif -->
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<form method="post">
<div class="container-fluid pt-2">
<div class="row">
<div class="col-6">
<select class="form-select" aria-label="Default select example">
<option value="0" <?php if (($_smarty_tpl->getValue('objCategory')->getId() == 0)) {?> selected <?php }?>>Modifier un catégorie existante</option>
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrCategoryToDisplay'), 'arrDetCategory');
$foreach1DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('arrDetCategory')->value) {
$foreach1DoElse = false;
?>
<option value="<?php echo $_smarty_tpl->getValue('objCategory')->getId();?>
" <?php if (($_smarty_tpl->getValue('objCategory')->getId() == $_smarty_tpl->getValue('arrDetCategory')['category_id'])) {?> selected <?php }?>>
<?php echo $_smarty_tpl->getValue('objCategory')->getName();?>
<option value="0" selected >Modifier un catégorie existante</option>
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrCategoryToDisplay'), 'arrDetCategory');
$foreach2DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('arrDetCategory')->value) {
$foreach2DoElse = false;
?>
<option value="<?php echo $_smarty_tpl->getValue('arrDetCategory')->getId();?>
" >
<?php echo $_smarty_tpl->getValue('arrDetCategory')->getName();?>
</option>
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</select>
<br>
<input type="text" class="form-control" id="floatingInput" name="edit_category">
</div>
<div class="col-2">
<button type="submit" class="btn bg-success text-light rounded-circle"> </button>
</div>
<div class="col-2">
<button class="btn bg-danger text-light rounded-circle">X</button>
</div>
</div>
<br>
<br>
<br>
<div class="row">
<!-- creation cat-->
<div class="col-6">
<label>Créer une nouvelle catégorie</label>
<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>
</div>
</div>
<div class="col-2">
<button type="submit" class="btn bg-success text-light rounded-circle"> </button>
</div>
</div>
</div>
</form>
</div>
</div>
</main>
</div>
</section>
<?php
}
}
/* {/block "content"} */
}

View file

@ -0,0 +1,63 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-09 12:23:56
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_6989d1dc7c08f9_74223007',
'has_nocache_code' => false,
'file_dependency' =>
array (
'b1b065356827f03a32a2809f87f59bd19d86da99' =>
array (
0 => 'views/_partial/footer.tpl',
1 => 1770634036,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6989d1dc7c08f9_74223007 (\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">
<div class="col-3">
<ul>
<li><a href="#">Découvrir</a>
<li><a href="#">Customisation</a>
<li><a href="#">Emploi</a>
<li><a href="#">A propos</a>
</ul>
</div>
<div class="col-3">
<ul>
<li><a href="#">Recruter</a>
<li><a href="#">Partenariat</a>
<li><a href="#">Blog</a>
<li><a href="#">Aide et support</a>
</ul>
</div>
<div class="col-3">
<ul>
<li><a href="#">Politique de confidentialité</a>
<li><a href="#">Politique sur les données</a>
<li><a href="#">CGU</a>
<li><a href="#">CGV</a>
</ul>
</div>
<div class="col-3">
<p>Suivez-nous</p>
</div>
</footer>
<?php echo '<script'; ?>
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"><?php echo '</script'; ?>
>
<?php echo '<script'; ?>
src="js/scripts.js"><?php echo '</script'; ?>
>
</body>
</html><?php }
}

View file

@ -0,0 +1,115 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-09 12:29:17
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_6989d31d88f180_59508135',
'has_nocache_code' => false,
'file_dependency' =>
array (
'b3c0a235f975d8741b25531347290b4e4994470b' =>
array (
0 => 'views/_partial/header.tpl',
1 => 1770634036,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6989d31d88f180_59508135 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial';
?><!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="assests/css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
<?php echo '<script'; ?>
src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"><?php echo '</script'; ?>
>
<title>Folliow</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container-fluid">
<a class="navbar-brand d-flex align-items-center" href="#">
<img src="assests/img/logo.png" alt="Logo" class="logo-image">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a class="nav-link" href="?ctrl=&action=">Découvrir</a>
</li>
<li class="nav-item">
<a class="nav-link" href="?ctrl=&action=">Customisation</a>
</li>
<li class="nav-item">
<a class="nav-link" href="?ctrl=&action=">Orientation</a>
</li>
<li class="nav-item">
<a class="nav-link" href="?ctrl=&action=">À propos</a>
</li>
<li class="nav-item">
<a class="nav-link" href="?ctrl=project&action=search">Rechercher</a>
</li>
<?php if ((true && (true && null !== ($_SESSION['user'] ?? null)))) {?>
<?php if ($_SESSION['user']['authorisation_name'] == "Administrateur") {?>
<li class="nav-item">
<a class="nav-link" href="?ctrl=admin&action=admin">Admin</a>
</li>
<?php }?>
<?php }?>
</ul>
<nav class="col-4 d-flex justify-content-end align-items-center" aria-label="Connexion utilisateur">
<?php if (!(true && (true && null !== ($_SESSION['user'] ?? null)))) {?>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="index.php?ctrl=user&action=signin" title="Créer un compte" aria-label="Créer un compte">
S'inscrire
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php?ctrl=user&action=login" title="Se connecter" aria-label="Se connecter">
Se connecter
</a>
</li>
</ul>
<?php } else { ?>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="edit_account.php" title="Modifier mon compte" aria-label="Modifier mon compte">
<img src=".<?php echo $_SESSION['user']['user_image'];?>
"
class="rounded-circle flex-shrink-0 mt-2 ml-5"
style="width: 36px; height: 36px; object-fit: cover;"
alt="Photo de profil">
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php?ctrl=user&action=logout" title="Se déconnecter" aria-label="Se déconnecter">
Logout
</a>
</li>
</ul>
<?php }?>
</nav>
</div>
</div>
</nav>
</body>
</html><?php }
}

View file

@ -0,0 +1,69 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-09 12:23:56
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_6989d1dc613786_88061115',
'has_nocache_code' => false,
'file_dependency' =>
array (
'b70ee0d22061ca6100f647634a5658ae38c7b520' =>
array (
0 => 'views/_partial/preview.tpl',
1 => 1770634036,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6989d1dc613786_88061115 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial';
?>
<article class="col-md-3 mb-4">
<div class="card h-100 shadow-sm article-card">
<div class="ratio ratio-16x9">
<img src=".<?php echo $_smarty_tpl->getValue('objProject')->getThumbnail();?>
"
class="w-100 h-100 object-fit-cover"
alt=""
loading="lazy">
</div>
<div class="d-flex align-items-start gap-3">
<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">
<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();?>
</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();?>
"
class="stretched-link small">
Lire la suite
</a>
</div>
</div>
</div>
</article><?php }
}

View file

@ -0,0 +1,261 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-09 12:23:56
from 'file:views/search.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6989d1dc059b91_90143315',
'has_nocache_code' => false,
'file_dependency' =>
array (
'ebfd968608976813e893f497c64277110a78bc40' =>
array (
0 => 'views/search.tpl',
1 => 1770634036,
2 => 'file',
),
),
'includes' =>
array (
'file:views/_partial/preview.tpl' => 1,
),
))) {
function content_6989d1dc059b91_90143315 (\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_10870486496989d1dbe65e81_99494215', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_10870486496989d1dbe65e81_99494215 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views';
?>
<section aria-label="Blog">
<h2 class="visually-hidden">Rechercher parmi les articles</h2>
<div class="row mb-2">
<section class="mb-5" aria-labelledby="search-heading">
<form name="formSearch" method="post" action="?ctrl=project&action=search" class="border rounded p-4 bg-light">
<h3 id="search-heading" class="h4 mb-4">
<i class="fas fa-search me-2" aria-hidden="true"></i>
Rechercher des articles
</h3>
<div class="row g-3">
<div class="col-md-6">
<label for="keywords" class="form-label">Mots-clés</label>
<input
value=""
type="text"
class="form-control"
id="keywords"
name="keywords"
placeholder="Ex: JavaScript, CSS..."
aria-describedby="keywords-help">
<small id="keywords-help" class="form-text text-muted">
Recherchez dans les titres et contenus
</small>
</div>
<div class="col-md-6">
<label for="author" class="form-label">Auteur</label>
<select class="form-select" id="author" name="author">
<option value="0" <?php if ($_smarty_tpl->getValue('intAuthor') == 0) {?>selected<?php }?>>Tous les auteurs</option>
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrUser'), 'arrDetUser');
$foreach0DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('arrDetUser')->value) {
$foreach0DoElse = false;
?>
<option value="<?php echo $_smarty_tpl->getValue('arrDetUser')['user_id'];?>
"
<?php if ($_smarty_tpl->getValue('intAuthor') == $_smarty_tpl->getValue('arrDetUser')['user_id']) {?>selected<?php }?>
>
<?php echo $_smarty_tpl->getValue('arrDetUser')['user_firstname'];?>
<?php echo $_smarty_tpl->getValue('arrDetUser')['user_name'];?>
</option>
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</select>
</div>
<div class="col-6">
<fieldset>
<legend class="form-label">Type de recherche par date</legend>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="period"
id="period-exact"
value="0"
<?php if ($_smarty_tpl->getValue('intPeriod') == 0) {?>checked<?php }?>
aria-controls="date-exact date-range">
<label class="form-check-label" for="period-exact">
Date exacte
</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="period"
id="period-range"
value="1"
<?php if ($_smarty_tpl->getValue('intPeriod') == 1) {?>checked<?php }?>
aria-controls="date-exact date-range">
<label class="form-check-label" for="period-range">
Période
</label>
</div>
</fieldset>
</div>
<!-- AJOUT RECHERCHE PAR CATEGORIE -->
<div class="col-6">
<fieldset>
<legend class="form-label">Type de recherche par catégories</legend>
<div class="col-md-6">
<label for="author" class="form-label">Catégorie</label>
<select class="form-select" id="category" name="category">
<option value="0" <?php if ($_smarty_tpl->getValue('intCategory') == 0) {?>selected<?php }?>>Toutes les catégories</option>
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrCategory'), 'arrDetCategory');
$foreach1DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('arrDetCategory')->value) {
$foreach1DoElse = false;
?>
<option value="<?php echo $_smarty_tpl->getValue('arrDetCategory')['category_id'];?>
"
<?php if ($_smarty_tpl->getValue('intCategory') == $_smarty_tpl->getValue('arrDetCategory')['category_id']) {?>selected<?php }?>
>
<?php echo $_smarty_tpl->getValue('arrDetCategory')['category_name'];?>
</option>
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</select>
</div>
</fieldset>
</div>
<div class="col-md-6" id="date-exact">
<label for="date" class="form-label">Date</label>
<input
type="date"
class="form-control"
id="date"
name="date"
aria-describedby="date-help"
value="<?php echo $_smarty_tpl->getValue('strDate');?>
" >
<small id="date-help" class="form-text text-muted">
Format: JJ/MM/AAAA
</small>
</div>
<div id="date-range" style="display: none;">
<div class="row g-3">
<div class="col-md-6">
<label for="startdate" class="form-label">Date de début</label>
<input
type="date"
class="form-control"
id="startdate"
name="startdate"
value="<?php echo $_smarty_tpl->getValue('strStartDate');?>
" >
</div>
<div class="col-md-6">
<label for="enddate" class="form-label">Date de fin</label>
<input
type="date"
class="form-control"
id="enddate"
name="enddate"
value="<?php echo $_smarty_tpl->getValue('strEndDate');?>
" >
</div>
</div>
</div>
<div class="col-12">
<button type="submit" class="btn btn-primary">
<i class="fas fa-search me-2" aria-hidden="true"></i>
Rechercher
</button>
<button type="reset" class="btn btn-secondary ms-2">
<i class="fas fa-redo me-2" aria-hidden="true"></i>
Réinitialiser
</button>
</div>
</div>
</form>
</section>
<!-- Liste des articles -->
<section aria-labelledby="articles-heading">
<h3 id="articles-heading" class="visually-hidden">Liste des projets</h3>
<div class="row mb-2">
<?php if ($_smarty_tpl->getSmarty()->getModifierCallback('count')($_smarty_tpl->getValue('arrProject')) == 0) {?>
<div class="alert alert-warning">
<p>Pas de résultats</p>
</div>
<?php }?>
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrProjectToDisplay'), 'objProject');
$foreach2DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('objProject')->value) {
$foreach2DoElse = false;
?>
<?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);
?>
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</div>
</section>
</div>
</section>
<?php echo '<script'; ?>
>
// Gestion de l'affichage des champs de date
const periodRadios = document.querySelectorAll('input[name="period"]');
const dateExact = document.getElementById('date-exact');
const dateRange = document.getElementById('date-range');
function toggleDateFields() {
const selectedPeriod = document.querySelector('input[name="period"]:checked').value;
if (selectedPeriod === '0') {
dateExact.style.display = 'block';
dateRange.style.display = 'none';
} else {
dateExact.style.display = 'none';
dateRange.style.display = 'block';
}
}
periodRadios.forEach(radio => {
radio.addEventListener('change', toggleDateFields);
});
// Initialisation au chargement
toggleDateFields();
<?php echo '</script'; ?>
>
<?php
}
}
/* {/block "content"} */
}

View file

@ -104,14 +104,20 @@
</div>
</div>
</div>
<!-- catégorie modif -->
<!-- catégorie modif -->
<div class="p-3 mt-2 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
<form method="post">
<div class="container-fluid pt-2">
<div class="row">
<div class="col-6">
<select class="form-select" aria-label="Default select example">
<option value="0" {if ($objCategory->getId() == 0)} selected {/if}>Modifier un catégorie existante</option>
{foreach from=$arrCategoryToDisplay item=arrDetCategory}
<option value="{$objCategory->getId()}" {if ($objCategory->getId() == $arrDetCategory['category_id'])} selected {/if}>
{$objCategory->getName()}
<option value="0" selected >Modifier un catégorie existante</option>
{/foreach}
{foreach from=$arrCategoryToDisplay item=arrDetCategory}
<option value="{$arrDetCategory->getId()}" >
@ -152,4 +158,5 @@
</main>
</div>
</section>
{/block}

View file

@ -9,6 +9,18 @@
directement en contact avec les entreprises.</p>
</section>
<!--filtres de "recherche"-->
<section class="container mt-5 p-5 d-flex flex-column align-items-center text-center">
<div>
<form method="GET">
<button type="submit" class="btn btn-primary" value="">catégorie 1</button>
<button type="submit" class="btn btn-primary" value="">catégorie 2</button>
<button type="submit" class="btn btn-primary" value="">Plus de 6 mois</button>
<button type="reset" class="btn btn-primary" value="">Tout</button>
</form>
</div>
</section>
<section class="container" aria-label="Articles récents">
<h2 class="visually-hidden">Les 4 derniers articles</h2>
<div class="row mb-2">