smarty fini (pour l'instant (╥﹏╥) )

This commit is contained in:
Yasder5 2026-02-08 20:57:52 +01:00
parent edb6c00219
commit a774205594
18 changed files with 1256 additions and 401 deletions

View file

@ -7,9 +7,9 @@
try{
// Connexion à la base de données
$this->_db = new PDO(
"mysql:host=localhost;dbname=projet_folliow", // Serveur et BDD
"root", //Nom d'utilisateur de la base de données
"",// Mot de passe de la base de données
"mysql:host=boulayoune.com;dbname=projet_folliow", // Serveur et BDD
"projet_user", //Nom d'utilisateur de la base de données
"F0lliowRules!",// Mot de passe de la base de données
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC) // Mode de renvoi
);
// Pour résoudre les problèmes dencodage

View file

@ -1,14 +1,13 @@
<?php
require("models/project_model.php");
require("entities/project_entity.php");
require("models/category_model.php");
require("entities/category_entity.php");
require("models/image_model.php");
require("entities/image_entity.php");
require("models/user_model.php");
require("entities/user_entity.php");
require("./models/project_model.php");
require("./entities/project_entity.php");
require("./models/category_model.php");
require("./entities/category_entity.php");
require("./models/image_model.php");
require("./entities/image_entity.php");
require("./models/user_model.php");
require("./entities/user_entity.php");
require("mother_controller.php");
/**
@ -16,29 +15,11 @@
* @author Laura
*/
class AdminCtrl{
class AdminCtrl extends MotherCtrl{
public function admin() {
public function admin(){
/* $objCategory = new Category ();
$objCategory->setName($_POST['category_name'] ?? "");
$objCategory->setParent($_POST['category_parent'] ?? "");
$objCategoryModel = new CategoryModel();
$boolInsert = $objCategoryModel->insert($objCategory);
EN ATTENTE
if ($boolInsert === true) {
$_SESSION['success'] = "Catégorie ajoutée avec succès";
header("Location:index.php?ctrl=admin&action=admin");
exit;
} else {
// Erreur globale
$arrError['global'] = "Erreur lors de l'ajout";
}
*/
include('../app/views/admin.php');
$this->_display("admin");
}
}

View file

@ -5,6 +5,8 @@
require("./entities/category_entity.php");
require("./models/image_model.php");
require("./entities/image_entity.php");
require("./models/user_model.php");
require("./entities/user_entity.php");
require("mother_controller.php");
/**
@ -77,7 +79,7 @@
include('../app/views/search.php');
$this->_display("search");
}
/**
@ -104,16 +106,62 @@
$objImage->hydrate($arrDetImage);
$arrImageToDiplay[] = $objImage;
}
//Variable data
$_SESSION['title'] = $_POST['titleProject']??"";
$_SESSION['description'] = $_POST['descProject']??"";
$_SESSION['content'] = $_POST['textProject']??"";
$_SESSION['thumbnail'] = $_FILES['imageProject']['name']??"";
$_SESSION['status'] = 'en_attente';
include("../app/views/partials/header.php");
include('../app/views/project.php');
include('../app/views/partials/footer.php');
$objProject = new Project();
/**
/* Créer par Besnik le GOAT et l'autre GOAT de Guillaume
/*
/* @return bool pour savoir si le fichier existe,
/* puis déplace vers le fichier uploads avec les images projet des utilisateurs
/* Communication avec la BDD
*/
if (($_SESSION['thumbnail'] != null)){
$strDest = "";
if ((count($_FILES) > 0) && ($_FILES['imageProject']['error'] != 4)){
$strDest = '../public/uploads/projects/'.$_FILES['imageProject']['name'];
var_dump($strDest);
move_uploaded_file($_FILES['imageProject']['tmp_name'], $strDest);
}
}
/** En cas d'appuis sur le bouton d'envoie ou celui de remettre a plus tard
/* 1. Changement de status
/* 2. Hydratation avec les informations récupéré de l'utilisateur
/* 3. Envoie des données à la BDD
*/
if (isset($_POST['sendMessage'])) {
$_SESSION['status'] = 'publié';
$objProject->hydrate($_SESSION);
$objProject->setThumbnail($strDest);
$objProjectModel->insert($objProject);
} else if (isset($_POST['toContinue'])) {
$objProject->hydrate($_SESSION);
$objProject->setThumbnail($strDest);
$objProjectModel->insert($objProject);
}
//Débuggage
var_dump($_SESSION);
var_dump($objProject);
$this->_arrData['arrProjectToDiplay'] = $arrProjectToDiplay;
$this->_arrData['arrImageToDiplay'] = $arrImageToDiplay;
$this->_display("project");
}
public function admin(){
include('../app/views/admin.php');
$this->_display("admin");
}
}

View file

@ -0,0 +1,71 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-08 19:41:20
from 'file:views/home.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6988e6e030cfc2_17810205',
'has_nocache_code' => false,
'file_dependency' =>
array (
'0f54e8b5c9bcafd01d94486bfa02ee91c2c5fe68' =>
array (
0 => 'views/home.tpl',
1 => 1770579251,
2 => 'file',
),
),
'includes' =>
array (
'file:views/_partial/preview.tpl' => 1,
),
))) {
function content_6988e6e030cfc2_17810205 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?>
<?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_14883993436988e6e03087b1_93283416', "content");
?>
<?php $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_14883993436988e6e03087b1_93283416 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
?>
<section class="container mt-5 p-5 d-flex flex-column align-items-center text-center">
<h1 class="logo">Folliow</h1>
<h2> les talents rencontrent leur avenir</h2>
<p class="col-6">Une plateforme de portfolio adapté à vos besoins et aux besoins des entreprises.
Créer un portfolio réellement pertinent aux exigences du marché et rentrez
directement en contact avec les entreprises.</p>
</section>
<section class="container" aria-label="Articles récents">
<h2 class="visually-hidden">Les 4 derniers articles</h2>
<div class="row mb-2">
<?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;
?>
<?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);?>
</section>
<?php
}
}
/* {/block "content"} */
}

