-
Notifications
You must be signed in to change notification settings - Fork 0
/
professeur.php
98 lines (87 loc) · 2.21 KB
/
professeur.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
<?php
//todo verif connection
//todo GET("err") pour erreure de réservation/déreservation
include_once("gestionoutils.php");
session_start();
$reservationUser = get_reservation_prof($_SESSION["id"]);
function GetData() : array
{
return liste_reservations();
}
function DisplayReservationList($data , $reservationUser)
{
$itemCount = count($data);
echo "
<div class='conteneur-table'>
<div class='table'>
<table class='styled-table'>
<thead>
<tr>
<th colspan='2'>Libéllé</th>
</tr>
</thead>
<tbody>";
for($i = 0; $i < $itemCount; $i++)
{
$outils = $data[$i][0];
$id = $data[$i][3];
echo "
<tr>
<td>$outils</td>";
if(!$reservationUser)
{
echo "
<td>
<button onclick='reserver(\"$outils\", \"$id\")'>Réserver</button>
</td>";
}
echo "
</tr>
";
}
if($reservationUser)
{
echo "
<tr>
<td>$reservationUser[0]</td>
<td>
<button onclick='rendre(\"$reservationUser[0]\", \"$reservationUser[1]\")'>Rendre</button>
</td>
</tr>
";
}
echo "
</tbody>
</table>
</div>
</div>
";
}
?>
<!DOCTYPE html>
<html lang='fr'>
<head>
<meta charset='UTF-8'>
<title>Mes outils</title>
<link rel='stylesheet' href='css/bootstrap.css'>
<link rel='stylesheet' href='css/adminTemplates.css'>
<link rel="icon" type="image/png" href="img/logo.png"/>
<script>
function reserver(outils, id)
{
if(confirm("Êtes-vous sûr de vouloir réserver " + outils + " ?"))
location.href ="actionProf.php?reservation=" + id;
}
function rendre(outils, id)
{
if(confirm("Êtes-vous sûr de vouloir rendre " + outils + " ?"))
location.href ="actionProf.php?annulation=" + id;
}
</script>
</head>
<body>
<?php
include("header.php");
DisplayReservationList(GetData(), $reservationUser);?>
</body>
</html>