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>';
}
+22 -2
View File
@@ -14,7 +14,7 @@ function listeXP() {
// Essayer
try {
// Requête SQL qui récupère titre, type, tags, description, durée, image_url
$stmt = $dbh->prepare('SELECT id, title, xptype, tags, description, duration, image_url FROM experiences ORDER BY id DESC');
$stmt = $dbh->prepare('SELECT id, title, status, xptype, tags, description, duration, image_url FROM experiences ORDER BY id DESC');
// Execution de la requête SQL
$stmt->execute();
// Retourne toutes les données collectés dans un ARRAY
@@ -31,7 +31,8 @@ function recupererXPParId($id) {
try {
// Préparation de la requête préparée
$stmt = $dbh->prepare('SELECT id, title, xptype, tags, description, duration, image_url FROM experiences WHERE id = :id');
$stmt = $dbh->prepare('SELECT id, title, status, xptype, tags, description, duration, image_url FROM experiences WHERE id = :id');
$stmt->bindValue(':id', $id, PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetch(PDO::FETCH_ASSOC);
@@ -62,6 +63,7 @@ function afficherXP() {
$description = nl2br(htmlspecialchars($experience['description']));
$duration = htmlspecialchars($experience['duration']);
$image = htmlspecialchars($experience['image_url']);
$status = htmlspecialchars($experience['status'] ?? '');
$tags = [];
@@ -78,6 +80,11 @@ function afficherXP() {
if (!empty($image)) {
echo '<div class="project-banner">';
echo '<img src="' . $image . '" alt="Image de l experience ' . $titre . '">';
if (!empty($status)) {
echo '<div class="project-state">' . $status . '</div>';
}
echo '</div>';
}
@@ -85,6 +92,7 @@ function afficherXP() {
// Ajout de la class project-content et du titre
echo '<div class="project-content">';
echo '<h2>' . $titre . '</h2>';
echo '<p><strong>Type :</strong> ' . $xptype . '</p>';
echo '<p><strong>Durée :</strong> ' . $duration . '</p>';
@@ -123,6 +131,7 @@ function afficherXPAdmin() {
$xptype = htmlspecialchars($experience['xptype']);
$description = nl2br(htmlspecialchars($experience['description']));
$duration = htmlspecialchars($experience['duration']);
$status = htmlspecialchars($experience['status'] ?? '');
$image = htmlspecialchars($experience['image_url']);
$tags = [];
@@ -135,11 +144,22 @@ function afficherXPAdmin() {
if (!empty($image)) {
echo '<div class="project-banner">';
echo '<img src="' . $image . '" alt="Image de l experience ' . $titre . '">';
if (!empty($status)) {
echo '<div class="project-state">' . $status . '</div>';
}
echo '</div>';
}
echo '<div class="project-content">';
echo '<h2>' . $titre . '</h2>';
// Si le status n'est pas vide alors on l'affiche
if (!empty($status)) {
echo '<div class="project-state">' . $status . '</div>';
}
echo '<p><strong>Type :</strong> ' . $xptype . '</p>';
echo '<p><strong>Durée :</strong> ' . $duration . '</p>';