forked from SAWADOGO-AIME/Projet_tutore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetails.php
145 lines (132 loc) · 5.51 KB
/
details.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
if(isset($_GET['SalleNumero']))
{
try{
$id = $_GET['SalleNumero'];
require_once 'connexion_base_Donnee.php';
require_once 'functions.php';
$preparation = $connexion->prepare('SELECT * FROM salle WHERE id_salle=:id');
$preparation->bindValue(':id',$id,PDO::PARAM_INT);
$preparation->execute();
$resultat = $preparation->fetch(PDO::FETCH_ASSOC);
}
catch(Exception $e){
echo 'Erreur : '. $e->getMessage();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta Tags -->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Detail</title>
<link rel="stylesheet" href="style/header.css">
<link rel="stylesheet" href="style/footer.css">
<link rel="stylesheet" href="style/details.css">
</head>
<body>
<!-- Header -->
<?php
require_once 'header.php';
?>
<div id="div_central">
<h2>Détails sur la salle :
<span><?= htmlspecialchars($resultat['nom_salle'])?></span>
</h2>
<div id="bloc_detail">
<div>
<p><strong>Nom:</strong> <span class="highlight"> <?= htmlspecialchars($resultat['nom_salle'])?></span></p>
<p><strong>Site:</strong> <span class="highlight"> <?= htmlspecialchars($resultat['emplacement'])?></span></p>
<p><strong>Etat:</strong> <span class="highlight"> <?= htmlspecialchars($resultat['salle_disponible'])?></span></p>
<p><strong>Capacité maximale:</strong> <span class="highlight"> <?= htmlspecialchars($resultat['nombre_places'])?></span></p>
<p><strong>Équipement:</strong> <span class="highlight"> Projecteur, micro</span></p>
</div>
<div id="image">
<img src="img/PhotodesalleMachine.png" alt="Salle machine">
</div>
</div>
</div>
<div class="calendar-section">
<h2>Calendrier d'occupation</h2>
<div id="calendar"></div>
<div class="reserve-button">
<?php
if(isset($_GET['SalleNumero'])){
echo '<a href="reservation_rapide.php?SalleNumero='. htmlspecialchars($_GET['SalleNumero']) .'"><button>Réserver</button></a>';
}
else{
echo '<a href="#"><button>📅 Reserver</button></a>';
}
?>
</div>
</div>
<!-- FullCalendar CSS -->
<link href='https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.css' rel='stylesheet' />
<!-- FullCalendar JS -->
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.js'></script>
<?php
if(isset($_GET['SalleNumero']))
{
try{
$preparation = $connexion->prepare("
SELECT reservation.jour_reserver, reservation.heure_debut, reservation.heure_fin
FROM reservation
WHERE reservation.id_salle=:id_salle;
");
$preparation->bindValue(':id_salle',$_GET['SalleNumero'],PDO::PARAM_INT);
$preparation->execute();
$resultatPOURcal = $preparation->fetchall(PDO::FETCH_ASSOC);
}catch(Exception $e){
echo 'Erreur : '. $e->getMessage();
}
}
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'dayGridMonth',
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
},
initialDate: '2024-08-30', // The date to display when the calendar is first rendered
navLinks: true, // can click day/week names to navigate views
editable: true,
selectable: true,
events: [
<?php
foreach ($resultatPOURcal as $colonne)
{
echo "{";
echo "title: 'Résever',";
echo "start : '". htmlspecialchars($colonne['jour_reserver']) ."T". htmlspecialchars($colonne['heure_debut']) ."',";
echo "end : '". htmlspecialchars($colonne['jour_reserver']) ."T". htmlspecialchars($colonne['heure_fin']) ."',";
echo "},";
}
?>
]
});
calendar.render();
});
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const toggleMenuButton = document.getElementById('toggleButton');
const menu = document.querySelector('.menu');
if (toggleMenuButton && menu) {
toggleMenuButton.addEventListener('click', function() {
menu.classList.toggle('active');
});
}
});
</script>
<?php
require_once 'footer.php';
?>
</body>
</html>