Ajout de la fonctionnalité de vue de tous les évènements. Ajout de la réservation d'un évènement. Fix incomplet de la modification d'un utilisateur. CSS.
Co-authored-by: Charpentier Juliette <juliette.charpentier1@etu.u-pec.fr
This commit is contained in:
@@ -34,33 +34,101 @@
|
||||
?>
|
||||
<!-- to do
|
||||
-- Créer un évènement (rôle organisateur ou admin) ✅
|
||||
-- s'inscrire à un évènement (rôle membre ou +)
|
||||
-- participer à un évènement (sportif)
|
||||
-- laisser un commentaire (rôle membre ou +)
|
||||
-- s'inscrire à un évènement (rôle membre ou +)✅
|
||||
-- afficher la liste des évènements (tout le monde) ✅
|
||||
-- Rechercher un évènement par date, lieu, ou nom ✅
|
||||
-- Trier les évènements par date, nombre de participants, personnes y ayant accès, etc...✅
|
||||
-- participer à un évènement (sportif)
|
||||
-- sécuriser les pages avec actions administratives
|
||||
|
||||
-->
|
||||
|
||||
<?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\';">Consulter la liste des évènements</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\';">Consulter la liste des évènements</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>';
|
||||
|
||||
} else {
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Consulter la liste des évènements</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\';">S\'inscrire 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\';">Consulter la liste des évènements</button>';
|
||||
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
|
||||
// afficher les évènements sous forme de tableau
|
||||
// voici les colonnes disponibles dans la table event
|
||||
// id title description event_type date location role guest_count creator
|
||||
|
||||
|
||||
$query = "SELECT * FROM event";
|
||||
|
||||
if (isset($_GET['sort'])) {
|
||||
$sort = $_GET['sort'];
|
||||
switch ($sort) {
|
||||
case 'date':
|
||||
$query .= " ORDER BY date";
|
||||
break;
|
||||
case 'location':
|
||||
$query .= " ORDER BY location";
|
||||
break;
|
||||
case 'discipline':
|
||||
$query .= " ORDER BY event_type";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Menu déroulant pour sélectionner le tri
|
||||
echo "<form method='GET' action='' class='order-by'>";
|
||||
echo "<label for='sort' class='text'>Trier par:</label>";
|
||||
echo "<select name='sort' id='sort' onchange='this.form.submit()'>";
|
||||
echo "<option value=''>Aucun</option>";
|
||||
echo "<option value='date' " . ($sort == 'date' ? 'selected' : '') . ">Date</option>";
|
||||
echo "<option value='location' " . ($sort == 'location' ? 'selected' : '') . ">Lieu</option>";
|
||||
echo "<option value='discipline' " . ($sort == 'discipline' ? 'selected' : '') . ">Discipline</option>";
|
||||
echo "</select>";
|
||||
echo "</form>";
|
||||
$result = mysqli_query($db, $query);
|
||||
echo "<div class='events-flex-container'>";
|
||||
echo "<div class='scrollable'>";
|
||||
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 "</tr>";
|
||||
echo "</thead>";
|
||||
echo "<tbody>"; // The scrollable body class removed here if not necessary
|
||||
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'>" . htmlspecialchars($row['location']) . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</tbody>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "</div>";
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user