SAE_web/events/new/indexold.php
Loris BALOCCHI bd97bbba05 👌 ajout de la fonctionnalité de création d'évènement
Co-authored-by: Charpentier Juliette <juliette.charpentier1@etu.u-pec.fr>
2024-06-13 01:19:46 +02:00

116 lines
4.9 KiB
PHP

<?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;'>&nbsp; &nbsp; &nbsp; &nbsp;⛔ 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;'>&nbsp; &nbsp; &nbsp; &nbsp;✅ 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>