View file

@ -0,0 +1,218 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-08 19:41:31
from 'file:views/inscription.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6988e6eb196d91_26203411',
'has_nocache_code' => false,
'file_dependency' =>
array (
'184f81453f2b8e9c87b8f61bf5df178eaf9a1be4' =>
array (
0 => 'views/inscription.tpl',
1 => 1770579251,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6988e6eb196d91_26203411 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?>
<?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_10194680646988e6eb195117_68573569', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_10194680646988e6eb195117_68573569 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\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

@ -0,0 +1,50 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-08 19:56:23
from 'file:views/layout.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6988ea67e6a550_13912228',
'has_nocache_code' => false,
'file_dependency' =>
array (
'1c51ad9f5c349145220f82584009ce981aa35e0b' =>
array (
0 => 'views/layout.tpl',
1 => 1770579251,
2 => 'file',
),
),
'includes' =>
array (
'file:views/_partial/header.tpl' => 1,
'file:views/_partial/footer.tpl' => 1,
),
))) {
function content_6988ea67e6a550_13912228 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\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_18224630526988ea67e68748_77607219', "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_18224630526988ea67e68748_77607219 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
?>
<?php
}
}
/* {/block "content"} */
}

View file

@ -1,4 +1,28 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-08 19:56:24
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_6988ea68014670_78914068',
'has_nocache_code' => false,
'file_dependency' =>
array (
'264314e384c04e79c5fa56e3cf6837f9df55d7fb' =>
array (
0 => 'views/_partial/footer.tpl',
1 => 1770579251,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6988ea68014670_78914068 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
?>
<footer class="footer container-fluid d-flex justify-content-around">
<div class="col-3">
<ul>
@ -28,7 +52,12 @@
<p>Suivez-nous</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="js/scripts.js"></script>
<?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>
</html><?php }
}

View file

