} } tdcell_rowspan($c, $cellules[$id]); } $compteur[$id] = 1; } else { tdcell($c); } if (!isset($id) || est_hors_reservation(mktime(0, 0, 0, $month, $day, $year), $area)) { $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 . '" />' . PHP_EOL; } else { if ((authGetUserLevel(getUserName(), -1) > 1 || auth_visiteur(getUserName(), $room) == 1) && UserRoomMaxBooking(getUserName(), $room, 1) != 0 && verif_booking_date(getUserName(), -1, $room, $date_booking, $date_now, $enable_periods) && verif_delais_max_resa_room(getUserName(), $room, $date_booking) && verif_delais_min_resa_room(getUserName(), $room, $date_booking) && ($statut_room[$room] == "1" || $statut_room[$room] == "0" && authGetUserLevel(getUserName(), $room) > 2) && $_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") . '" ><span class="glyphicon glyphicon-plus"></span></a>' . PHP_EOL; } 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") . '" ><span class="glyphicon glyphicon-plus"></span></a>' . PHP_EOL; } } else { echo ' '; } } echo '</td>' . PHP_EOL; } else { if ($descr != "") { if (isset($today[$room][$t]["statut"]) && $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" />' . PHP_EOL; }
$tplArray['vocab']['ressource_actuellement_empruntee'] = get_vocab('ressource actuellement empruntee'); $tplArray['vocab']['reservation_a_confirmer_au_plus_tard_le'] = get_vocab('reservation_a_confirmer_au_plus_tard_le'); $tplArray['vocab']['en_attente_moderation'] = get_vocab('en_attente_moderation'); $tplArray['vocab']['reservation_impossible'] = get_vocab('reservation_impossible'); $tplArray['vocab']['cliquez_pour_effectuer_une_reservation'] = get_vocab('cliquez_pour_effectuer_une_reservation'); $tplArray['vocab']['top_of_page'] = get_vocab('top_of_page'); $li = 0; /* incrément des room accessibles, todo peut faire dvoublon avec $li, à refactoriser */ $incrementRoomAccessible = 0; for ($ir = 0; $row = grr_sql_row($res, $ir); $ir++) { /* un tour de boucle par room */ $verif_acces_ressource = verif_acces_ressource(getUserName(), $row['2']); if ($verif_acces_ressource) { /* l'incrément est différent de celui de la boucle si certaines room ne sont pas accessibles */ $acces_fiche_reservation = verif_acces_fiche_reservation(getUserName(), $row['2']); $UserRoomMaxBooking = UserRoomMaxBooking(getUserName(), $row['2'], 1); $authGetUserLevel = authGetUserLevel(getUserName(), -1); $auth_visiteur = auth_visiteur(getUserName(), $row['2']); $tplArray['rooms'][$incrementRoomAccessible]['id'] = $row[2]; $tplArray['rooms'][$incrementRoomAccessible]['capacity'] = $row[1]; $tplArray['rooms'][$incrementRoomAccessible]['description'] = $row[3]; //echo '<tr>'.PHP_EOL; /* remplacé par la class "table_stripped de bootstrap */ /*if ($ir % 2 == 1) { echo tdcell('cell_hours'); } else { echo tdcell('cell_hours2'); }*/ /*echo '<a title="'.htmlspecialchars(get_vocab('see_week_for_this_room')).'" href="week.php?year='.$year.'&month='.$month.'&day='.$day.'&area='.$area.'&room='.$row['2'].'">'.htmlspecialchars($row[0]).'</a><br />'.PHP_EOL;*/ /** * Données pour la colonne qui affiche les rooms
$_GET['pview'] = 0; } else { $_GET['pview'] = 1; } if ($_GET['pview'] == 1) { $class_image = "print_image"; } else { $class_image = "image"; } //calcul de l'accès à la ressource en fonction du niveau de l'utilisateur $verif_acces_ressource = verif_acces_ressource(getUserName(), $room); //Calcul du niveau d'accès aux fiche de réservation détaillées des ressources $acces_fiche_reservation = verif_acces_fiche_reservation(getUserName(), $room); //calcul du test si l'utilisateur a la possibilité d'effectuer une réservation, compte tenu //des limitations éventuelles de la ressources et du nombre de réservations déjà effectuées. $UserRoomMaxBooking = UserRoomMaxBooking(getUserName(), $room, 1); //calcul du niverau de droit de réservation $authGetUserLevel = authGetUserLevel(getUserName(), -1); //Determine si un visiteur peut réserver une ressource $auth_visiteur = auth_visiteur(getUserName(), $room); //Paramètres par défaut if (empty($debug_flag)) { $debug_flag = 0; } if (empty($month) || empty($year) || !checkdate($month, 1, $year)) { $month = date("m"); $year = date("Y"); } if (!isset($day)) { $day = 1; }
exit; } if (isset($id) and $id != 0) { $compt = 0; } else { $compt = 1; } if ($rep_type != 0 && !empty($reps)) { if (UserRoomMaxBooking(getUserName(), $room_id, count($reps) - 1 + $compt + $compt_room) == 0) { showAccessDeniedMaxBookings($day, $month, $year, $room_id, $back); exit; } else { $compt_room += 1; } } else { if (UserRoomMaxBooking(getUserName(), $room_id, $compt + $compt_room) == 0) { showAccessDeniedMaxBookings($day, $month, $year, $room_id, $back); exit; } else { $compt_room += 1; } } } foreach ($_GET['rooms'] as $room_id) { $moderate = grr_sql_query1('SELECT moderate FROM ' . TABLE_PREFIX . "_room WHERE id = '" . $room_id . "'"); if ($moderate == 1) { $send_mail_moderate = 1; if (isset($id)) { $old_entry_moderate = grr_sql_query1('SELECT moderate FROM ' . TABLE_PREFIX . "_entry where id='" . $id . "'"); if (authGetUserLevel(getUserName(), $room_id) < 3) { $entry_moderate = 1;
if (authGetUserLevel(getUserName(), -1) < 2 && auth_visiteur(getUserName(), $room) == 0) { /* TODO passer à twig */ showAccessDenied($back); exit; } if (authUserAccesArea(getUserName(), $area) == 0) { /* TODO passer à twig */ showAccessDenied($back); exit; } if (isset($id) && $id != 0) { $compt = 0; } else { $compt = 1; } if (UserRoomMaxBooking(getUserName(), $room, $compt) == 0) { /* TODO passer à twig */ showAccessDeniedMaxBookings($day, $month, $year, $room, $back); exit; } $etype = 0; if (isset($id)) { $sql = 'SELECT name, beneficiaire, description, start_time, end_time, type, room_id, entry_type, repeat_id, option_reservation, jours, create_by, beneficiaire_ext, statut_entry, clef, courrier FROM ' . TABLE_PREFIX . "_entry WHERE id={$id}"; $res = grr_sql_query($sql); if (!$res) { fatal_error(1, grr_sql_error()); } if (grr_sql_count($res) != 1) { fatal_error(1, get_vocab('entryid') . $id . get_vocab('not_found')); } $row = grr_sql_row($res, 0);
} 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 " ";