".$vocab["noareas"].""; echo "".$vocab["admin"]."\n "; exit(); } if((authGetUserLevel(getUserName(),-1) < 1) and ($authentification_obli==1)) { showAccessDenied($day, $month, $year, $area,$back); exit(); } if(authUserAccesArea($session_login, $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(); } # print the page header print_header($day, $month, $year, $area, $type_session); //J'ai modifié cette fonction /////////////////////////////////Deplacé ici par K // Si c'est un admin qui est connecté, on affiche le nombre de personnes actuellement connectées. // echo ""; //Important laisser 750 ?>
"; if (isset($_SESSION['default_list_type']) or ($authentification_obli==1)) { $area_list_format = $_SESSION['default_list_type']; } else { $area_list_format = getSettingValue("area_list_format"); } #Show all avaliable areas # need to show either a select box or a normal html list, if ($area_list_format != "list") { echo make_area_select_html('day.php', $area, $year, $month, $day, $session_login); # from functions.inc.php } else { echo make_area_list_html('day.php', $area, $year, $month, $day, $session_login); # from functions.inc.php } ?>
"; #Draw the three month calendars minicals($year, $month, $day, $area, -1, 'day'); //echo "
"; ?> " . ucfirst(strftime($dformat, $am7)) . " - ".ucfirst($this_area_name)." - ".$vocab["all_areas"]."\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 "
<< $vocab[daybefore]$vocab[gototoday]$vocab[dayafter] >>
"; } #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 grr_room.id, start_time, end_time, name, grr_entry.id, type, create_by, statut_entry FROM grr_entry, grr_room WHERE grr_entry.room_id = grr_room.id AND area_id = $area AND start_time <= $pm7 AND end_time > $am7"; $res = sql_query($sql); if (! $res) { // fatal_error(0, sql_error()); include "trailer.inc.php"; exit; } for ($i = 0; ($row = 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] = creator of the booking #row[7] = satut of the booking # $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); 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]; } # 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. $sql_creator = "SELECT prenom, nom FROM grr_utilisateurs WHERE login = '$row[6]'"; $res_creator = sql_query($sql_creator); if ($res_creator) { $row_user = sql_row($res_creator, 0); } if ($row[1] < $am7) { $today[$row[0]][$am7]["data"] = $row[3]; $today[$row[0]][$am7]["who"] = $row_user[0]." ".$row_user[1]; } else { $today[$row[0]][$start_t]["data"] = $row[3]; $today[$row[0]][$start_t]["who"] = $vocab["created_by"].$row_user[0]." ".$row_user[1]; } } # 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 from grr_room where area_id=$area order by 1"; $res = 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, sql_error()); if (sql_count($res) == 0) { echo "

$vocab[no_rooms_for_area]

"; sql_free($res); } else { #This is where we start displaying stuff echo ""; //MODK echo ""; $room_column_width = (int)(95 / sql_count($res)); $nbcol = 0; for ($i = 0; ($row = sql_row($res, $i)); $i++) { $room_name[$i] = $row[0]; $id_room[$i] = $row[2]; $statut_room[$id_room[$i]] = $row[4]; $nbcol++; if ($row[1]) { $temp = "
($row[1] ".($row[1] >1 ? $vocab["number_max2"] : $vocab["number_max"]).")"; } else { $temp=""; } if ($statut_room[$id_room[$i]] == "0") $temp .= "
".$vocab["ressource_temporairement_indisponible"].""; // Ressource temporairement indisponible echo ""; $rooms[] = $row[2]; } echo "\n"; echo ""; tdcell("cell_hours"); echo "$vocab[time]"; for ($i = 0; $i < $nbcol; $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"); echo "".$vocab["week"]."
".$vocab["month"].""; echo ""; } tdcell("cell_hours"); echo "$vocab[time]\n"; # This is the main bit of the display # We loop through unixtime and then the rooms we just got for ($t = $am7; $t <= $pm7; $t += $resolution) { # Show the time linked to the URL for highlighting that time echo ""; tdcell("cell_hours"); echo date(hour_min_format(),$t) . ""; # Loop through the list of rooms we have for this area while (list($key, $room) = each($rooms)) { if(isset($today[$room][$t]["id"])) { $id = $today[$room][$t]["id"]; $color = $today[$room][$t]["color"]; $descr = htmlspecialchars($today[$room][$t]["data"]); } else unset($id); if (isset($id)) $c = $color; else if ($statut_room[$room] == "0") // Si la ressource est temporairement indisponible, on le signale, sinon, couleur normale $c = "avertissement"; else $c = "empty_cell"; tdcell($c); # If the room isnt booked then allow it to be booked if(!isset($id)) { $hour = date("H",$t); $minute = date("i",$t); $date_booking = mktime($hour, $minute, 0, $month, $day, $year); echo "
"; if ((authGetUserLevel(getUserName(),-1) > 1) and (UserRoomMaxBooking(getUserName(), $room, 1) != 0) and verif_booking_date(getUserName(), -1, $date_booking, $date_now) and (($statut_room[$room] == "1") or (($statut_room[$room] == "0") and (authGetUserLevel(getUserName(),$room) > 2) ))) { echo ""; } else { echo " "; } echo "
"; } elseif ($descr != "") { // si la réservation est "en cours", on le signale if ((isset($today[$room][$t]["statut"])) and ($today[$room][$t]["statut"]=='y')) echo " \"".$vocab["reservation_en_cours"]."\" \n"; #if it is booked then show if (($statut_room[$room] == "1") or (($statut_room[$room] == "0") and (authGetUserLevel(getUserName(),$room) > 2) )) { echo " $descr"; } else { echo " $descr"; } } else echo " \" "; echo "\n"; } // Répétition de la première colonne // Si la ressource est temporairement indisponible, on le signale, sinon, couleur normale tdcell("cell_hours"); echo date(hour_min_format(),$t) . ""; echo "\n"; reset($rooms); } // répétition de la ligne d'en-tête echo ""; for ($i = 0; $i < $nbcol; $i++) { echo "" . htmlspecialchars($room_name[$i]).""; } echo "\n"; echo "
 " . htmlspecialchars($row[0])."\n
". htmlspecialchars($row[3]) . $temp."\n
"; if ($row[5] == 'y') echo " \"détails\""; if (authGetUserLevel(getUserName(),$id_room[$i]) > 2) echo "\"configuration\""; echo "
 
  
"; show_colour_key(); } include "trailer.inc.php"; ?>