@ -0,0 +1,69 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-08 19:49:01
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_6988e8ad1102e5_57320533',
'has_nocache_code' => false,
'file_dependency' =>
array (
'67e1ae3a210fc2d1bf8782993687bad91a1cf0f6' =>
array (
0 => 'views/_partial/preview.tpl',
1 => 1770579251,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6988e8ad1102e5_57320533 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\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="?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-08 19:49:00
from 'file:views/search.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6988e8acde7ac8_86925504',
'has_nocache_code' => false,
'file_dependency' =>
array (
'72e5e5c0ee2729980deadb1687a6d7b7b3c501bb' =>
array (
0 => 'views/search.tpl',
1 => 1770580115,
2 => 'file',
),
),
'includes' =>
array (
'file:views/_partial/preview.tpl' => 1,
),
))) {
function content_6988e8acde7ac8_86925504 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?>
<?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_19885437936988e8acdd5f99_82783540', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_19885437936988e8acdd5f99_82783540 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\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

@ -1,4 +1,28 @@
<!DOCTYPE html>
<?php
/* Smarty version 5.7.0, created on 2026-02-08 19:56:23
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_6988ea67ee8140_01270962',
'has_nocache_code' => false,
'file_dependency' =>
array (
'8056b95e7f6b28be5e36947735d13c8d176ec944' =>
array (
0 => 'views/_partial/header.tpl',
1 => 1770579251,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6988ea67ee8140_01270962 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
?><!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
@ -6,24 +30,23 @@
<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">
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
<?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">
{* Logo *}
<a class="navbar-brand d-flex align-items-center" href="#">
<a class="navbar-brand d-flex align-items-center" href="#">
<img src="assests/img/logo.png" alt="Logo" class="logo-image">
</a>
{* Toggler pour mobile *}
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<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>
{* Menu de navigation *}
<div class="collapse navbar-collapse" id="navbarNav">
<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>
@ -43,11 +66,9 @@
</li>
</ul>
{* Menu secondaire *}
<nav class="col-4 d-flex justify-content-end align-items-center" aria-label="Connexion utilisateur">
{if !isset($smarty.session.user)}
{* Utilisateur non connecté *}
<ul class="navbar-nav">
<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
@ -59,12 +80,12 @@
</a>
</li>
</ul>
{else}
{* Utilisateur connecté *}
<ul class="navbar-nav">
<?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=".{$smarty.session.user.user_image}"
<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">
@ -77,10 +98,11 @@
</a>
</li>
</ul>
{/if}
<?php }?>
</nav>
</div>
</div>
</nav>
</body>
</html>
</html><?php }
}

View file

@ -0,0 +1,83 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-08 19:39:48
from 'file:views/login.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6988e684b5ec83_08666834',
'has_nocache_code' => false,
'file_dependency' =>
array (
'b44ab733c93381dbf5dbbeae871506874cefd9d6' =>
array (
0 => 'views/login.tpl',
1 => 1770579251,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6988e684b5ec83_08666834 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?>
<?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_8468317156988e684b55163_88320359', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_8468317156988e684b55163_88320359 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
?>
<section aria-label="Se connecter">
<?php if ($_smarty_tpl->getSmarty()->getModifierCallback('count')($_smarty_tpl->getValue('arrError')) > 0) {?>
<div class="alert alert-danger">
<?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrError'), 'strError');
$foreach0DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('strError')->value) {
$foreach0DoElse = false;
?>
<p><?php echo $_smarty_tpl->getValue('strError');?>
</p>
<?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
</div>
<?php }?>
<form method="post">
<p>
<label>Mail:</label>
<input name="mail"
value="<?php echo (($tmp = $_smarty_tpl->getValue('strMail') ?? null)===null||$tmp==='' ? '' ?? null : $tmp);?>
"
class="form-control <?php if ((true && (true && null !== ($_smarty_tpl->getValue('arrError')['mail'] ?? null)))) {?>is-invalid<?php }?>"
type="email">
</p>
<p>
<label>Mot de passe:</label>
<input name="pwd"
class="form-control <?php if ((true && (true && null !== ($_smarty_tpl->getValue('arrError')['pwd'] ?? null)))) {?>is-invalid<?php }?>"
type="password">
</p>
<p>
<input class="form-control btn btn-primary" type="submit" value="Se connecter">
</p>
</form>
</section>
<?php
}
}
/* {/block "content"} */
}

View file

