Ajout de webhooks pour le login/register/newEvent.
Ajout des pages pour gestion globale des évènements. Co-authored-by: Charpentier Juliette <juliette.charpentier@etu.u-pec.fr>
This commit is contained in:
41
events/book/index.php
Normal file
41
events/book/index.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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>
|
@@ -43,23 +43,29 @@
|
||||
-- afficher la liste des évènements (tout le monde)
|
||||
-- Rechercher un évènement par date, lieu, ou nom
|
||||
-->
|
||||
<div class="searchbar">
|
||||
<form action="search" method="get">
|
||||
</form>
|
||||
<input id="searchbar" name="search" placeholder="Rechercher un évènement" type="text">
|
||||
<button type="submit"><i class="fas fa-search"></i> Rechercher</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (isset($_COOKIE['userData'])) {
|
||||
if (($role == 'Administrateur') or ($role == 'Organisateur')) {
|
||||
echo '<button class="submit-button new-event" onclick="window.location.href = \'/events/new\';">Créer un évènement</button>';
|
||||
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>';
|
||||
|
||||
} 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>';
|
||||
} else {
|
||||
echo "<p class='text'>Vous n'êtes pas autorisé à créer un évènement.</p>";
|
||||
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/book\';">S\'inscrire un évènement</button>';
|
||||
|
||||
} else {
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Consulter la liste des évènements</button>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
71
events/list/index.php
Normal file
71
events/list/index.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?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>
|
||||
<script src="/scripts/dateChecker.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">
|
||||
|
||||
<?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>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="event-date">
|
||||
<label for="eventDate">
|
||||
<p class="text">Sélectionner une date:</p>
|
||||
</label>
|
||||
<input type="date" id="eventDate" name="eventDate">
|
||||
</div>
|
||||
|
||||
<!-- code de la page ici -->
|
||||
|
||||
</div>
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . '/views/footer.php' ?>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -40,6 +40,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
if ($result) {
|
||||
echo "<p class='text'>L'évènement a bien été créé.</p>";
|
||||
include ($_SERVER['DOCUMENT_ROOT'] . '/views/discordWebhookNewEvent.php');
|
||||
header("Location: /events/new?result=event-creation-succeded");
|
||||
} else {
|
||||
echo "<p class='text'>Une erreur est survenue lors de la création de l'évènement. Erreur : " . mysqli_error($db) . "</p>";
|
||||
|
@@ -48,10 +48,10 @@ if (isset($_COOKIE['userData'])) {
|
||||
$role = $userData['role'];
|
||||
|
||||
if (($role == 'Administrateur') or ($role == 'Organisateur')) { // Si l'utilisateur est un administrateur : accès à la page
|
||||
echo "<div class='event-create-container'>";
|
||||
echo "<div class='event-container'>";
|
||||
echo "<img src='https://cdn-icons-png.flaticon.com/512/2538/2538566.png' alt='Avatar'>";
|
||||
echo "<h2 class='event-create-title'>Créer un nouvel évènement</h2>";
|
||||
echo "<p class='event-create-subtitle'>Remplissez le formulaire suivant afin de créer un nouvel évènement.</p>";
|
||||
echo "<h2 class='event-title'>Créer un nouvel évènement</h2>";
|
||||
echo "<p class='event-subtitle'>Remplissez le formulaire suivant afin de créer un nouvel évènement.</p>";
|
||||
echo "<form method='POST' action='/events/new/eventCreate.php'>";
|
||||
echo "<div class='form-group'>";
|
||||
if (isset($_GET['result'])) {
|
||||
@@ -65,8 +65,8 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<label for='eventName'>Nom de l'évènement</label>";
|
||||
echo "<input type='text' name='eventName' id='eventName' required>";
|
||||
echo "</div>";
|
||||
echo "<div class='form-group;
|
||||
<label for='eventDiscipline'>Discipline</label>";
|
||||
echo "<div class='form-group'>";
|
||||
echo "<label for='eventDiscipline'>Discipline</label>";
|
||||
echo "<select name='eventDiscipline' id='eventDiscipline'>";
|
||||
$disciplines = mysqli_query($db, "SELECT discipline FROM `olympic_discipline` ");
|
||||
while ($row = mysqli_fetch_assoc($disciplines)) {
|
||||
@@ -74,8 +74,8 @@ if (isset($_COOKIE['userData'])) {
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</div>";
|
||||
echo "<div class='form-group'>;
|
||||
<label for='eventDate'>Date de l'évènement</label>";
|
||||
echo "<div class='form-group'>";
|
||||
echo "<label for='eventDate'>Date de l'évènement</label>";
|
||||
echo "<input type='date' name='eventDate' id='eventDate' required>";
|
||||
echo "</div>";
|
||||
echo "<div class='form-group'>";
|
||||
@@ -92,21 +92,21 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<input type='textarea' name='eventDescription' id='eventDescription' required>";
|
||||
echo "</div>";
|
||||
echo "<div class='form-group'>";
|
||||
echo "<label for='eventRole'>Rôles pouvant s'inscrire</label>";
|
||||
echo "<label for='eventRole'>Rôles pouvant s'inscrire (<b><i>en sélectionner au moins un</i></b>)</label>";
|
||||
echo "<div>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='membre' value='membre'>";
|
||||
echo "<label for='membre'>";
|
||||
echo "<p>Membre</p>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='spectateur' value='Spectateur'>";
|
||||
echo "<label for='spectateur'>";
|
||||
echo "<p>Spectateur</p>";
|
||||
echo "</label>";
|
||||
echo "</div>";
|
||||
echo "<div>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='sportif' value='sportif'>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='sportif' value='Sportif'>";
|
||||
echo "<label for='sportif'>";
|
||||
echo "<p>Sportif</p>";
|
||||
echo "</label>";
|
||||
echo "</div>";
|
||||
echo "<div>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='organisateur' value='organisateur'>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='organisateur' value='Organisateur'>";
|
||||
echo "<label for='organisateur'>";
|
||||
echo "<p>Organisateur</p>";
|
||||
echo "</label>";
|
||||
|
@@ -1,116 +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>Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>
|
||||
|
||||
|
||||
|
||||
<div class="event-create-container">
|
||||
<img src="https://cdn-icons-png.flaticon.com/512/2538/2538566.png" alt="Avatar">
|
||||
<h2 class="event-create-title">Créer un nouvel évènement</h2>
|
||||
<p class="event-create-subtitle">Remplissez le formulaire suivant afin de créer un nouvel évènement.</p>
|
||||
<form method="POST" action="/events/new/eventCreate.php">
|
||||
<?php
|
||||
if (isset($_GET['result'])) {
|
||||
if ($_GET['result'] == "event-creation-failed") {
|
||||
echo "<p class='text' style='color:red; padding-left:0;'> ⛔ Une erreur est survenue, l'évènement n'a pas été créé.</p>";
|
||||
} else if ($_GET["result"] == "event-creation-succeded") {
|
||||
echo "<p class='text' style='color:green; padding-left:0;'> ✅ L'évènement a bien été créé.</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="eventName">Nom de l'évènement</label>
|
||||
<input type="text" name="eventName" id="eventName" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="eventDiscipline">Discipline</label>
|
||||
<select name="eventDiscipline" id="eventDiscipline">
|
||||
<?php
|
||||
$disciplines = mysqli_query($db, "SELECT discipline FROM `olympic_discipline` ");
|
||||
while ($row = mysqli_fetch_assoc($disciplines)) {
|
||||
echo "<option>" . $row['discipline'] . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="eventDate">Date de l'évènement</label>
|
||||
<input type="date" name="eventDate" id="eventDate" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="eventLocation">Lieu de l'évènement<select name="eventLocation" id="eventLocation">
|
||||
<?php
|
||||
$locations = mysqli_query($db, "SELECT venue_info FROM `olympic_location` ");
|
||||
while ($row = mysqli_fetch_assoc($locations)) {
|
||||
echo "<option>" . $row['venue_info'] . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="eventDescription">Description de l'évènement</label>
|
||||
<input type="textarea" name="eventDescription" id="eventDescription" required>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="eventRole">Rôles pouvant s'inscrire</label>
|
||||
<div>
|
||||
<input type="checkbox" name="eventRole[]" id="membre" value="membre">
|
||||
<label for="membre">
|
||||
<p>Membre</p>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="checkbox" name="eventRole[]" id="sportif" value="sportif">
|
||||
<label for="sportif">
|
||||
<p>Sportif</p>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="checkbox" name="eventRole[]" id="organisateur" value="organisateur">
|
||||
<label for="organisateur">
|
||||
<p>Organisateur</p>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="submit-button"><i class="fas fa-calendar-plus"></i> Créer</i></button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
|
||||
</body>
|
||||
|
||||
</html>
|
49
events/participate/index.php
Normal file
49
events/participate/index.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?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 -->
|
||||
|
||||
<?php include($_SERVER['DOCUMENT_ROOT'].'/views/footer.php')?>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user