-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathreservation.php
161 lines (127 loc) · 5.38 KB
/
reservation.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
include_once('main.php');
if(check_login() != true) { exit; }
if(isset($_GET['make_reservation']))
{
$week = filter_string($_POST['week']);
$day = filter_string($_POST['day']);
$time = filter_string($_POST['time']);
echo make_reservation($week, $day, $time);
}
elseif(isset($_GET['delete_reservation']))
{
$week = filter_string($_POST['week']);
$day = filter_string($_POST['day']);
$time = filter_string($_POST['time']);
echo delete_reservation($week, $day, $time);
}
elseif(isset($_GET['read_reservation']))
{
$week = filter_string($_POST['week']);
$day = filter_string($_POST['day']);
$time = filter_string($_POST['time']);
echo read_reservation($week, $day, $time);
}
elseif(isset($_GET['read_reservation_details']))
{
$week = filter_string($_POST['week']);
$day = filter_string($_POST['day']);
$time = filter_string($_POST['time']);
echo read_reservation_details($week, $day, $time);
}
elseif(isset($_GET['week']))
{
//displays the reservation grid
$week = $_GET['week'];
$startofweek=date('W');
// $current=strftime('%A %e',$startofweek);
// echo $current;
$week_start = new DateTimeFrench();
$week_start->setISODate(global_year,$week);
// echo $week_start->format('d-M-Y');
// echo $week_start->format('l j F Y');
// $asint=$week_start->getTimestamp();
// $current=strftime('%A %e',$asint);
// echo $current;
echo '<table id="reservation_table"><colgroup span="1" id="reservation_time_colgroup"></colgroup><colgroup span="7" id="reservation_day_colgroup"></colgroup>';
$days_row = '<tr><td id="reservation_corner_td"><input type="button" class="blue_button small_button" id="reservation_today_button" value="Today"></td><th class="reservation_day_th">Monday</th><th class="reservation_day_th">Tuesday</th><th class="reservation_day_th">Wednesday</th><th class="reservation_day_th">Thursday</th><th class="reservation_day_th">Friday</th><th class="reservation_day_th">Saturday</th><th class="reservation_day_th">Sunday</th></tr>';
$days_row = '<tr>
<td id="reservation_corner_td"><input type="button" class="blue_button small_button" id="reservation_today_button" value="Today"></td> ';
$nb_days_to_display=7;
for($i=0;$i<$nb_days_to_display;$i++)
{
$day=$week_start->format('l j');
$week_start->add(new DateInterval('P1D'));
$days_row.= "<th class='reservation_day_th'>$day</th>";
}
// <th class="reservation_day_th">Lundi</th>
// <th class="reservation_day_th">Mardi</th>
// <th class="reservation_day_th">Mercredi</th>
// <th class="reservation_day_th">Jeudi</th>
// <th class="reservation_day_th">Vendredi</th>
// <th class="reservation_day_th">Samedi</th>
// <th class="reservation_day_th">Dimanche</th></tr>';
$days_row.= '</tr>';
if($week == global_week_number)
{
echo highlight_day($days_row);
}
else
{
echo $days_row;
}
foreach($global_times as $time) //tranches horaires
{
echo '<tr><th class="reservation_time_th">' . $time . '</th>';
$i = 0;
while($i <$nb_days_to_display)
{
$i++;
echo '<td><div class="reservation_time_div"><div class="reservation_time_cell_div" id="div:' . $week . ':' . $i . ':' . $time . '" onclick="void(0)">' . read_reservation($week, $i, $time) . '</div></div></td>';
}
echo '</tr>';
}
echo '</table>';
}
elseif(isset($_GET['weeknumber']))
{
$week = $_GET['weeknumber'];
//
// $week = global_week_number;
//
// $startofweek=date('W');
//
// $current=strftime('%A %e',$startofweek);
// echo $current;
$week_start = new DateTimeFrench();
$week_start->setISODate(global_year,$week);
// echo $week_start->format('d-M-Y');
// $wk= $week_start->format('l j F Y');
$wk= $week_start->format('F Y');
// $asint=$week_start->getTimestamp();
//
echo $week ." - $wk";
}
else
{
//entete de table
//
$week = global_week_number;
//
// $startofweek=date('W');
//
// $current=strftime('%A %e',$startofweek);
// echo $current;
$week_start = new DateTimeFrench();
$week_start->setISODate(global_year,$week);
// echo $week_start->format('d-M-Y');
// $wk= $week_start->format('l j F Y');
$wk= $week_start->format('F Y');
// $asint=$week_start->getTimestamp();
//
echo '</div><div class="box_div" id="reservation_div"><div class="box_top_div" id="reservation_top_div"><div id="reservation_top_left_div"><a href="." id="previous_week_a">< Semaine précédente</a></div>
<div id="reservation_top_center_div">Reservations pour la semaine <span id="week_number_span">' . global_week_number ." - $wk". '</span></div>
<div id="reservation_top_right_div"><a href="." id="next_week_a">Semaine suivante ></a></div></div>
<div class="box_body_div"><div id="reservation_table_div"></div></div></div><div id="reservation_details_div">';
}
?>