@ -0,0 +1,110 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-08 19:56:23
from 'file:views/project.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6988ea67daa639_83777802',
'has_nocache_code' => false,
'file_dependency' =>
array (
'cf8cd41232f90f60b8532c811496cf0ce7d4ac25' =>
array (
0 => 'views/project.tpl',
1 => 1770580435,
2 => 'file',
),
),
'includes' =>
array (
'file:../app/views/partials/preview.tpl' => 1,
),
))) {
function content_6988ea67daa639_83777802 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?>
<?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_14142237226988ea67da2403_00733236', "content");
$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_14142237226988ea67da2403_00733236 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
?>
<body>
<section class="container mt-5 p-5 d-flex flex-column align-items-center">
<div>
<h2>Alimenter votre projet</h2>
<form method="post">
<button type="submit" class="btn btn-primary btn-lg" name="showForm">+</button>
<?php if ((true && (true && null !== ($_POST['toContinue'] ?? null)))) {?>
<button type="submit" class="btn btn-warning btn-lg" name="showFormContinue">Reprendre</button>
<?php }?>
</form>
<?php if ((true && (true && null !== ($_POST['showForm'] ?? null))) || (true && (true && null !== ($_POST['showFormContinue'] ?? null)))) {?>
<form method="post" enctype="multipart/form-data" onsubmit="return confirm('Voulez-vous vraiment envoyer le formulaire ?')">
<div>
<label>Titre</label>
<input type="text" name="titleProject">
</div>
<div>
<label>Description</label>
<input type="text" name="descProject">
</div>
<div>
<label>Texte Portfolio</label>
<input type="text" name="textProject">
</div>
<div>
<input name="imageProject" class="form-control" type="file">
</div>
<button type="submit" class="btn btn-primary btn-md" name="sendMessage">Envoyer</button>
<button type="submit" class="btn btn-warning btn-md" name="toContinue">Remettre à plus tard</button>
</form>
<?php }?>
</div>
<div>
<h3>Description</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div>
<h3>Photos behind the scene</h3>
<div class="row mb-2">
<img>
</div>
</div>
<div>
<h3>Other projects</h3>
<div class="row mb-2">
<?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;
?>
<?php $_smarty_tpl->renderSubTemplate("file:../app/views/partials/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>
</div>
</div>
<section>
</body>
<?php
}
}
/* {/block "content"} */
}

View file

@ -0,0 +1,164 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-08 19:51:33
from 'file:views/admin.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_6988e9451d25a8_02318797',
'has_nocache_code' => false,
'file_dependency' =>
array (
'f80694cc4829becd656ad4f73c431db5dba4722b' =>
array (
0 => 'views/admin.tpl',
1 => 1770579251,
2 => 'file',
),
),
'includes' =>
array (
),
))) {
function content_6988e9451d25a8_02318797 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
?><!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Dashboard - Folliow Admin</title>
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/style.min.css" rel="stylesheet" />
<link href="assests/css/styles.css" rel="stylesheet" />
<?php echo '<script'; ?>
src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"><?php echo '</script'; ?>
>
</head>
<body class="sb-nav-fixed">
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark">
<!-- Navbar Brand-->
<a class="navbar-brand ps-3" href="index.html"><img src="assests/img/Logo-Wordmark.svg" alt="Logo du site" width="150px"></a>
<!-- Sidebar Toggle-->
<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>
<!-- Navbar Search-->
<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">
<!-- Mettre le pseudo en fonction de qui est connecté -->
<div class="small">Connecté avec le compte :</div>
*mettre un nom*
</div>
</nav>
</div>
<!-- Main page -->
<div id="layoutSidenav_content">
<main>
<div class="container-fluid px-4">
<h1 class="mt-4">Dashboard</h1>
</div>
<!-- Gray bloc -->
<div class="container-fluid px-4">
<!-- Container with img/list/remove btn = A DUPLIQUER à partir d'ici-->
<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 USER -->
<img src="./assests/img/Logo-Wordmark.svg" alt="" width="100">
</div>
<!-- USER MODIF -->
<div class="col-4">
<select class="form-select" aria-label="Default select example">
<option value="0" selected>Modifier le statut de l'Utilisateur...</option>
<option value="1">Utilisateur</option>
<option value="2">Modérateur</option>
<option value="3">Administrateur</option>
</select>
</div>
<!-- Btn SUPPR -->
<div class="col-4">
<button class="btn bg-danger text-light rounded-circle">X</button>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<?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="assests/js/scripts.js"><?php echo '</script'; ?>
>
</body>
</html>
<?php }
}

View file

