ajout de la fonctionnalité de participation d'un sportif. Fix du header et footer en conséquence.
Co-authored-by: Charpentier Juliette <juliette.charpentier1@etu.u-pec.fr>
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
<?php
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
|
||||
session_start();
|
||||
if (isset($_COOKIE['userData'])) {
|
||||
$userDataEncoded = $_COOKIE['userData'];
|
||||
$userData = json_decode($userDataEncoded, true); // 'true' pour obtenir un tableau associatif
|
||||
|
||||
$email = $userData['email'];
|
||||
$name = $userData['name'];
|
||||
$familyName = $userData['familyName'];
|
||||
$role = $userData['role'];
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@@ -44,25 +57,10 @@
|
||||
-->
|
||||
|
||||
<?php
|
||||
if (isset($_COOKIE['userData'])) {
|
||||
if (($role == 'Administrateur') or ($role == 'Organisateur')) {
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/new\';">Créer un évènement</button>';
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Rechercher un évènement</button>';
|
||||
|
||||
} else if ($role == 'Sportif') {
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/participate\';">Participer à un évènement</button>';
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Rechercher un évènement</button>';
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/book\';">Réserver un évènement</button>';
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Rechercher un évènement</button>';
|
||||
|
||||
} else {
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Rechercher un évènement</button>';
|
||||
}
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/book\';">Réserver un évènement</button>';
|
||||
|
||||
} else {
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Rechercher un évènement</button>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
// faire une requete sql avec mysqli permettant d'afficher tous les évènements
|
||||
@@ -106,21 +104,28 @@
|
||||
echo "<table class='event-table'>";
|
||||
echo "<thead>"; // En-tête du tableau
|
||||
echo "<tr>";
|
||||
echo "<th class='event-table-header'>Titre</th>"; // Ensure class name matches with the CSS
|
||||
echo "<th class='event-table-header'>Description</th>"; // Ensure class name matches with the CSS
|
||||
echo "<th class='event-table-header'>Discipline</th>"; // Ensure class name matches with the CSS
|
||||
echo "<th class='event-table-header'>Date</th>"; // Ensure class name matches with the CSS
|
||||
echo "<th class='event-table-header'>Lieu</th>"; // Ensure class name matches with the CSS
|
||||
echo "<th class='event-table-header'>Titre</th>";
|
||||
echo "<th class='event-table-header'>Description</th>";
|
||||
echo "<th class='event-table-header'>Discipline</th>";
|
||||
echo "<th class='event-table-header'>Date</th>";
|
||||
echo "<th class='event-table-header'>Lieu</th>";
|
||||
echo "<th class='event-table-header'>Action</th>";
|
||||
echo "</tr>";
|
||||
echo "</thead>";
|
||||
echo "<tbody>"; // The scrollable body class removed here if not necessary
|
||||
echo "<tbody>";
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
echo "<tr>";
|
||||
echo "<td class='event-table-data'>" . htmlspecialchars($row['title']) . "</td>";
|
||||
echo "<td class='event-table-data'>" . htmlspecialchars($row['description']) . "</td>";
|
||||
echo "<td class='event-table-data'>" . htmlspecialchars($row['event_type']) . "</td>";
|
||||
echo "<td class='event-table-data'>" . htmlspecialchars($row['date']) . "</td>";
|
||||
echo "<td class='event-table-data'>" . date('d/m/Y', strtotime($row['date'])) . "</td>";
|
||||
echo "<td class='event-table-data'>" . htmlspecialchars($row['location']) . "</td>";
|
||||
// mettre un bouton réserver si l'utilisateur est connecté et un bouton participer si l'utilisateur est un sportif
|
||||
if (isset($_COOKIE['userData'])) {
|
||||
if ($role == 'Sportif') {
|
||||
echo "<td class='event-table-data'><button class='submit-button' onclick='window.location.href=\"/events/participate/participate.php?usermail=$email&id=" . $row['id'] . "\"'>Participer</button></td>";
|
||||
}
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</tbody>";
|
||||
|
Reference in New Issue
Block a user