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:
@@ -37,19 +37,24 @@ if (isset($_COOKIE['userData'])) {
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php');
|
||||
|
||||
if (isset($_GET['location'])) {
|
||||
$location = htmlspecialchars($_GET['location']);
|
||||
echo "<h2>Évènements à $location</h2>";
|
||||
$query = "SELECT * FROM event WHERE location = '$location'";
|
||||
$location = $_GET['location'];
|
||||
echo "<h2>Évènements à $location pour les $role" . "s" . "</h2>";
|
||||
if ($role == 'Administrateur') {
|
||||
$query = "SELECT * FROM event WHERE location = '$location'";
|
||||
} else {
|
||||
$query = "SELECT * FROM event WHERE location = '$location' AND role LIKE '%$role%'";
|
||||
}
|
||||
$result = mysqli_query($db, $query);
|
||||
echo "<div class='events-flex-container'>";
|
||||
if (mysqli_num_rows($result) > 0) {
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$eventID = htmlspecialchars($row['id'], ENT_QUOTES);
|
||||
$title = htmlspecialchars($row['title'], ENT_QUOTES, 'UTF-8');
|
||||
$description = htmlspecialchars($row['description'], ENT_QUOTES);
|
||||
$event_type = htmlspecialchars($row['event_type'], ENT_QUOTES);
|
||||
$date = date('d/m/Y', strtotime(htmlspecialchars($row['date'])));
|
||||
$location = htmlspecialchars($row['location'], ENT_QUOTES);
|
||||
$role = htmlspecialchars($row['role'], ENT_QUOTES);
|
||||
$authorized_roles = htmlspecialchars($row['role'], ENT_QUOTES);
|
||||
$guest_count = htmlspecialchars($row['guest_count'], ENT_QUOTES);
|
||||
$creator = htmlspecialchars($row['creator'], ENT_QUOTES);
|
||||
echo "<div class='event-card'>";
|
||||
@@ -58,33 +63,44 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<p class='text'>Date : $date</p>";
|
||||
echo "<p class='text'>Lieu : $location</p>";
|
||||
echo "<p class='text'>Nombre de participants : $guest_count</p>";
|
||||
echo "<p class='text'>(Roles autorisés) : $role</p>";
|
||||
echo "<p class='text'>(Roles autorisés) : $authorized_roles</p>";
|
||||
echo "<p class='text'>$description</p>";
|
||||
|
||||
if ($role != 'Administrateur') {
|
||||
if ($role != 'Administrateur') {
|
||||
echo "<button class='submit-button' onclick=\"window.location.href = '/events/book/book.php?usermail=$email&event=$eventID';\">Réserver une place</button>";
|
||||
}
|
||||
}
|
||||
if ($role == 'Sportif') {
|
||||
echo "<button class='submit-button'>Concourir</button>";
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text'>Aucun évènement trouvé à $location</p>";
|
||||
echo "<p class='text'>Aucun évènement trouvé à cet endroit.</p>";
|
||||
echo "</div>";
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['date'])) {
|
||||
$date = htmlspecialchars($_GET['date']);
|
||||
$date_fr = date('d/m/Y', strtotime($date));
|
||||
echo "<h2>Évènements le $date_fr</h2>";
|
||||
$query = "SELECT * FROM event WHERE date = '$date'";
|
||||
$date = $_GET['date'];
|
||||
echo "<h2>Évènements le $date pour $role</h2>";
|
||||
if ($role == 'Administrateur') {
|
||||
$query = "SELECT * FROM event WHERE date = '$date'";
|
||||
} else {
|
||||
$query = "SELECT * FROM event WHERE date = '$date' AND role LIKE '%$role%'";
|
||||
}
|
||||
$result = mysqli_query($db, $query);
|
||||
echo "<div class='events-flex-container'>";
|
||||
if (mysqli_num_rows($result) > 0) {
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$eventID = htmlspecialchars($row['id'], ENT_QUOTES);
|
||||
$title = htmlspecialchars($row['title'], ENT_QUOTES);
|
||||
$description = htmlspecialchars($row['description'], ENT_QUOTES);
|
||||
$event_type = htmlspecialchars($row['event_type'], ENT_QUOTES);
|
||||
$date = date('d/m/Y', strtotime(htmlspecialchars($row['date'])));
|
||||
$location = htmlspecialchars($row['location'], ENT_QUOTES);
|
||||
$role = htmlspecialchars($row['role'], ENT_QUOTES);
|
||||
$authorized_roles = htmlspecialchars($row['role'], ENT_QUOTES);
|
||||
$guest_count = htmlspecialchars($row['guest_count'], ENT_QUOTES);
|
||||
$creator = htmlspecialchars($row['creator'], ENT_QUOTES);
|
||||
echo "<div class='event-card'>";
|
||||
@@ -93,31 +109,42 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<p class='text'>Date : $date</p>";
|
||||
echo "<p class='text'>Lieu : $location</p>";
|
||||
echo "<p class='text'>Nombre de participants : $guest_count</p>";
|
||||
echo "<p class='text'>(Roles autorisés) : $role</p>";
|
||||
echo "<p class='text'>(Roles autorisés) : $authorized_roles</p>";
|
||||
echo "<p class='text'>$description</p>";
|
||||
if ($role != 'Administrateur') {
|
||||
echo "<button class='submit-button' onclick=\"window.location.href = '/events/book/book.php?usermail=$email&event=$eventID';\">Réserver une place</button>";
|
||||
}
|
||||
if ($role == 'Sportif') {
|
||||
echo "<button class='submit-button'>Concourir</button>";
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text'>Aucun évènement trouvé le" . $date_fr . ".</p>";
|
||||
echo "<p class='text'>Aucun évènement trouvé à la date recherchée.</p>";
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['title'])) {
|
||||
$title = htmlspecialchars($_GET['title']);
|
||||
echo "<h2>Évènement intitulé " . $title . "</h2>";
|
||||
$query = "SELECT * FROM event WHERE title = '$title'";
|
||||
$title = $_GET['title'];
|
||||
echo "<h2>Évènement intitulé \"$title\"</h2>";
|
||||
if ($role == 'Administrateur') {
|
||||
$query = "SELECT * FROM event WHERE title = '$title'";
|
||||
} else {
|
||||
$query = "SELECT * FROM event WHERE title = '$title' AND role LIKE '%$role%'";
|
||||
}
|
||||
$result = mysqli_query($db, $query);
|
||||
echo "<div class='events-flex-container'>";
|
||||
if (mysqli_num_rows($result) > 0) {
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$eventID = htmlspecialchars($row['id'], ENT_QUOTES);
|
||||
$title = htmlspecialchars($row['title'], ENT_QUOTES);
|
||||
$description = htmlspecialchars($row['description'], ENT_QUOTES);
|
||||
$event_type = htmlspecialchars($row['event_type'], ENT_QUOTES);
|
||||
$date = date('d/m/Y', strtotime(htmlspecialchars($row['date'])));
|
||||
$location = htmlspecialchars($row['location'], ENT_QUOTES);
|
||||
$role = htmlspecialchars($row['role'], ENT_QUOTES);
|
||||
$authorized_roles = htmlspecialchars($row['role'], ENT_QUOTES);
|
||||
$guest_count = htmlspecialchars($row['guest_count'], ENT_QUOTES);
|
||||
$creator = htmlspecialchars($row['creator'], ENT_QUOTES);
|
||||
echo "<div class='event-card'>";
|
||||
@@ -126,9 +153,14 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<p class='text'>Date : $date</p>";
|
||||
echo "<p class='text'>Lieu : $location</p>";
|
||||
echo "<p class='text'>Nombre de participants : $guest_count</p>";
|
||||
echo "<p class='text'>(Roles autorisés) : $role</p>";
|
||||
echo "<p class='text'>(Roles autorisés) : $authorized_roles</p>";
|
||||
echo "<p class='text'>$description</p>";
|
||||
echo "<button class='book-button'>S'inscrire</button>"; // Add the button here
|
||||
if ($role != 'Administrateur') {
|
||||
echo "<button class='submit-button' onclick=\"window.location.href = '/events/book/book.php?usermail=$email&event=$eventID';\">Réserver une place</button>";
|
||||
}
|
||||
if ($role == 'Sportif') {
|
||||
echo "<button class='submit-button'>Concourir</button>";
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user