@ -1,191 +0,0 @@
<!-- Contenu principal de la page -->
<main class="container py-5">
<!-- Centrage horizontal du formulaire -->
<div class="row justify-content-center">
<!-- Contenu principal de la page -->
<main class="container py-5">
<!-- Centrage horizontal du formulaire -->
<div class="row justify-content-center">
<div class="col-12 col-md-8 col-lg-5">
<!-- Carte contenant le formulaire de connexion -->
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
<!-- Titre principal -->
<h1 class="h3 fw-bold mb-1">Connexion</h1>
<!-- Texte descriptif -->
<p class="text-secondary mb-4">
Connectez-vous à votre compte.
</p>
<!-- Formulaire de connexion -->
<!-- Le traitement sera effectué en PHP via la méthode POST -->
<form method="POST">
<div class="row g-3">
<!-- Champ : adresse e-mail de l'utilisateur -->
<div class="col-12">
<label for="user_mail" class="form-label">
Adresse e-mail
</label>
<input
type="email"
class="form-control"
id="user_mail"
name="user_mail"
required
>
</div>
<!-- Champ : mot de passe -->
<div class="col-12">
<label for="user_password" class="form-label">
Mot de passe
</label>
<input
type="password"
class="form-control"
id="user_password"
name="user_password"
required
>
</div>
<!-- Option "Se souvenir de moi" (fonctionnalité optionnelle côté PHP) -->
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="remember_me" name="remember_me">
<label class="form-check-label" for="remember_me">
Se souvenir de moi
</label>
</div>
</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">
Se connecter
</button>
</div>
<!-- Lien vers la page d'inscription -->
<div class="col-12 text-center">
<small class="text-secondary">
Pas encore de compte ?
<a href="inscription.php" class="link-primary">Créer un compte</a>
</small>
</div>
<!-- Lien pour la récupération du mot de passe -->
<div class="col-12 text-center">
<small>
<a href="#" class="link-primary">
Mot de passe oublié ?
</a>
</small>
</div>
</div>
</form>
</div>
</div>
</div>
</main>
<h1 class="h3 fw-bold mb-1">Connexion</h1>
<p class="text-secondary mb-4">
Connectez-vous à votre compte.
</p>
<?php
// Affichage des erreurs (validation côté serveur)
if (!empty($arrError)) { ?>
<div class="alert alert-danger" role="alert">
<?php foreach ($arrError as $strError) { ?>
<p class="mb-0"><?php echo htmlspecialchars($strError); ?></p>
<?php } ?>
</div>
<?php } ?>
<!-- Formulaire de connexion -->
<form method="POST" action="index.php?ctrl=user&action=login">
<div class="row g-3">
<!-- Champ : adresse e-mail -->
<div class="col-12">
<label for="mail" class="form-label">
Adresse e-mail
</label>
<input
type="email"
class="form-control <?php if (isset($arrError['mail'])) { echo 'is-invalid'; } ?>"
id="mail"
name="mail"
value="<?php echo htmlspecialchars($strMail ?? ''); ?>"
>
</div>
<!-- Champ : mot de passe -->
<div class="col-12">
<label for="pwd" class="form-label">
Mot de passe
</label>
<input
type="password"
class="form-control <?php if (isset($arrError['pwd'])) { echo 'is-invalid'; } ?>"
id="pwd"
name="pwd"
>
</div>
<!-- Option "Se souvenir de moi" -->
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="remember_me" name="remember_me">
<label class="form-check-label" for="remember_me">
Se souvenir de moi
</label>
</div>
</div>
<!-- Bouton -->
<div class="col-12 d-grid mt-2">
<button type="submit" class="btn btn-primary btn-lg rounded-3">
Se connecter
</button>
</div>
<!-- Liens -->
<div class="col-12 text-center">
<small class="text-secondary">
Pas encore de compte ?
<a href="index.php?ctrl=user&action=signin" class="link-primary">Créer un compte</a>
</small>
</div>
<div class="col-12 text-center">
<small>
<a href="#" class="link-primary">
Mot de passe oublié ?
</a>
</small>
</div>
</div>
</form>
</div>
</div>
</div>
</main>

View file

