2024-06-10 23:23:51 +02:00
|
|
|
<?php
|
|
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
|
|
|
|
|
|
|
|
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'];
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
2024-05-28 15:40:57 +02:00
|
|
|
<nav class="menu-container">
|
|
|
|
<!-- burger menu -->
|
2024-06-11 22:49:01 +02:00
|
|
|
|
2024-05-28 15:40:57 +02:00
|
|
|
<input type="checkbox" aria-label="Toggle menu" />
|
2024-06-11 22:49:01 +02:00
|
|
|
|
2024-05-28 15:40:57 +02:00
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
|
|
|
|
<!-- logo -->
|
2024-06-14 17:31:37 +02:00
|
|
|
<a href="<?php
|
|
|
|
if (isset($_COOKIE['userData'])) {
|
|
|
|
echo "/?res=login-succeeded";
|
|
|
|
} else {
|
|
|
|
echo "/";
|
|
|
|
}
|
|
|
|
?>" class="menu-logo">
|
2024-05-28 15:40:57 +02:00
|
|
|
<img src="https://i.imgur.com/RkmSo9Q.png" alt="Jeux Olympiques - Paris 2024" />
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<!-- menu items -->
|
|
|
|
<div class="menu">
|
|
|
|
<ul>
|
2024-06-13 01:44:28 +02:00
|
|
|
<?php
|
2024-06-11 10:56:40 +02:00
|
|
|
if (isset($_COOKIE['userData'])) {
|
|
|
|
$role = $userData['role'];
|
|
|
|
if ($role == 'Administrateur') {
|
2024-06-13 01:44:28 +02:00
|
|
|
echo "<li class='dropdown'>";
|
2024-06-11 10:56:40 +02:00
|
|
|
echo "<a href='/admin'>Panel d'administration</a>";
|
2024-06-13 01:44:28 +02:00
|
|
|
echo "<ul class='dropdown-content'>";
|
|
|
|
echo "<li><a href='/admin/users'>Gérer les utilisateurs</a></li>"; //option 1
|
2024-06-14 17:31:37 +02:00
|
|
|
|
2024-06-13 01:44:28 +02:00
|
|
|
echo "</ul>";
|
|
|
|
echo "</li>";
|
2024-06-11 10:56:40 +02:00
|
|
|
}
|
|
|
|
}
|
2024-06-13 01:44:28 +02:00
|
|
|
?>
|
|
|
|
|
2024-06-13 01:19:46 +02:00
|
|
|
<li class="dropdown">
|
|
|
|
<a href="/events">Évènements</a>
|
|
|
|
<ul class="dropdown-content">
|
2024-06-14 17:31:37 +02:00
|
|
|
<?php
|
|
|
|
if (isset($_COOKIE['userData'])) {
|
|
|
|
$role = $userData['role'];
|
|
|
|
if ($role == 'Administrateur') {
|
|
|
|
echo "<li><a href='/events/new'>Créer un nouvel évènement</a></li>";
|
|
|
|
echo "<li><a href='/events/list'>Liste des évènements</a></li>";
|
|
|
|
echo "<li><a href='/events/book'>S'inscrire à un évènement</a></li>";
|
|
|
|
} else if ($role == 'Sportif') {
|
|
|
|
echo "<li><a href='/events/participate'>Participer à un évènement</a></li>";
|
|
|
|
echo "<li><a href='/events/list'>Liste des évènements</a></li>";
|
|
|
|
echo "<li><a href='/events/book'>S'inscrire à un évènement</a></li>";
|
|
|
|
} else if ($role == "Organisateur") {
|
|
|
|
echo "<li><a href='/events/new'>Créer un nouvel évènement</a></li>";
|
|
|
|
echo "<li><a href='/events/list'>Liste des évènements</a></li>";
|
|
|
|
echo "<li><a href='/events/book'>S'inscrire à un évènement</a></li>";
|
|
|
|
} else if ($role == "Membre") {
|
|
|
|
echo "<li><a href='/events/list'>Liste des évènements</a></li>";
|
|
|
|
echo "<li><a href='/events/book'>S'inscrire à un évènement</a></li>";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
echo "<li><a href='/events/list'>Liste des évènements</a></li>";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2024-06-13 01:19:46 +02:00
|
|
|
</ul>
|
2024-05-28 15:40:57 +02:00
|
|
|
</li>
|
2024-06-16 01:22:30 +02:00
|
|
|
<?php
|
|
|
|
if (isset($_COOKIE['userData'])) {
|
|
|
|
$role = $userData['role'];
|
|
|
|
if ($role != 'Administrateur') {
|
|
|
|
echo "<li><a href='/account/profile/myevents'>Mes réservations</a></li>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2024-05-28 15:40:57 +02:00
|
|
|
</ul>
|
2024-06-13 01:44:28 +02:00
|
|
|
|
2024-05-28 15:40:57 +02:00
|
|
|
<ul>
|
2024-06-11 22:49:01 +02:00
|
|
|
<li><?php
|
|
|
|
if (isset($_COOKIE['userData'])) {
|
|
|
|
echo "<a href='/tools/logout.php' title='Déconnexion'><i class='fas fa-sign-out-alt'></i></a>";
|
|
|
|
}
|
|
|
|
?></li>
|
2024-05-28 15:40:57 +02:00
|
|
|
<li>
|
2024-06-10 23:23:51 +02:00
|
|
|
<?php
|
|
|
|
if (isset($_COOKIE['userData'])) {
|
2024-06-11 22:49:01 +02:00
|
|
|
//echo "<a href='/account/profile'>Mon profil</a>";
|
|
|
|
$userName = "" . $userData['name'] . " " . $userData['familyName'] . "";
|
|
|
|
echo "<a href='/account/profile'><img class='avatar' src='https://cdn-icons-png.flaticon.com/64/4139/4139948.png' title=" . $userName . "></a>";
|
|
|
|
//echo "<br>" . $userData['name'] . " " . $userData['familyName'];
|
2024-06-10 23:23:51 +02:00
|
|
|
} else {
|
|
|
|
echo "<a href='/account/login'>Connexion</a>";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
2024-05-28 15:40:57 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2024-06-11 22:49:01 +02:00
|
|
|
</nav>
|
|
|
|
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|