Amélioration des fonctionnalités du panel admin, des évènements, et ajout de diagrammes UML.
Co-authored-by: Charpentier Juliette <juliette.charpentier1@etu.u-pec.fr>
This commit is contained in:
parent
f9ebba1557
commit
80f615ad8e
@ -57,6 +57,7 @@ if (isset($_COOKIE['userData'])) {
|
||||
</form>
|
||||
<p class="no-account">Vous n'avez pas de compte ? <a href="/account/register">Créez un compte pour commencer
|
||||
!</a></p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
|
||||
|
61
admin/users/add/add.php
Normal file
61
admin/users/add/add.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?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'];
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$userName = htmlspecialchars($_POST["name"]);
|
||||
$userFamilyName = htmlspecialchars($_POST["family_name"]);
|
||||
$userEmail = htmlspecialchars($_POST["email"]);
|
||||
$usePassword = htmlspecialchars($_POST["password"]);
|
||||
$userUserRole = htmlspecialchars($_POST["role"]);
|
||||
}
|
||||
|
||||
$hashedPassword = sha1($userPassword);
|
||||
|
||||
$query = "SELECT mail FROM user WHERE mail = '$userEmail'";
|
||||
$result = mysqli_query($db, $query);
|
||||
|
||||
if (!$result) {
|
||||
die("Erreur lors de l'exécution de la requête.");
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
|
||||
if ($row) {
|
||||
die("<p>Un utilisateur avec cette adresse mail existe déjà.</p>");
|
||||
}
|
||||
|
||||
$addUser = "INSERT INTO `user`(`mail`, `name`, `family_name`, `role`, `password`) VALUES ('$userEmail', '$userName', '$userFamilyName', '$userUserRole', '$hashedPassword')";
|
||||
|
||||
$resultAddUser = mysqli_query($db, $addUser);
|
||||
if (!$resultAddUser) {
|
||||
echo "<p class='text'>Erreur lors de l'exécution de la requête.</p>";
|
||||
} else {
|
||||
if (mysqli_affected_rows($db) > 0) {
|
||||
echo "<p class='text'>Utilisateur créé avec succès. </p>";
|
||||
|
||||
echo "<p class='text'>Prénom : " . $userName . "</p>";
|
||||
echo "<p class='text'>Nom : " . $userFamilyName . "</p>";
|
||||
echo "<p class='text'>Adresse mail : " . $userEmail . "</p>";
|
||||
echo "<p class='text'>Mot de passe : " . $userPassword . "</p>";
|
||||
echo "<p class='text'>Mot de passe hashé : " . $hashedPassword . "</p>";
|
||||
echo "<p class='text'>Rôle : " . $userUserRole . "</p>";
|
||||
include ($_SERVER['DOCUMENT_ROOT'] . '/tools/discordWebhookRegister.php');
|
||||
header("Location: /admin/users/?newuser=$userEmail");
|
||||
die();
|
||||
} else {
|
||||
echo "<p class='text'>Aucun utilisateur n\'a été ajouté.</p>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
80
admin/users/add/index.php
Normal file
80
admin/users/add/index.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?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">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<link rel="stylesheet" href="/styles/header.css" />
|
||||
<link rel="stylesheet" href="/styles/footer.css" />
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
|
||||
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
||||
<title>Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>
|
||||
<!-- code de la page ici -->
|
||||
<!-- en t'appuyant sur la page /register/index.php, crée une page permettant de créer un utilisateur
|
||||
(avec menu déroulant pour le choix du rôle, à la place du code role) -->
|
||||
<div class="login-container">
|
||||
<img src="https://cdn-icons-png.flaticon.com/512/4139/4139948.png" alt="Avatar">
|
||||
<h2>Créer un compte</h2>
|
||||
<p>Créez un nouveau compte afin d'accéder à l'entièreté du site.</p>
|
||||
<form action="/admin/users/add/add.php" method="post">
|
||||
<div class="form-group">
|
||||
<label for="name"><span style="color:red;"><abbr title="Requis">*</abbr></span> Prénom</label>
|
||||
<input type="text" id="name" name="name" placeholder="Jean" required placeholder=" ">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="family_name"><span style="color:red;"><abbr title="Requis">*</abbr></span> Nom</label>
|
||||
<input type="text" id="family_name" name="family_name" placeholder="DUPONT" required placeholder=" ">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email"><span style="color:red;"><abbr title="Requis">*</abbr></span> Adresse mail</label>
|
||||
<input type="email" id="email" name="email" placeholder="username@example.com" required placeholder=" ">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password"><span style="color:red;"><abbr title="Requis">*</abbr></span> Mot de passe</label>
|
||||
<input type="password" id="password" name="password" required placeholder="••••••••" placeholder=" ">
|
||||
</div>
|
||||
|
||||
|
||||
<div class='form-group'>
|
||||
<label for='role'>Rôle à assigner</label>
|
||||
<select name='role' id='role'>
|
||||
<option>Administrateur</option>
|
||||
<option>Organisateur</option>
|
||||
<option>Sportif</option>
|
||||
<option>Spectateur</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="submit-button"><i class="fas fa-sign-in-alt"></i>
|
||||
Créer un compte</i></button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
|
||||
</body>
|
||||
|
||||
</html>
|
40
admin/users/delete/index.php
Normal file
40
admin/users/delete/index.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?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'];
|
||||
}
|
||||
?>
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>=
|
||||
<!-- code de la page ici -->
|
||||
|
||||
<?php
|
||||
// script php ici
|
||||
if (isset($_GET['oldemail'])) {
|
||||
|
||||
// faire requete préparée à la bdd avec le mail, afin de supprimer l'utilisateur qui porte ce mail.
|
||||
$userEmail = htmlspecialchars($_GET['oldemail']);
|
||||
$stmt = mysqli_prepare($db, "DELETE FROM user WHERE mail=?");
|
||||
mysqli_stmt_bind_param($stmt, 's', $userEmail);
|
||||
$result = mysqli_stmt_execute($stmt);
|
||||
// si résultat de la requete renvoie != 0,
|
||||
echo "<p class='text'>L'utilisateur " . $userEmail . " a bien été supprimé.</p>";
|
||||
// rediriger l'utilisateur vers la page de gestion des utilisateurs
|
||||
include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php');
|
||||
header("Location: /admin/users/?res=$userEmail");
|
||||
die();
|
||||
} else {
|
||||
include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php');
|
||||
header("Location: /admin/users/?res=NONE");
|
||||
die();
|
||||
}
|
||||
|
||||
?>
|
48
admin/users/edit/index.php
Normal file
48
admin/users/edit/index.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?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">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<link rel="stylesheet" href="/styles/header.css" />
|
||||
<link rel="stylesheet" href="/styles/footer.css" />
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
|
||||
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
||||
<title>Titre de la page | Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>=
|
||||
<!-- code de la page ici -->
|
||||
|
||||
<?php
|
||||
// script php ici
|
||||
if (isset($_GET['email'])) {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -57,6 +57,16 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<p class='text'>Que souhaitez-vous faire ?</p>";
|
||||
// Affichage des utilisateurs
|
||||
echo "<div class='adm-users-container'>";
|
||||
// voir message de supression:
|
||||
if (isset($_GET['res'])) {
|
||||
$oldEmail = ($_GET['res']);
|
||||
echo "<p class='text' style='color:yellow; padding-left:0; text-align:center;'>L'utilisateur " . $oldEmail . " a bien été supprimé.</p>";
|
||||
}
|
||||
if (isset($_GET['newuser'])) {
|
||||
$newUserEmail = ($_GET['newuser']);
|
||||
echo "<p class='text' style='color:green; padding-left:0; text-align:center;'>L'utilisateur " . $newUserEmail . " a bien été créé.🦆</p>";
|
||||
|
||||
}
|
||||
$users = mysqli_query($db, "SELECT * FROM `user`");
|
||||
echo "<table class='table'>";
|
||||
echo "<tr>";
|
||||
@ -72,17 +82,14 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<td>" . $row['name'] . "</td>";
|
||||
echo "<td>" . $row['family_name'] . "</td>";
|
||||
echo "<td>" . $row['role'] . "</td>";
|
||||
echo "<td><a href='/admin/users/edit?email=" . $row['mail'] . "'>Modifier</a> | <a href='/admin/users/delete?email=" . $row['mail'] . "'>Supprimer</a></td>";
|
||||
echo "<td><a href='/admin/users/edit?email=" . $row['mail'] . "'>Modifier</a> | <a href='/admin/users/delete?oldemail=" . $row['mail'] . "'>Supprimer</a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<a href='/admin/users/add'>Ajouter un utilisateur</a>
|
||||
";
|
||||
echo "<a href='/admin'>Retour au panel d'administration</a>
|
||||
";
|
||||
echo "<a href='/'>Retour à l'accueil</a>
|
||||
";
|
||||
echo "<button class='button-submit'><a href='/admin/users/add'>Ajouter un utilisateur</a></button>";
|
||||
echo "<button class='button-submit'><a href='/admin'>Retour au panel d'administration</a></button>";
|
||||
echo "<button class='button-submit'><a href='/'>Retour à l'accueil</a></button>";
|
||||
|
||||
//contenu de la page admin
|
||||
} ?>
|
||||
|
2853
diagrams/Cas_usage_accueil.mdj
Normal file
2853
diagrams/Cas_usage_accueil.mdj
Normal file
File diff suppressed because it is too large
Load Diff
2468
diagrams/Cas_usage_administration.mdj
Normal file
2468
diagrams/Cas_usage_administration.mdj
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
7445
diagrams/Cas_usage_footer.mdj
Normal file
7445
diagrams/Cas_usage_footer.mdj
Normal file
File diff suppressed because it is too large
Load Diff
3107
diagrams/Cas_usage_gestion_utilisateur_PAS_FINI.mdj
Normal file
3107
diagrams/Cas_usage_gestion_utilisateur_PAS_FINI.mdj
Normal file
File diff suppressed because it is too large
Load Diff
6265
diagrams/Cas_usage_header.mdj
Normal file
6265
diagrams/Cas_usage_header.mdj
Normal file
File diff suppressed because it is too large
Load Diff
9822
diagrams/Cas_usage_inscription.mdj
Normal file
9822
diagrams/Cas_usage_inscription.mdj
Normal file
File diff suppressed because it is too large
Load Diff
1819
diagrams/Schéma BBD.mdj
Normal file
1819
diagrams/Schéma BBD.mdj
Normal file
File diff suppressed because it is too large
Load Diff
23
events/book/book.php
Normal file
23
events/book/book.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?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'];
|
||||
}
|
||||
|
||||
// un utilisateur a cliqué sur le bouton "S'inscrire" d'un évènement
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@ -1,41 +0,0 @@
|
||||
<?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">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<link rel="stylesheet" href="/styles/header.css" />
|
||||
<link rel="stylesheet" href="/styles/footer.css" />
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
|
||||
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
||||
<title>S'inscrire | Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>
|
||||
<h1>S'inscrire à un évènement</h1>
|
||||
<!-- code de la page ici -->
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -16,32 +16,29 @@
|
||||
|
||||
<body>
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>
|
||||
|
||||
|
||||
<!-- code de la page ici -->
|
||||
<h1>Évènements</h1>
|
||||
|
||||
|
||||
<!-- <form method="POST"> -->
|
||||
<?php
|
||||
/*
|
||||
- Sujet:
|
||||
-- Créer un évènement (rôle organisateur ou admin) ✅
|
||||
-- afficher la liste des évènements (tout le monde) ✅
|
||||
-- Rechercher un évènement par date, lieu, ou nom ✅
|
||||
-- s'inscrire à un évènement (rôle membre ou +)
|
||||
-- participer à un évènement (sportif)
|
||||
-- laisser un commentaire (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...
|
||||
*/
|
||||
|
||||
?>
|
||||
<!-- 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 +)
|
||||
-- afficher la liste des évènements (tout le monde)
|
||||
-- Rechercher un évènement par date, lieu, ou nom
|
||||
-- afficher la liste des évènements (tout le monde) ✅
|
||||
-- Rechercher un évènement par date, lieu, ou nom ✅
|
||||
-->
|
||||
|
||||
<?php
|
||||
|
151
events/list/display/index.php
Normal file
151
events/list/display/index.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?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">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<link rel="stylesheet" href="/styles/header.css" />
|
||||
<link rel="stylesheet" href="/styles/footer.css" />
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
|
||||
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
||||
<title>Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?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'";
|
||||
$result = mysqli_query($db, $query);
|
||||
echo "<div class='events-flex-container'>";
|
||||
if (mysqli_num_rows($result) > 0) {
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$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);
|
||||
$guest_count = htmlspecialchars($row['guest_count'], ENT_QUOTES);
|
||||
$creator = htmlspecialchars($row['creator'], ENT_QUOTES);
|
||||
echo "<div class='event-card'>";
|
||||
echo "<h3>$title</h3>";
|
||||
echo "<p class='text'>Type d'évènement : $event_type</p>";
|
||||
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'>$description</p>";
|
||||
|
||||
echo "</div>";
|
||||
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text'>Aucun évènement trouvé à $location</p>";
|
||||
}
|
||||
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'";
|
||||
$result = mysqli_query($db, $query);
|
||||
echo "<div class='events-flex-container'>";
|
||||
if (mysqli_num_rows($result) > 0) {
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$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);
|
||||
$guest_count = htmlspecialchars($row['guest_count'], ENT_QUOTES);
|
||||
$creator = htmlspecialchars($row['creator'], ENT_QUOTES);
|
||||
echo "<div class='event-card'>";
|
||||
echo "<h3>$title</h3>";
|
||||
echo "<p class='text'>Type d'évènement : $event_type</p>";
|
||||
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'>$description</p>";
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text'>Aucun évènement trouvé le" . $date_fr . ".</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'";
|
||||
$result = mysqli_query($db, $query);
|
||||
echo "<div class='events-flex-container'>";
|
||||
if (mysqli_num_rows($result) > 0) {
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$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);
|
||||
$guest_count = htmlspecialchars($row['guest_count'], ENT_QUOTES);
|
||||
$creator = htmlspecialchars($row['creator'], ENT_QUOTES);
|
||||
echo "<div class='event-card'>";
|
||||
echo "<h3>$title</h3>";
|
||||
echo "<p class='text'>Type d'évènement : $event_type</p>";
|
||||
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'>$description</p>";
|
||||
echo "<button class='book-button'>S'inscrire</button>"; // Add the button here
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text'>Aucun évènement n'est prévu à ce nom.</p>";
|
||||
}
|
||||
echo "</div>";
|
||||
} else {
|
||||
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!-- code de la page ici -->
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -28,39 +28,65 @@ if (isset($_COOKIE['userData'])) {
|
||||
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
|
||||
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
||||
<script src="/scripts/dateChecker.js" defer></script>
|
||||
<script src="/scripts/redirectToSelected.js" defer></script>
|
||||
<title>List des évènements | Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . '/views/header.php' ?>
|
||||
<h1>Liste des évènements</h1>
|
||||
<div class="event-container">
|
||||
<div class="searchbar">
|
||||
<form action="search" method="get">
|
||||
</form>
|
||||
<input id="searchbar" name="search" placeholder="Rechercher un nom d'évènement" type="text">
|
||||
<button type="submit"><i class="fas fa-search"></i> Rechercher</button>
|
||||
</div>
|
||||
|
||||
<!-- menu déroulant permettant d'afficher les lieux pour lesquels un évènement est enregistré dans la base de données avec mysqli-connect ($db)-->
|
||||
<p class="text">Sélectionner un lieu :</p>
|
||||
<select name="location" id="location">
|
||||
<img src="https://cdn-icons-png.flaticon.com/512/2538/2538566.png" alt="Avatar">
|
||||
<h2 class="event-title">Afficher les évènements</h2>
|
||||
<p class="event-subtitle">Remplissez le formulaire suivant afin de trier les évènements à votre guise.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="eventName">Nom de l'évènement</label>
|
||||
<select name="eventName" id="eventName">
|
||||
<?php
|
||||
$query = "SELECT DISTINCT title FROM event";
|
||||
$result = mysqli_query($db, $query);
|
||||
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$title = htmlspecialchars($row['title'], ENT_QUOTES);
|
||||
echo "<option value='" . $title . "'>" . $title . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<button type="submit" onclick="redirectToSelectedTitle()"><i class="fas fa-search"></i> Rechercher</button>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="location">Sélectionner un lieu :</label>
|
||||
<select name="location" id="location">
|
||||
<?php
|
||||
$query = "SELECT DISTINCT location FROM event";
|
||||
$result = mysqli_query($db, $query);
|
||||
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
echo "<option value='" . $row['location'] . "'>" . $row['location'] . "</option>";
|
||||
$location = htmlspecialchars($row['location'], ENT_QUOTES);
|
||||
echo "<option value='" . $location . "'>" . $location . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="event-date">
|
||||
<label for="eventDate">
|
||||
<p class="text">Sélectionner une date:</p>
|
||||
</label>
|
||||
<input type="date" id="eventDate" name="eventDate">
|
||||
<button type="submit" onclick="redirectToSelectedLocation()"><i class="fas fa-search"></i> Rechercher</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="event-date">
|
||||
<label for="eventDate">Sélectionner une date :</label>
|
||||
<select name="eventDate" id="eventDate">
|
||||
<?php
|
||||
$query = "SELECT DISTINCT date FROM event ORDER BY date ASC";
|
||||
$result = mysqli_query($db, $query);
|
||||
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
echo "<option value='" . $row['date'] . "'>" . $row['date'] . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<button type="submit" onclick="redirectToSelectedDate()"><i class="fas fa-search"></i> Rechercher</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- code de la page ici -->
|
||||
|
||||
|
@ -5,11 +5,11 @@ session_start();
|
||||
|
||||
// Traitement des données utilisateur
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$eventName = mysqli_real_escape_string($db, $_POST['eventName']);
|
||||
$eventDate = mysqli_real_escape_string($db, $_POST['eventDate']);
|
||||
$eventLocation = mysqli_real_escape_string($db, $_POST['eventLocation']);
|
||||
$eventDiscipline = mysqli_real_escape_string($db, $_POST['eventDiscipline']);
|
||||
$eventDescription = mysqli_real_escape_string($db, $_POST['eventDescription']);
|
||||
$eventName = $db->real_escape_string($_POST['eventName']);
|
||||
$eventDate = $db->real_escape_string($_POST['eventDate']);
|
||||
$eventLocation = $db->real_escape_string($_POST['eventLocation']);
|
||||
$eventDiscipline = $db->real_escape_string($_POST['eventDiscipline']);
|
||||
$eventDescription = $db->real_escape_string($_POST['eventDescription']);
|
||||
$eventRoles = isset($_POST['eventRole']) ? $_POST['eventRole'] : [];
|
||||
|
||||
// Construction d'une liste de rôles pour l'affichage
|
||||
|
@ -111,11 +111,11 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<p>Organisateur</p>";
|
||||
echo "</label>";
|
||||
echo "</div>";
|
||||
echo "</div>";
|
||||
echo "<button type='submit' class='submit-button'><i class='fas fa-calendar-plus'></i> Créer</i></button>";
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
echo "</div>";
|
||||
echo "</div>";
|
||||
|
||||
} else {
|
||||
echo "<p class='text'>Vous n'êtes pas autorisé à accéder à cette page.</p>";
|
||||
|
25
index.php
25
index.php
@ -53,31 +53,6 @@ if (isset($_COOKIE['userData'])) {
|
||||
2024.</p>
|
||||
<p class="text">Vous pourrez également créer un compte pour accéder à des fonctionnalités supplémentaires.</p>
|
||||
|
||||
<!-- barre de recherche -->
|
||||
<div class="searchbar">
|
||||
<form action="search" method="get">
|
||||
</form>
|
||||
<input id="searchbar" name="search" placeholder="Rechercher évènement" type="text">
|
||||
<button type="submit"><i class="fas fa-search"></i> Rechercher</button>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$evenement = isset($_GET['search']) ? $_GET['search'] : '';
|
||||
$stmt = $db->prepare("SELECT discipline FROM olympic_discipline WHERE discipline = ?");
|
||||
$stmt->bind_param("s", $evenement);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
echo $row['discipline'];
|
||||
}
|
||||
$stmt->close();
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
|
||||
|
||||
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
||||
|
13
scripts/redirectToSelected.js
Normal file
13
scripts/redirectToSelected.js
Normal file
@ -0,0 +1,13 @@
|
||||
function redirectToSelectedDate() {
|
||||
var selectedDate = document.getElementById("eventDate").value;
|
||||
window.location.href = "/events/list/display?date=" + selectedDate;
|
||||
}
|
||||
function redirectToSelectedLocation() {
|
||||
var selectedLocation = document.getElementById("location").value;
|
||||
window.location.href = "/events/list/display?location=" + selectedLocation;
|
||||
}
|
||||
|
||||
function redirectToSelectedTitle() {
|
||||
var selectedTitle = document.getElementById("eventName").value;
|
||||
window.location.href = "/events/list/display?title=" + selectedTitle;
|
||||
}
|
@ -120,7 +120,19 @@ p.login-subtitle {
|
||||
transition: all 0.3s ease;
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
button.submit-button {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
border: none;
|
||||
background-color: #f4b400;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
transition: all 0.3s ease;
|
||||
margin-top: 25px;
|
||||
}
|
||||
button:hover {
|
||||
background-color: #f4a400;
|
||||
}
|
||||
@ -150,6 +162,24 @@ h1 {
|
||||
font-family: "RobotoFlex";
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: white;
|
||||
font-size: 1.5rem;
|
||||
margin-top: 1rem;
|
||||
padding-left: 2rem;
|
||||
text-transform: uppercase;
|
||||
font-family: "RobotoFlex";
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: white;
|
||||
font-size: 1.25rem;
|
||||
margin-top: 1rem;
|
||||
padding-left: 2rem;
|
||||
text-transform: uppercase;
|
||||
font-family: "RobotoFlex";
|
||||
}
|
||||
|
||||
p.text {
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
@ -229,6 +259,23 @@ td {
|
||||
background-color: #f4a400;
|
||||
}
|
||||
|
||||
.form-group button {
|
||||
padding: 0.5rem;
|
||||
border: none;
|
||||
background-color: #f4b400;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
transition: all 0.3s ease;
|
||||
width: 17rem;
|
||||
margin-left: 0.25rem;
|
||||
}
|
||||
.form-group button:hover {
|
||||
background-color: #f4a400;
|
||||
}
|
||||
|
||||
.adm-users-container {
|
||||
background: #26272b;
|
||||
align-items: center;
|
||||
@ -240,7 +287,7 @@ td {
|
||||
text-align: center;
|
||||
max-width: fit-content;
|
||||
margin-inline: auto;
|
||||
margin-block: 5em;
|
||||
margin-block: 1em;
|
||||
}
|
||||
|
||||
.event-container {
|
||||
@ -371,3 +418,50 @@ button.new-event {
|
||||
button.new-event:hover {
|
||||
background-color: #f4a400;
|
||||
}
|
||||
|
||||
.events-flex-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap; /* Permet aux éléments de passer à la ligne suivante si nécessaire */
|
||||
gap: 1rem; /* Ajoute un espace entre les divs */
|
||||
}
|
||||
|
||||
.event-card {
|
||||
background: #26272b;
|
||||
padding: 1rem;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
|
||||
width: calc(
|
||||
50% - 1rem
|
||||
); /* Prend la moitié de l'espace disponible, en déduisant l'espace de la 'gap' */
|
||||
max-width: 400px;
|
||||
margin: 0 auto 1rem;
|
||||
}
|
||||
|
||||
.event-card img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.event-card h3 {
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.event-card p {
|
||||
color: #8e8c8c;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.event-card .event-date {
|
||||
font-family: "RobotoFlex";
|
||||
color: white;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.event-card .event-location {
|
||||
font-family: "RobotoFlex";
|
||||
color: #8e8c8c;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ $hookObject = json_encode([
|
||||
],
|
||||
"author" => [
|
||||
"name" => "Juliette & Loris",
|
||||
"url" => "https://but.lbalocchi.fr/",
|
||||
"url" => "https://stackoverflow.com/a/51748785",
|
||||
],
|
||||
|
||||
// Field array of objects
|
||||
|
@ -38,12 +38,9 @@ $hookObject = json_encode([
|
||||
],
|
||||
"author" => [
|
||||
"name" => "Juliette & Loris",
|
||||
"url" => "https://but.lbalocchi.fr/",
|
||||
"url" => "https://stackoverflow.com/a/51748785",
|
||||
],
|
||||
|
||||
// Field array of objects
|
||||
"fields" => [
|
||||
// en cas de nouvel évènement créé, notifie via un webhook des informations suivantes concernant l'évènement : Nom de l'évènement, Discipline, Date de l'évènement, Lieu de l'évènement, Description de l'évènement, Rôles pouvant s'inscrire
|
||||
[
|
||||
"name" => "Nom de l'évènement",
|
||||
"value" => $eventName,
|
||||
|
@ -38,7 +38,7 @@ $hookObject = json_encode([
|
||||
],
|
||||
"author" => [
|
||||
"name" => "Juliette & Loris",
|
||||
"url" => "https://but.lbalocchi.fr/",
|
||||
"url" => "https://stackoverflow.com/a/51748785",
|
||||
],
|
||||
|
||||
// Field array of objects
|
||||
|
@ -63,15 +63,6 @@ if (isset($_COOKIE['userData'])) {
|
||||
<a href="#">Juliette & Loris</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-sm-6 col-xs-12">
|
||||
<!-- <ul class="social-icons">
|
||||
<li><a class="facebook" href="#"><i class="fa fa-facebook"></i></a></li>
|
||||
<li><a class="twitter" href="#"><i class="fa fa-twitter"></i></a></li>
|
||||
<li><a class="dribbble" href="#"><i class="fa fa-dribbble"></i></a></li>
|
||||
<li><a class="linkedin" href="#"><i class="fa fa-linkedin"></i></a></li>
|
||||
</ul> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
Loading…
Reference in New Issue
Block a user