@ -1,115 +0,0 @@
<?php
require_once('../app/controllers/project_controller.php');
require_once('../app/models/project_model.php');
require_once('../app/entities/project_entity.php');
//Variable data
$_SESSION['title'] = $_POST['titleProject']??"";
$_SESSION['description'] = $_POST['descProject']??"";
$_SESSION['content'] = $_POST['textProject']??"";
$_SESSION['thumbnail'] = $_FILES['imageProject']['name']??"";
$_SESSION['status'] = 'en_attente';
$objProject = new Project();
$objProjectModel = new ProjectModel();
/**
/* Créer par Besnik le GOAT et l'autre GOAT de Guillaume
/*
/* @return bool pour savoir si le fichier existe,
/* puis déplace vers le fichier uploads avec les images projet des utilisateurs
/* Communication avec la BDD
*/
if (($_SESSION['thumbnail'] != null)){
$strDest = "";
if ((count($_FILES) > 0) && ($_FILES['imageProject']['error'] != 4)){
$strDest = '../public/uploads/projects/'.$_FILES['imageProject']['name'];
var_dump($strDest);
move_uploaded_file($_FILES['imageProject']['tmp_name'], $strDest);
}
}
/** En cas d'appuis sur le bouton d'envoie ou celui de remettre a plus tard
/* 1. Changement de status
/* 2. Hydratation avec les informations récupéré de l'utilisateur
/* 3. Envoie des données à la BDD
*/
if (isset($_POST['sendMessage'])) {
$_SESSION['status'] = 'publié';
$objProject->hydrate($_SESSION);
$objProject->setThumbnail($strDest);
$objProjectModel->insert($objProject);
} else if (isset($_POST['toContinue'])) {
$objProject->hydrate($_SESSION);
$objProject->setThumbnail($strDest);
$objProjectModel->insert($objProject);
}
//Débuggage
var_dump($_SESSION);
var_dump($objProject);
?>
<body>
<section class="container mt-5 p-5 d-flex flex-column align-items-center">
<div>
<h2>Alimenter votre projet</h2>
<form method="post">
<button type="submit" class="btn btn-primary btn-lg" name="showForm">+</button>
<?php if (isset($_POST['toContinue'])) { ?>
<button type="submit" class="btn btn-warning btn-lg" name="showFormContinue">Reprendre</button>
<?php } ?>
</form>
<?php // Affichage d'un formulaire en cas d'appuie sur le bouton "+"
if ((isset($_POST["showForm"])) || (isset($_POST['showFormContinue']))) {?>
<form method="post" enctype="multipart/form-data" onsubmit="return confirm('Voulez-vous vraiment envoyer le formulaire ?')">
<div>
<label>Titre</label>
<input type="text" name="titleProject">
</div>
<div>
<label>Description</label>
<input type="text" name="descProject">
</div>
<div>
<label>Texte Portfolio</label>
<input type="text" name="textProject">
</div>
<div>
<input name="imageProject" class="form-control" type="file">
</div>
<button type="submit" class="btn btn-primary btn-md" name="sendMessage">Envoyer</button>
<button type="submit" class="btn btn-warning btn-md" name="toContinue">Remettre à plus tard</button>
</form>
<?php }; ?>
</div>
<div>
<h3>Description</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div>
<h3>Photos behind the scene</h3>
<div class="row mb-2">
<img>
</div>
</div>
<div>
<h3>Other projects</h3>
<div class="row mb-2">
<?php
foreach($arrProjectToDisplay as $objProject){
include("../app/views/partials/preview.php");
}
?>
</div>
</div>
</div>
<section>
</body>

62
views/project.tpl Normal file
View file

@ -0,0 +1,62 @@
{extends file="views/layout.tpl"}
{block name="content"}
<body>
<section class="container mt-5 p-5 d-flex flex-column align-items-center">
<div>
<h2>Alimenter votre projet</h2>
<form method="post">
<button type="submit" class="btn btn-primary btn-lg" name="showForm">+</button>
{if isset($smarty.post.toContinue)}
<button type="submit" class="btn btn-warning btn-lg" name="showFormContinue">Reprendre</button>
{/if}
</form>
{* Affichage d'un formulaire en cas d'appuie sur le bouton "+" *}
{if isset($smarty.post.showForm) || isset($smarty.post.showFormContinue)}
<form method="post" enctype="multipart/form-data" onsubmit="return confirm('Voulez-vous vraiment envoyer le formulaire ?')">
<div>
<label>Titre</label>
<input type="text" name="titleProject">
</div>
<div>
<label>Description</label>
<input type="text" name="descProject">
</div>
<div>
<label>Texte Portfolio</label>
<input type="text" name="textProject">
</div>
<div>
<input name="imageProject" class="form-control" type="file">
</div>
<button type="submit" class="btn btn-primary btn-md" name="sendMessage">Envoyer</button>
<button type="submit" class="btn btn-warning btn-md" name="toContinue">Remettre à plus tard</button>
</form>
{/if}
</div>
<div>
<h3>Description</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div>
<h3>Photos behind the scene</h3>
<div class="row mb-2">
<img>
</div>
</div>
<div>
<h3>Other projects</h3>
<div class="row mb-2">
{foreach $arrProjectToDisplay as $objProject}
{include file="../app/views/partials/preview.tpl"}
{/foreach}
</div>
</div>
</div>
<section>
</body>
{/block}

