Ajout d'une selection a la page home.php + Système de badge (non fini mais fonctionnel)

This commit is contained in:
Esteban
2026-06-12 19:13:40 +02:00
parent 3015c56583
commit 12bba69908
9 changed files with 258 additions and 14 deletions
+14 -2
View File
@@ -11,7 +11,7 @@ function listeProjets() {
// Essayer
try {
// Requête SQL qui récupère titre, tags, description, image_url
$stmt = $dbh->prepare('SELECT id, title, tags, description, image_url FROM projects ORDER BY id DESC');
$stmt = $dbh->prepare('SELECT id, title, status, tags, description, image_url FROM projects ORDER BY id DESC');
// Execution de la requête SQL
$stmt->execute();
// Retourne toutes les données collectés dans un ARRAY
@@ -27,7 +27,7 @@ function recupererProjetParId($id) {
global $dbh;
try {
$stmt = $dbh->prepare('SELECT id, title, tags, description, image_url FROM projects WHERE id = :id');
$stmt = $dbh->prepare('SELECT id, title, status, tags, description, image_url FROM projects WHERE id = :id');
$stmt->bindValue(':id', $id, PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetch(PDO::FETCH_ASSOC);
@@ -53,6 +53,7 @@ function afficherProjets() {
$titre = htmlspecialchars($projet['title']);
$description = nl2br(htmlspecialchars($projet['description']));
$image = htmlspecialchars($projet['image_url']);
$status = htmlspecialchars($projet['status'] ?? '');
$tags = [];
// S'il y a des tags alors on les sépares grâce à la virgule que l'user à ajouté dans le champs (tags1,tags2,etcc...)
@@ -66,6 +67,11 @@ function afficherProjets() {
if (!empty($image)) {
echo '<div class="project-banner">';
echo '<img src="' . $image . '" alt="Image du projet ' . $titre . '">';
if (!empty($status)) {
echo '<div class="project-state">' . $status . '</div>';
}
echo '</div>';
}
@@ -103,6 +109,7 @@ function afficherProjetsAdmin() {
$titre = htmlspecialchars($projet['title']);
$description = nl2br(htmlspecialchars($projet['description']));
$image = htmlspecialchars($projet['image_url']);
$status = htmlspecialchars($projet['status'] ?? '');
$tags = [];
if (!empty($projet['tags'])) {
@@ -114,6 +121,11 @@ function afficherProjetsAdmin() {
if (!empty($image)) {
echo '<div class="project-banner">';
echo '<img src="' . $image . '" alt="Image du projet ' . $titre . '">';
if (!empty($status)) {
echo '<div class="project-state">' . $status . '</div>';
}
echo '</div>';
}