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

@ -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,34 +0,0 @@
<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>
<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>
</body>
</html>

View file

@ -1,86 +0,0 @@
<!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">
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></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="#">
<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">
<span class="navbar-toggler-icon"></span>
</button>
{* Menu de navigation *}
<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>
</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">
<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>
{else}
{* Utilisateur connecté *}
<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}"
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>
{/if}
</nav>
</div>
</div>
</nav>
</body>
</html>

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}