View file

@ -1,3 +1,6 @@
{extends file="views/layout.tpl"}
{block name="content"}
<section aria-label="Blog">
<h2 class="visually-hidden">Rechercher parmi les articles</h2>
<div class="row mb-2">
@ -27,18 +30,14 @@
<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 echo ($intAuthor == 0)?'selected':''; ?>>Tous les auteurs</option>
<?php
foreach($arrUser as $arrDetUser){
?>
<option value="<?php echo $arrDetUser['user_id']; ?>"
<?php echo ($intAuthor == $arrDetUser['user_id'])?'selected':''; ?>
<option value="0" {if $intAuthor == 0}selected{/if}>Tous les auteurs</option>
{foreach $arrUser as $arrDetUser}
<option value="{$arrDetUser['user_id']}"
{if $intAuthor == $arrDetUser['user_id']}selected{/if}
>
<?php echo $arrDetUser['user_firstname'].' '.$arrDetUser['user_name']; ?>
{$arrDetUser['user_firstname']} {$arrDetUser['user_name']}
</option>
<?php
}
?>
{/foreach}
</select>
</div>
@ -53,7 +52,7 @@
name="period"
id="period-exact"
value="0"
<?php echo ($intPeriod == 0)?'checked':'' ; ?>
{if $intPeriod == 0}checked{/if}
aria-controls="date-exact date-range">
<label class="form-check-label" for="period-exact">
Date exacte
@ -66,7 +65,7 @@
name="period"
id="period-range"
value="1"
<?php echo ($intPeriod == 1)?'checked':'' ; ?>
{if $intPeriod == 1}checked{/if}
aria-controls="date-exact date-range">
<label class="form-check-label" for="period-range">
Période
@ -81,18 +80,14 @@
<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 echo ($intCategory == 0)?'selected':''; ?>>Toutes les catégories</option>
<?php
foreach($arrCategory as $arrDetCategory){
?>
<option value="<?php echo $arrDetCategory['category_id']; ?>"
<?php echo ($intCategory == $arrDetCategory['category_id'])?'selected':''; ?>
<option value="0" {if $intCategory == 0}selected{/if}>Toutes les catégories</option>
{foreach $arrCategory as $arrDetCategory}
<option value="{$arrDetCategory['category_id']}"
{if $intCategory == $arrDetCategory['category_id']}selected{/if}
>
<?php echo $arrDetCategory['category_name']; ?>
{$arrDetCategory['category_name']}
</option>
<?php
}
?>
{/foreach}
</select>
</div>
</fieldset>
@ -106,7 +101,7 @@
id="date"
name="date"
aria-describedby="date-help"
value="<?php echo $strDate; ?>" >
value="{$strDate}" >
<small id="date-help" class="form-text text-muted">
Format: JJ/MM/AAAA
</small>
@ -121,7 +116,7 @@
class="form-control"
id="startdate"
name="startdate"
value="<?php echo $strStartDate; ?>" >
value="{$strStartDate}" >
</div>
<div class="col-md-6">
<label for="enddate" class="form-label">Date de fin</label>
@ -130,7 +125,7 @@
class="form-control"
id="enddate"
name="enddate"
value="<?php echo $strEndDate; ?>" >
value="{$strEndDate}" >
</div>
</div>
</div>
@ -153,17 +148,14 @@
<section aria-labelledby="articles-heading">
<h3 id="articles-heading" class="visually-hidden">Liste des projets</h3>
<div class="row mb-2">
<?php
if (count($arrProject) == 0){
?>
{if count($arrProject) == 0}
<div class="alert alert-warning">
<p>Pas de résultats</p>
</div>
<?php
}
foreach($arrProjectToDisplay as $objProject){
include("../app/views/partials/preview.php");
} ?>
{/if}
{foreach $arrProjectToDisplay as $objProject}
{include file="views/_partial/preview.tpl"}
{/foreach}
</div>
</section>
</div>
@ -193,3 +185,4 @@
// Initialisation au chargement
toggleDateFields();
</script>
{/block}