-
Notifications
You must be signed in to change notification settings - Fork 2
/
day.php
743 lines (664 loc) · 32.6 KB
/
day.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
<?php
/**
* day.php
* Permet l'affichage de la page d'accueil lorsque l'on est en mode d'affichage "jour".
* Ce script fait partie de l'application GRR
* Dernière modification : $Date: 2009-12-02 20:11:07 $
* @author Laurent Delineau <[email protected]>
* @copyright Copyright 2003-2008 Laurent Delineau
* @link http://www.gnu.org/licenses/licenses.html
* @package root
* @version $Id: day.php,v 1.20 2009-12-02 20:11:07 grr Exp $
* @filesource
*
* This file is part of GRR.
*
* GRR is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GRR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRR; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* $Log: day.php,v $
* Revision 1.20 2009-12-02 20:11:07 grr
* *** empty log message ***
*
* Revision 1.19 2009-10-09 07:55:48 grr
* *** empty log message ***
*
* Revision 1.18 2009-09-29 18:02:56 grr
* *** empty log message ***
*
* Revision 1.17 2009-04-14 12:59:17 grr
* *** empty log message ***
*
* Revision 1.16 2009-04-09 14:52:31 grr
* *** empty log message ***
*
* Revision 1.15 2009-03-24 13:30:07 grr
* *** empty log message ***
*
* Revision 1.14 2009-02-27 22:05:03 grr
* *** empty log message ***
*
* Revision 1.13 2009-01-28 16:01:31 grr
* *** empty log message ***
*
* Revision 1.12 2009-01-20 07:19:17 grr
* *** empty log message ***
*
* Revision 1.11 2008-11-16 22:00:58 grr
* *** empty log message ***
*
* Revision 1.10 2008-11-14 07:29:09 grr
* *** empty log message ***
*
* Revision 1.9 2008-11-13 21:32:51 grr
* *** empty log message ***
*
* Revision 1.8 2008-11-11 22:01:14 grr
* *** empty log message ***
*
* Revision 1.7 2008-11-10 08:17:34 grr
* *** empty log message ***
*
* Revision 1.6 2008-11-10 07:06:39 grr
* *** empty log message ***
*
*
*/
include "include/connect.inc.php";
include "include/config.inc.php";
include "include/misc.inc.php";
include "include/mrbs_sql.inc.php";
include "include/functions.inc.php";
include "include/$dbsys.inc.php";
include "include/mincals.inc.php";
$grr_script_name = "day.php";
#Paramètres de connection
require_once("./include/settings.inc.php");
#Chargement des valeurs de la table settings
if (!loadSettings())
die("Erreur chargement settings");
#Fonction relative à la session
require_once("./include/session.inc.php");
#Si nous ne savons pas la date, nous devons la créer
$date_now = time();
if (!isset($day) or !isset($month) or !isset($year))
{
if ($date_now < getSettingValue("begin_bookings"))
$date_ = getSettingValue("begin_bookings");
else if ($date_now > getSettingValue("end_bookings"))
$date_ = getSettingValue("end_bookings");
else
$date_ = $date_now;
$day = date("d",$date_);
$month = date("m",$date_);
$year = date("Y",$date_);
} else
{
// Vérification des dates
settype($month,"integer");
settype($day,"integer");
settype($year,"integer");
$minyear = strftime("%Y", getSettingValue("begin_bookings"));
$maxyear = strftime("%Y", getSettingValue("end_bookings"));
if ($day < 1) $day = 1;
if ($day > 31) $day = 31;
if ($month < 1) $month = 1;
if ($month > 12) $month = 12;
if ($year < $minyear) $year = $minyear;
if ($year > $maxyear) $year = $maxyear;
#Si la date n'est pas valide, ils faut la modifier (Si le nombre de jours est suppérieur au nombre de jours dans un mois)
while (!checkdate($month, $day, $year))
$day--;
}
// Resume session
if (!grr_resumeSession()) {
if ((getSettingValue("authentification_obli")==1) or ((getSettingValue("authentification_obli")==0) and (isset($_SESSION['login'])))) {
header("Location: ./logout.php?auto=1&url=$url");
die();
}
};
// Construction des identifiants de la ressource $room, du domaine $area, du site $id_site
Definition_ressource_domaine_site();
// Paramètres langage
include "include/language.inc.php";
// On affiche le lien "format imprimable" en bas de la page
$affiche_pview = '1';
if (!isset($_GET['pview'])) $_GET['pview'] = 0; else $_GET['pview'] = 1;
if ($_GET['pview'] == 1)
$class_image = "print_image";
else
$class_image = "image";
$back = '';
if (isset($_SERVER['HTTP_REFERER'])) $back = my_htmlspecialcharacters($_SERVER['HTTP_REFERER']);
if ((getSettingValue("authentification_obli")==0) and (getUserName()=='')) {
$type_session = "no_session";
} else {
$type_session = "with_session";
}
// Récupération des données concernant l'affichage du planning du domaine
get_planning_area_values($area);
// Si aucun domaine n'est défini
if ($area <= 0) {
print_header($day, $month, $year, $area,$type_session);
echo "<h1>".get_vocab("noareas")."</h1>";
echo "<a href='admin_accueil.php'>".get_vocab("admin")."</a>\n
</body>
</html>";
exit();
}
if((authGetUserLevel(getUserName(),-1) < 1) and (getSettingValue("authentification_obli")==1))
{
showAccessDenied($day, $month, $year, $area,$back);
exit();
}
if(authUserAccesArea(getUserName(), $area)==0)
{
showAccessDenied($day, $month, $year, $area,$back);
exit();
}
if (check_begin_end_bookings($day, $month, $year))
{
showNoBookings($day, $month, $year, $area,$back,$type_session);
exit();
}
// On vérifie une fois par jour si le délai de confirmation des réservations est dépassé
// Si oui, les réservations concernées sont supprimées et un mail automatique est envoyé.
// On vérifie une fois par jour que les ressources ont été rendue en fin de réservation
// Si non, une notification email est envoyée
if (getSettingValue("verif_reservation_auto")==0) {
verify_confirm_reservation();
verify_retard_reservation();
}
# print the page header
print_header($day, $month, $year, $area, $type_session);
// Si format imprimable ($_GET['pview'] = 1), on n'affiche pas cette partie
if ($_GET['pview'] != 1) {
echo "<table width=\"100%\" cellspacing=\"15\"><tr>\n";
if (isset($_SESSION['default_list_type']) or (getSettingValue("authentification_obli")==1)) {
$area_list_format = $_SESSION['default_list_type'];
} else {
$area_list_format = getSettingValue("area_list_format");
}
if ($area) {
$sql = "select filter_empty_resources from ".TABLE_PREFIX."_area where id='".protect_data_sql($area)."'";
$row = grr_sql_row(grr_sql_query($sql), 0);
$hide_empty_resources = $row[0] == 1 ? true : false;
} else {
$hide_empty_resources = false;
}
# Sélection des sites, domaines et ressources
if ($area_list_format != "list") {
# Sélection sous la forme de listes déroulantes
echo "<td>\n";
echo make_site_select_html('day.php',$id_site,$year,$month,$day,getUserName());
echo make_area_select_html('day.php',$id_site,$area,$year,$month,$day,getUserName());
echo make_room_select_html('week',$area,"",$year,$month,$day);
echo "</td>\n";
} else {
# Sélection sous la forme de listes
echo "<td>\n";
echo make_site_list_html('day.php',$id_site,$year,$month,$day,getUserName());
echo "</td><td>";
echo make_area_list_html('day.php',$id_site,$area,$year,$month,$day,getUserName());
echo "</td><td>";
// Faut-il forcer le mode liste déroulante pour le domaine sélectionné ?
if ($hide_empty_resources) {
echo make_room_select_html('week',$area,"",$year,$month,$day);
} else {
make_room_list_html('week.php',$area,"",$year,$month,$day);
}
echo "</td>";
}
#Affichage des calendriers
minicals($year, $month, $day, $area, -1, 'day');
echo "</tr></table>";
// fin de la condition "Si format imprimable"
}
#y? are year, month and day of yesterday
#t? are year, month and day of tomorrow
$ind = 1;
$test = 0;
while (($test == 0) and ($ind <= 7)) {
$i= mktime(0,0,0,$month,$day-$ind,$year);
$test =$display_day[date("w",$i)];
$ind++;
}
$yy = date("Y",$i);
$ym = date("m",$i);
$yd = date("d",$i);
$i= mktime(0,0,0,$month,$day,$year);
$jour_cycle = grr_sql_query1("SELECT Jours FROM ".TABLE_PREFIX."_calendrier_jours_cycle WHERE DAY='$i'");
$ind = 1;
$test = 0;
while (($test == 0) and ($ind <= 7)) {
$i= mktime(0,0,0,$month,$day+$ind,$year);
$test =$display_day[date("w",$i)];
$ind++;
}
$ty = date("Y",$i);
$tm = date("m",$i);
$td = date("d",$i);
# Define the start and end of the day.
$am7=mktime($morningstarts,0,0,$month,$day,$year);
$pm7=mktime($eveningends,$eveningends_minutes,0,$month,$day,$year);
#Show current date
$this_area_name = grr_sql_query1("select area_name from ".TABLE_PREFIX."_area where id='".protect_data_sql($area)."'");
echo "<div class=\"titre_planning\">" . ucfirst(utf8_strftime($dformat, $am7));
if (getSettingValue("jours_cycles_actif") == "Oui" and intval($jour_cycle)>-1)
if (intval($jour_cycle)>0)
echo " - ".get_vocab("rep_type_6")." ".$jour_cycle;
else
echo " - ".$jour_cycle;
echo "<br />".ucfirst($this_area_name)." - ".get_vocab("all_areas")."</div>\n";
// Si format imprimable ($_GET['pview'] = 1), on n'affiche pas cette partie
if ($_GET['pview'] != 1) {
#Show Go to day before and after links
echo "<table width=\"100%\"><tr>\n<td>\n<a href=\"day.php?year=$yy&month=$ym&day=$yd&area=$area\"><< ".get_vocab('daybefore')."</a></td>\n<td align=\"right\"><a href=\"day.php?year=$ty&month=$tm&day=$td&area=$area\">".get_vocab('dayafter')." >></a></td>\n</tr></table>\n";
}
#We want to build an array containing all the data we want to show
#and then spit it out.
#Get all appointments for today in the area that we care about
#Note: The predicate clause 'start_time <= ...' is an equivalent but simpler
#form of the original which had 3 BETWEEN parts. It selects all entries which
#occur on or cross the current day.
$sql = "SELECT ".TABLE_PREFIX."_room.id, start_time, end_time, name, ".TABLE_PREFIX."_entry.id, type, beneficiaire, statut_entry, ".TABLE_PREFIX."_entry.description, ".TABLE_PREFIX."_entry.option_reservation, ".TABLE_PREFIX."_entry.moderate, beneficiaire_ext
FROM ".TABLE_PREFIX."_entry, ".TABLE_PREFIX."_room
WHERE ".TABLE_PREFIX."_entry.room_id = ".TABLE_PREFIX."_room.id
AND area_id = '".protect_data_sql($area)."'
AND start_time < ".($pm7+$resolution)." AND end_time > $am7 ORDER BY start_time";
$res = grr_sql_query($sql);
if (! $res) {
// fatal_error(0, grr_sql_error());
include "include/trailer.inc.php";
exit;
}
for ($i = 0; ($row = grr_sql_row($res, $i)); $i++) {
# Each row weve got here is an appointment.
#Row[0] = Room ID
#row[1] = start time
#row[2] = end time
#row[3] = short description
#row[4] = id of this booking
#row[5] = type (internal/external)
#row[6] = identifiant du réservant
#row[7] = satut of the booking
#row[8] = Full description
#row[9] = option_reservation
#row[10] = état de modération de la réservation
#row[11] = bénéficiaire extérieur
# $today is a map of the screen that will be displayed
# It looks like:
# $today[Room ID][Time][id]
# [color]
# [data]
# Fill in the map for this meeting. Start at the meeting start time,
# or the day start time, whichever is later. End one slot before the
# meeting end time (since the next slot is for meetings which start then),
# or at the last slot in the day, whichever is earlier.
# Note: int casts on database rows for max may be needed for PHP3.
# Adjust the starting and ending times so that bookings which don't
# start or end at a recognized time still appear.
$start_t = max(round_t_down($row[1], $resolution, $am7), $am7);
$end_t = min(round_t_up($row[2], $resolution, $am7) - $resolution, $pm7);
// Calcul du nombre de créneaux qu'occupe la réservation
$cellules[$row[4]]=($end_t-$start_t)/$resolution+1;
// Initialisation du compteur
$compteur[$row[4]]=0;
for ($t = $start_t; $t <= $end_t; $t += $resolution)
{
$today[$row[0]][$t]["id"] = $row[4];
$today[$row[0]][$t]["color"] = $row[5];
$today[$row[0]][$t]["data"] = "";
$today[$row[0]][$t]["who"] = "";
$today[$row[0]][$t]["statut"] = $row[7];
$today[$row[0]][$t]["moderation"] = $row[10];
$today[$row[0]][$t]["option_reser"] = $row[9];
// Construction des infos à afficher sur le planning
$today[$row[0]][$t]["description"] = affichage_resa_planning($row[8],$row[4]);
}
# Show the name of the booker in the first segment that the booking
# happens in, or at the start of the day if it started before today.
if ($row[1] < $am7) {
$today[$row[0]][$am7]["data"] = affichage_lien_resa_planning($row[3],$row[4]);
// Info-bulle
if (getSettingValue("display_info_bulle") == 1)
$today[$row[0]][$am7]["who"] = get_vocab("reservation au nom de").affiche_nom_prenom_email($row[6],$row[11],"nomail");
else if (getSettingValue("display_info_bulle") == 2)
$today[$row[0]][$am7]["who"] = $row[8];
else
$today[$row[0]][$am7]["who"] = "";
} else {
$today[$row[0]][$start_t]["data"] = affichage_lien_resa_planning($row[3],$row[4]);
// Info-bulle
if (getSettingValue("display_info_bulle") == 1)
$today[$row[0]][$start_t]["who"] = get_vocab("reservation au nom de").affiche_nom_prenom_email($row[6],$row[11]);
else if (getSettingValue("display_info_bulle") == 2)
$today[$row[0]][$start_t]["who"] = $row[8];
else
$today[$row[0]][$start_t]["who"] = "";
}
}
grr_sql_free($res);
# We need to know what all the rooms area called, so we can show them all
# pull the data from the db and store it. Convienently we can print the room
# headings and capacities at the same time
$sql = "select room_name, capacity, id, description, statut_room, show_fic_room, delais_option_reservation, moderate from ".TABLE_PREFIX."_room where area_id='".protect_data_sql($area)."' order by order_display, room_name";
$res = grr_sql_query($sql);
# It might be that there are no rooms defined for this area.
# If there are none then show an error and dont bother doing anything
# else
if (! $res) fatal_error(0, grr_sql_error());
if (grr_sql_count($res) == 0)
{
echo "<h1>".get_vocab('no_rooms_for_area')."</h1>";
grr_sql_free($res);
}
else
{
#This is where we start displaying stuff
echo "<table cellspacing=\"0\" border=\"1\" width=\"100%\">";
// Première ligne du tableau
echo "<tr>\n<th style=\"width:5%;\"> </th>";
$tab[1][] = " ";
$room_column_width = (int)(90 / grr_sql_count($res));
$nbcol = 0;
$rooms = array();
for ($i = 0; ($row = grr_sql_row($res, $i)); $i++)
{
$id_room[$i] = $row[2];
$nbcol++;
// On affiche pas toutes les ressources
if (verif_acces_ressource(getUserName(), $id_room[$i]) and (!$hide_empty_resources || $today[$id_room[$i]])) {
$room_name[$i] = $row[0];
$statut_room[$id_room[$i]] = $row[4];
$statut_moderate[$id_room[$i]] = $row[7];
// Calcul du niveau d'accès aux fiche de réservation détaillées des ressources
$acces_fiche_reservation = verif_acces_fiche_reservation(getUserName(), $id_room[$i]);
if ($row[1]) {
$temp = "<br /><span class=\"small\">($row[1] ".($row[1] >1 ? get_vocab("number_max2") : get_vocab("number_max")).")</span>";
} else {
$temp="";
}
if ($statut_room[$id_room[$i]] == "0") $temp .= "<br /><span class=\"texte_ress_tempo_indispo\">".get_vocab("ressource_temporairement_indisponible")."</span>"; // Ressource temporairement indisponible
if ($statut_moderate[$id_room[$i]] == "1") $temp .= "<br /><span class=\"texte_ress_moderee\">".get_vocab("reservations_moderees")."</span>"; // Ressource modérée
echo "<th style=\"width:$room_column_width%;\" ";
// Si la ressource est temporairement indisponible, on le signale
if ($statut_room[$id_room[$i]] == "0") echo " class='avertissement' ";
echo ">" . my_htmlspecialcharacters($row[0])."\n";
if (my_htmlspecialcharacters($row[3]. $temp != '')) {
if (my_htmlspecialcharacters($row[3] != '')) $saut = "<br />"; else $saut = "";
echo $saut.my_htmlspecialcharacters($row[3]) . $temp."\n";
}
echo "<br />";
if (verif_display_fiche_ressource(getUserName(), $id_room[$i]) and $_GET['pview'] != 1)
echo "<a href='javascript:centrerpopup(\"view_room.php?id_room=$id_room[$i]\",600,480,\"scrollbars=yes,statusbar=no,resizable=yes\")' title=\"".get_vocab("fiche_ressource")."\">
<img src=\"img_grr/details.png\" alt=\"détails\" class=\"".$class_image."\" /></a>";
if (authGetUserLevel(getUserName(),$id_room[$i]) > 2 and $_GET['pview'] != 1)
echo "<a href='admin_edit_room.php?room=$id_room[$i]'><img src=\"img_grr/editor.png\" alt=\"configuration\" title=\"".get_vocab("Configurer la ressource")."\" width=\"30\" height=\"30\" class=\"".$class_image."\" /></a>";
// La ressource est-elle empruntée ?
affiche_ressource_empruntee($id_room[$i]);
echo "</th>";
// stockage de la première ligne :
$tab[1][$i+1] = my_htmlspecialcharacters($row[0]);
if (my_htmlspecialcharacters($row[3]. $temp != '')) {
if (my_htmlspecialcharacters($row[3] != '')) $saut = "<br />"; else $saut = "";
$tab[1][$i+1] .="<br />-".$saut."<i><span class =\"small\">". my_htmlspecialcharacters($row[3]) . $temp."\n</span></i>";
}
$tab[1][$i+1] .= "<br />";
if (verif_display_fiche_ressource(getUserName(), $id_room[$i]))
$tab[1][$i+1] .= "<a href='javascript:centrerpopup(\"view_room.php?id_room=$id_room[$i]\",600,480,\"scrollbars=yes,statusbar=no,resizable=yes\")' title=\"".get_vocab("fiche_ressource")."\">
<img src=\"img_grr/details.png\" alt=\"détails\" class=\"".$class_image."\" /></a>";
if (authGetUserLevel(getUserName(),$id_room[$i]) > 2 and $_GET['pview'] != 1)
$tab[1][$i+1] .= "<a href='admin_edit_room.php?room=$id_room[$i]'><img src=\"img_grr/editor.png\" alt=\"configuration\" title=\"".get_vocab("Configurer la ressource")."\" width=\"30\" height=\"30\" class=\"".$class_image."\" /></a>";
// fin stockage de la première ligne :
$rooms[] = $row[2];
$delais_option_reservation[$row[2]] = $row[6];
}
}
// On arrête si on n'a pas les droits d'accès
if (count($rooms)==0 and !$hide_empty_resources) {
echo "<br /><h1>".get_vocab("droits_insuffisants_pour_voir_ressources")."</h1><br />";
include "include/trailer.inc.php";
exit;
// Idem si on n'affiche pas les ressources sans réservations
} else if (count($rooms)==0 and $hide_empty_resources) {
echo "<br /><h1>".get_vocab("nothing_found")."</h1><br />";
include "include/trailer.inc.php";
exit;
}
echo "<th style=\"width:5%;\"> </th></tr>\n";
$tab[1][] = " ";
// Deuxième ligne et lignes suivantes du tableau
echo "<tr>\n";
tdcell("cell_hours");
if ($enable_periods == 'y')
echo get_vocab('period');
else
echo get_vocab('time');
echo "</td>\n";
if ($enable_periods == 'y')
$tab[2][] = get_vocab('period');
else
$tab[2][] = get_vocab('time');
for ($i = 0; $i < $nbcol; $i++)
{
// On affiche pas toutes les ressources
if (verif_acces_ressource(getUserName(), $id_room[$i]) and (!$hide_empty_resources || $today[$id_room[$i]])) {
// Si la ressource est temporairement indisponible, on le signale, sinon, couleur normale
if ($statut_room[$id_room[$i]] == "0") tdcell("avertissement"); else tdcell("cell_hours");
if ($_GET['pview'] != 1)
echo "<a title=\"".my_htmlspecialcharacters(get_vocab("see_week_for_this_room"))."\" href=\"week.php?year=$year&month=$month&day=$day&room=$id_room[$i]\">".get_vocab("week")."</a><br /><a title=\"".my_htmlspecialcharacters(get_vocab("see_month_for_this_room"))."\" href=\"month.php?year=$year&month=$month&day=$day&room=$id_room[$i]\">".get_vocab("month")."</a>";
if ($_GET['pview'] != 1)
$tab[2][] = "<a title=\"".my_htmlspecialcharacters(get_vocab("see_week_for_this_room"))."\" href=\"week.php?year=$year&month=$month&day=$day&room=$id_room[$i]\">".get_vocab("week")."</a><br /><a title=\"".my_htmlspecialcharacters(get_vocab("see_month_for_this_room"))."\" href=\"month.php?year=$year&month=$month&day=$day&room=$id_room[$i]\">".get_vocab("month")."</a>";
else
$tab[2][] = "";
echo "</td>\n";
}
}
tdcell("cell_hours");
if ($enable_periods == 'y')
echo get_vocab('period');
else
echo get_vocab('time');
if ($enable_periods == 'y')
$tab[2][] = get_vocab('period');
else
$tab[2][] = get_vocab('time');
echo "</td>\n</tr>\n";
$tab_ligne = 3;
// Début première boucle sur le temps
for ($t = $am7; $t <= $pm7; $t += $resolution)
{
# Show the time linked to the URL for highlighting that time
echo "<tr>\n";
tdcell("cell_hours");
if( $enable_periods == 'y' ){
$time_t = date("i", $t);
$time_t_stripped = preg_replace( "/^0/", "", $time_t );
echo $periods_name[$time_t_stripped] . "</td>\n";
$tab[$tab_ligne][] = $periods_name[$time_t_stripped];
} else {
echo affiche_heure_creneau($t,$resolution)."</td>\n";
$tab[$tab_ligne][] = affiche_heure_creneau($t,$resolution);
}
// Début Deuxième boucle sur la liste des ressources du domaine
while (list($key, $room) = each($rooms))
{
// On affiche pas toutes les ressources
if (verif_acces_ressource(getUserName(), $room)) {
if(isset($today[$room][$t]["id"])) // il y a une réservation sur le créneau
{
$id = $today[$room][$t]["id"];
$color = $today[$room][$t]["color"];
$descr = $today[$room][$t]["data"];
}
else
unset($id); // $id non défini signifie donc qu'il n'y a pas de résa sur le créneau
// Définition des couleurs de fond de cellule
if ((isset($id)) and (!est_hors_reservation(mktime(0,0,0,$month,$day,$year),$area))) // 1er cas : il y a une réservation sur le créneau
{
$c = $color;
} else if ($statut_room[$room] == "0") // 2ème cas : ou bien la ressource est temporairement indisponible
$c = "avertissement"; // on le signale par une couleur spécifique
else // 3ème cas : sinon, il s'agit d'un créneau libre
$c = "empty_cell";
// S'il s'agit d'un créneau avec une resa :
// s'il s'agit du premier passage ($compteur[$id]=0), on fait un tdcell_rowspan
// Sinon, pas de <td>
if ((isset($id)) and (!est_hors_reservation(mktime(0,0,0,$month,$day,$year),$area))) {
if( $compteur[$id] == 0 ) {
// Y-a-il chevauchement de deux blocs dans le cas où la hauteur du bloc est supérieure à 1 ?
if ($cellules[$id] != 1) {
// Dans ce cas, on s'intéresse à la dernière ligne du bloc
if(isset($today[$room][$t+($cellules[$id]-1)*$resolution]["id"])) {
// Il y a chevaussement seulement si l'id correspondant est différent de l'id actuel
$id_derniere_ligne_du_bloc = $today[$room][$t+($cellules[$id]-1)*$resolution]["id"];
// Dan ce cas, on réduit la taille du bloc pour éviter le chevaussement
if ($id_derniere_ligne_du_bloc != $id) $cellules[$id] = $cellules[$id]-1;
}
}
tdcell_rowspan ($c, $cellules[$id]);
}
$compteur[$id] = 1; // on incrémente le compteur initialement à zéro
} else
tdcell ($c); // il s'agit d'un créneau libre -> <td> normal
// Si $compteur[$id] a atteint == $cellules[$id]+1
if ((!isset($id)) or (est_hors_reservation(mktime(0,0,0,$month,$day,$year),$area))) // Le créneau est libre
{
$hour = date("H",$t);
$minute = date("i",$t);
$date_booking = mktime($hour, $minute, 0, $month, $day, $year);
if (est_hors_reservation(mktime(0,0,0,$month,$day,$year),$area)) {
echo "<img src=\"img_grr/stop.png\" alt=\"".get_vocab("reservation_impossible")."\" title=\"".get_vocab("reservation_impossible")."\" width=\"16\" height=\"16\" class=\"".$class_image."\" />";
$tab[$tab_ligne][] = "<img src=\"img_grr/stop.png\" alt=\"".get_vocab("reservation_impossible")."\" title=\"".get_vocab("reservation_impossible")."\" width=\"16\" height=\"16\" class=\"".$class_image."\" />";
} else
if (((authGetUserLevel(getUserName(),-1) > 1) or (auth_visiteur(getUserName(),$room) == 1))
and (UserRoomMaxBooking(getUserName(), $room, 1) != 0)
and verif_booking_date(getUserName(), -1, $room, $date_booking, $date_now, $enable_periods)
and verif_delais_max_resa_room(getUserName(), $room, $date_booking)
and verif_delais_min_resa_room(getUserName(), $room, $date_booking)
and (($statut_room[$room] == "1") or
(($statut_room[$room] == "0") and (authGetUserLevel(getUserName(),$room) > 2) ))
and $_GET['pview'] != 1) {
if ($enable_periods == 'y') {
echo "<a href=\"edit_entry.php?room=$room&period=$time_t_stripped&year=$year&month=$month&day=$day&page=day\" title=\"".get_vocab("cliquez_pour_effectuer_une_reservation")."\" ><img src=\"img_grr/new.png\" alt=\"".get_vocab("add")."\" width=\"16\" height=\"16\" class=\"".$class_image."\" /></a>";
$tab[$tab_ligne][] = "<a href=\"edit_entry.php?room=$room&period=$time_t_stripped&year=$year&month=$month&day=$day&page=day\" title=\"".get_vocab("cliquez_pour_effectuer_une_reservation")."\" ><img src=\"img_grr/new.png\" class=\"".$class_image."\" alt=\"".get_vocab("add")."\" width=\"16\" height=\"16\" /></a>";
} else {
echo "<a href=\"edit_entry.php?room=$room&hour=$hour&minute=$minute&year=$year&month=$month&day=$day&page=day\" title=\"".get_vocab("cliquez_pour_effectuer_une_reservation")."\" ><img src=\"img_grr/new.png\" class=\"".$class_image."\" alt=\"".get_vocab("add")."\" /></a>";
$tab[$tab_ligne][] = "<a href=\"edit_entry.php?room=$room&hour=$hour&minute=$minute&year=$year&month=$month&day=$day&page=day\" title=\"".get_vocab("cliquez_pour_effectuer_une_reservation")."\" ><img src=\"img_grr/new.png\" class=\"".$class_image."\" alt=\"".get_vocab("add")."\" /></a>";
}
} else {
echo " ";
$tab[$tab_ligne][] = " ";
}
echo "</td>\n";
}
elseif ($descr != "")
{
// si la réservation est "en cours", on le signale
if ((isset($today[$room][$t]["statut"])) and ($today[$room][$t]["statut"]!='-')) {
echo " <img src=\"img_grr/buzy.png\" alt=\"".get_vocab("ressource actuellement empruntee")."\" title=\"".get_vocab("ressource actuellement empruntee")."\" width=\"20\" height=\"20\" class=\"image\" /> \n";
$tab[$tab_ligne][] = " <img src=\"img_grr/buzy.png\" alt=\"".get_vocab("ressource actuellement empruntee")."\" title=\"".get_vocab("ressource actuellement empruntee")."\" width=\"20\" height=\"20\" class=\"image\" /> \n";
}
// si la réservation est à confirmer, on le signale
if (($delais_option_reservation[$room] > 0) and (isset($today[$room][$t]["option_reser"])) and ($today[$room][$t]["option_reser"]!=-1)) {
echo " <img src=\"img_grr/small_flag.png\" alt=\"".get_vocab("reservation_a_confirmer_au_plus_tard_le")."\" title=\"".get_vocab("reservation_a_confirmer_au_plus_tard_le")." ".time_date_string_jma($today[$room][$t]["option_reser"],$dformat)."\" width=\"20\" height=\"20\" class=\"image\" /> \n";
$tab[$tab_ligne][] = " <img src=\"img_grr/small_flag.png\" alt=\"".get_vocab("reservation_a_confirmer_au_plus_tard_le")."\" title=\"".get_vocab("reservation_a_confirmer_au_plus_tard_le")." ".time_date_string_jma($today[$room][$t]["option_reser"],$dformat)."\" width=\"20\" height=\"20\" class=\"image\" /> \n";
}
// si la réservation est à modérer, on le signale
if ((isset($today[$room][$t]["moderation"])) and ($today[$room][$t]["moderation"]=='1')) {
echo " <img src=\"img_grr/flag_moderation.png\" alt=\"".get_vocab("en_attente_moderation")."\" title=\"".get_vocab("en_attente_moderation")."\" class=\"image\" /> \n";
$tab[$tab_ligne][] = " <img src=\"img_grr/flag_moderation.png\" alt=\"".get_vocab("en_attente_moderation")."\" title=\"".get_vocab("en_attente_moderation")."\" class=\"image\" /> \n";
}
#if it is booked then show
if (($statut_room[$room] == "1") or
(($statut_room[$room] == "0") and (authGetUserLevel(getUserName(),$room) > 2) )) {
if ($acces_fiche_reservation) {
echo " <a title=\"".my_htmlspecialcharacters($today[$room][$t]["who"])."\" href=\"view_entry.php?id=$id&day=$day&month=$month&year=$year&page=day\">$descr</a>";
$tab[$tab_ligne][] = " <a title=\"".my_htmlspecialcharacters($today[$room][$t]["who"])."\" href=\"view_entry.php?id=$id&day=$day&month=$month&year=$year&page=day\">$descr</a>";
} else {
echo " $descr";
$tab[$tab_ligne][] = " $descr";
}
if ($today[$room][$t]["description"]!= "") {
echo "<br /><i>".$today[$room][$t]["description"]."</i>";
$tab[$tab_ligne][] = "<br /><i>".$today[$room][$t]["description"]."</i>";
}
} else {
echo " $descr";
$tab[$tab_ligne][] = " $descr";
}
echo "</td>\n";
}
}
} // Fin Deuxième boucle sur la liste des ressources du domaine
// Répétition de la première colonne
// Si la ressource est temporairement indisponible, on le signale, sinon, couleur normale
tdcell("cell_hours");
if( $enable_periods == 'y' ){
$time_t = date("i", $t);
$time_t_stripped = preg_replace( "/^0/", "", $time_t );
echo $periods_name[$time_t_stripped] . "</td>\n";
$tab[$tab_ligne][] = $periods_name[$time_t_stripped];
} else {
echo affiche_heure_creneau($t,$resolution)."</td>\n";
$tab[$tab_ligne][] = affiche_heure_creneau($t,$resolution);
}
echo "</tr>\n";
reset($rooms);
$tab_ligne++;
}
// répétition de la ligne d'en-tête
echo "<tr>\n<th> </th>";
for ($i = 0; $i < $nbcol; $i++)
{
// On affiche pas toutes les ressources
if (verif_acces_ressource(getUserName(), $id_room[$i]) and (!$hide_empty_resources || $today[$id_room[$i]])) {
echo "<th";
if ($statut_room[$id_room[$i]] == "0") echo " class='avertissement' ";
echo ">" . my_htmlspecialcharacters($room_name[$i])."</th>";
}
}
echo "<th> </th></tr>\n";
echo "</table>";
show_colour_key($area);
}
grr_sql_free($res);
/*
echo "<table border=\"1\">";
foreach ($tab as $cle => $value) {
echo "<tr>";
foreach ($value as $value2) {
echo "<td>";
echo $value2;
echo "</td>";
}
echo "</tr>";
}
echo "<table border=\"1\">";
for ($j=0; $j<=($nbcol+1); $j++) {
echo "<tr>";
for ($i=1; $i<=count($tab); $i++) {
echo "<td>";
echo $tab[$i][$j];
echo "</td>";
}
echo "</tr>";
}
*/
// Affichage d'un message pop-up
affiche_pop_up(get_vocab("message_records"),"user");
include "include/trailer.inc.php";
?>