function genslotselector($area, $prefix, $first, $last, $time, $display = "block") { global $periods; $html = ''; // Get the settings for this area. Note that the variables below are // local variables, not globals. $enable_periods = $area['enable_periods']; $resolution = $enable_periods ? 60 : $area['resolution']; // Check that $resolution is positive to avoid an infinite loop below. // (Shouldn't be possible, but just in case ...) if (empty($resolution) || $resolution < 0) { fatal_error(FALSE, "Internal error - resolution is NULL or <= 0"); } // If they've asked for "display: none" then we'll also disable the select so // that there is only one select passing through the variable to the handler $disabled = strtolower($display) == "none" ? " disabled=\"disabled\"" : ""; $date = getdate($time); $time_zero = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']); if ($enable_periods) { $base = 12 * 60 * 60; // The start of the first period of the day } else { $format = hour_min_format(); } $html .= "<select style=\"display: {$display}\" id = \"{$prefix}seconds{$area['id']}\" name=\"{$prefix}seconds\" onChange=\"adjustSlotSelectors(this.form)\"{$disabled}>\n"; for ($t = $first; $t <= $last; $t = $t + $resolution) { $timestamp = $t + $time_zero; $slot_string = $enable_periods ? $periods[intval(($t - $base) / 60)] : utf8_strftime($format, $timestamp); $html .= "<option value=\"{$t}\""; $html .= $timestamp == $time ? " selected=\"selected\"" : ""; $html .= ">{$slot_string}</option>\n"; } $html .= "</select>\n"; echo $html; }
/** mrbsCheckFree() * * Check to see if the time period specified is free * * $room_id - Which room are we checking * $starttime - The start of period * $endtime - The end of the period * $ignore - An entry ID to ignore, 0 to ignore no entries * $repignore - A repeat ID to ignore everything in the series, 0 to ignore no series * * Returns: * nothing - The area is free * something - An error occured, the return value is human readable */ function mrbsCheckFree($room_id, $starttime, $endtime, $ignore, $repignore) { global $vocab; //SELECT any meetings which overlap ($starttime,$endtime) for this room: $sql = "SELECT id, name, start_time FROM " . TABLE_PREFIX . "_entry WHERE start_time < '" . $endtime . "' AND end_time > '" . $starttime . "' AND room_id = '" . $room_id . "'"; if ($ignore > 0) { $sql .= " AND id <> {$ignore}"; } if ($repignore > 0) { $sql .= " AND repeat_id <> {$repignore}"; } $sql .= " ORDER BY start_time"; $res = grr_sql_query($sql); if (!$res) { return grr_sql_error(); } if (grr_sql_count($res) == 0) { grr_sql_free($res); return ""; } // Get the room's area ID for linking to day, week, and month views: $area = mrbsGetRoomArea($room_id); // Build a string listing all the conflicts: $err = ""; for ($i = 0; $row = grr_sql_row($res, $i); $i++) { $starts = getdate($row[2]); $param_ym = "area={$area}&year={$starts['year']}&month={$starts['mon']}"; $param_ymd = $param_ym . "&day={$starts['mday']}"; $err .= "<li><a href=\"view_entry.php?id={$row['0']}\">{$row['1']}</a>" . " ( " . utf8_strftime('%A %d %B %Y %T', $row[2]) . ") " . "(<a href=\"day.php?{$param_ymd}\">" . get_vocab("viewday") . "</a>" . " | <a href=\"week.php?room={$room_id}&{$param_ymd}\">" . get_vocab("viewweek") . "</a>" . " | <a href=\"month.php?room={$room_id}&{$param_ym}\">" . get_vocab("viewmonth") . "</a>)\n"; } return $err; }
function reporton(&$row, &$last_area_room, &$last_date, $sortby, $display) { global $typel; global $enable_periods; # Display Area/Room, but only when it changes: $area_room = htmlspecialchars($row[8]) . " - " . htmlspecialchars($row[9]); $date = utf8_strftime("%d-%b-%Y", $row[1]); # entries to be sorted on area/room if ($sortby == "r") { if ($area_room != $last_area_room) { echo "<hr><h2>" . get_vocab("room") . ": " . $area_room . "</h2>\n"; } if ($date != $last_date || $area_room != $last_area_room) { echo "<hr noshade=\"true\"><h3>" . get_vocab("date") . " " . $date . "</h3>\n"; $last_date = $date; } # remember current area/room that is being processed. # this is done here as the if statement above needs the old # values if ($area_room != $last_area_room) { $last_area_room = $area_room; } } else { if ($date != $last_date) { echo "<hr><h2>" . get_vocab("date") . " " . $date . "</h2>\n"; } if ($area_room != $last_area_room || $date != $last_date) { echo "<hr noshade=\"true\"><h3>" . get_vocab("room") . ": " . $area_room . "</h3>\n"; $last_area_room = $area_room; } # remember current date that is being processed. # this is done here as the if statement above needs the old # values if ($date != $last_date) { $last_date = $date; } } echo "<hr><table width=\"100%\">\n"; # Brief Description (title), linked to view_entry: echo "<tr><td class=\"BL\"><a href=\"view_entry.php?id={$row['0']}\">" . htmlspecialchars($row[3]) . "</a></td>\n"; # what do you want to display duration or end date/time if ($display == "d") { # Start date/time and duration: echo "<td class=\"BR\" align=right>" . (empty($enable_periods) ? describe_span($row[1], $row[2]) : describe_period_span($row[1], $row[2])) . "</td></tr>\n"; } else { # Start date/time and End date/time: echo "<td class=\"BR\" align=right>" . (empty($enable_periods) ? start_to_end($row[1], $row[2]) : start_to_end_period($row[1], $row[2])) . "</td></tr>\n"; } # Description: echo "<tr><td class=\"BL\" colspan=2><b>" . get_vocab("description") . "</b> " . nl2br(htmlspecialchars($row[4])) . "</td></tr>\n"; # Entry Type: $et = empty($typel[$row[5]]) ? "?{$row['5']}?" : $typel[$row[5]]; echo "<tr><td class=\"BL\" colspan=2><b>" . get_vocab("type") . "</b> {$et}</td></tr>\n"; # Created by and last update timestamp: echo "<tr><td class=\"BL\" colspan=2><small><b>" . get_vocab("createdby") . "</b> " . htmlspecialchars($row[6]) . ", <b>" . get_vocab("lastupdate") . "</b> " . date_time_string($row[7]) . "</small></td></tr>\n"; echo "</table>\n"; }
function cal($month, $year) { global $weekstarts, $display_day; $display_day="1111111"; if (!isset($weekstarts)) $weekstarts = 0; $s = ""; $daysInMonth = getDaysInMonth($month, $year); $date = mktime(12, 0, 0, $month, 1, $year); $first = (strftime("%w",$date) + 7 - $weekstarts) % 7; $monthName = utf8_strftime("%B",$date); $s .= "<table class=\"calendar2\" border=\"1\" cellspacing=\"3\">\n"; $s .= "<tr>\n"; $s .= "<td class=\"calendarHeader2\" colspan=\"7\">$monthName $year</td>\n"; $s .= "</tr>\n"; $d = 1 - $first; $is_ligne1 = 'y'; while ($d <= $daysInMonth) { $s .= "<tr>\n"; for ($i = 0; $i < 7; $i++) { $basetime = mktime(12,0,0,6,11+$weekstarts,2000); $show = $basetime + ($i * 24 * 60 * 60); $nameday = utf8_strftime('%A',$show); $temp = mktime(0,0,0,$month,$d,$year); if ($i==0) $s .= "<td class=\"calendar2\" style=\"vertical-align:bottom;\"><b>S".numero_semaine($temp)."</b></td>\n"; $s .= "<td class=\"calendar2\" align=\"center\" valign=\"top\">"; if ($is_ligne1 == 'y') $s .= '<b>'.ucfirst(substr($nameday,0,1)).'</b><br />'; if ($d > 0 && $d <= $daysInMonth) { $s .= $d; $day = grr_sql_query1("SELECT day FROM ".TABLE_PREFIX."_calendrier_jours_cycle WHERE day='$temp'"); $s .= "<br /><input type=\"checkbox\" name=\"$temp\" value=\"$nameday\" "; if (!($day < 0)) $s .= "checked=\"checked\" "; $s .= " />"; } else { $s .= " "; } $s .= "</td>\n"; $d++; } $s .= "</tr>\n"; $is_ligne1 = 'n'; } $s .= "</table>\n"; return $s; }
function describe_span($starts, $ends) { global $twentyfourhour_format; $start_date = utf8_strftime('%A %d %B %Y', $starts); if ($twentyfourhour_format) { $timeformat = "%T"; } else { # This bit's necessary, because it seems %p in strftime format # strings doesn't work $ampm = utf8_date("a", $starts); $timeformat = "%I:%M:%S{$ampm}"; } $start_time = utf8_strftime($timeformat, $starts); $duration = $ends - $starts; if ($start_time == "00:00:00" && $duration == 60 * 60 * 24) { return $start_date . " - " . get_vocab("all_day"); } toTimeString($duration, $dur_units); return $start_date . " " . $start_time . " - " . $duration . " " . $dur_units; }
$rep_day[1] = $row[3][1] != "0"; $rep_day[2] = $row[3][2] != "0"; $rep_day[3] = $row[3][3] != "0"; $rep_day[4] = $row[3][4] != "0"; $rep_day[5] = $row[3][5] != "0"; $rep_day[6] = $row[3][6] != "0"; if ($rep_type == 6) { $rep_num_weeks = $row[4]; } break; default: $rep_day = array(0, 0, 0, 0, 0, 0, 0); } } else { $rep_type = $row[0]; $rep_end_date = utf8_strftime('%A %d %B %Y', $row[2]); $rep_opt = $row[3]; } } } else { # It is a new booking. The data comes from whichever button the user clicked $edit_type = "series"; $name = getUserName(); $create_by = getUserName(); $description = ""; $start_day = $day; $start_month = $month; $start_year = $year; // Avoid notices for $hour and $minute if periods is enabled isset($hour) ? $start_hour = $hour : ''; isset($minute) ? $start_min = $minute : '';
<?php // $Id: help.php 2338 2012-07-18 10:54:42Z cimorrison $ require "defaultincludes.inc"; require_once "version.inc"; // Check the user is authorised for this page checkAuthorised(); print_header($day, $month, $year, $area, isset($room) ? $room : ""); echo "<h3>" . get_vocab("about_mrbs") . "</h3>\n"; echo "<table id=\"version_info\">\n"; echo "<tr><td><a href=\"http://mrbs.sourceforge.net\">" . get_vocab("mrbs") . "</a>:</td><td>" . get_mrbs_version() . "</td></tr>\n"; echo "<tr><td>" . get_vocab("database") . ":</td><td>" . sql_version() . "</td></tr>\n"; echo "<tr><td>" . get_vocab("system") . ":</td><td>" . php_uname() . "</td></tr>\n"; echo "<tr><td>" . get_vocab("servertime") . ":</td><td>" . utf8_strftime($strftime_format['datetime'], time()) . "</td></tr>\n"; echo "<tr><td>PHP:</td><td>" . phpversion() . "</td></tr>\n"; echo "</table>\n"; echo "<p>\n" . get_vocab("browserlang") . ":\n"; echo implode(", ", array_keys($langs)); echo "\n</p>\n"; echo "<h3>" . get_vocab("help") . "</h3>\n"; echo "<p>\n"; echo get_vocab("please_contact") . '<a href="mailto:' . htmlspecialchars($mrbs_admin_email) . '">' . htmlspecialchars($mrbs_admin) . "</a> " . get_vocab("for_any_questions") . "\n"; echo "</p>\n"; require_once "site_faq" . $faqfilelang . ".html"; output_trailer();
$month = get_form_var('month', 'int'); $year = get_form_var('year', 'int'); $area = get_form_var('area', 'int'); $room = get_form_var('room', 'int'); // If we dont know the right date then make it up if (!isset($day) or !isset($month) or !isset($year)) { $day = date("d"); $month = date("m"); $year = date("Y"); } if (empty($area)) { $area = get_default_area(); } print_header($day, $month, $year, $area, isset($room) ? $room : ""); echo "<h3>" . get_vocab("about_mrbs") . "</h3>\n"; echo "<table id=\"version_info\">\n"; echo "<tr><td><a href=\"http://mrbs.sourceforge.net\">" . get_vocab("mrbs") . "</a>:</td><td>" . get_mrbs_version() . "</td></tr>\n"; echo "<tr><td>" . get_vocab("database") . ":</td><td>" . sql_version() . "</td></tr>\n"; echo "<tr><td>" . get_vocab("system") . ":</td><td>" . php_uname() . "</td></tr>\n"; echo "<tr><td>" . get_vocab("servertime") . ":</td><td>" . utf8_strftime("%c", time()) . "</td></tr>\n"; echo "<tr><td>PHP:</td><td>" . phpversion() . "</td></tr>\n"; echo "</table>\n"; echo "<p>\n" . get_vocab("browserlang") . ":\n"; echo implode(", ", array_keys($langs)); echo "\n</p>\n"; echo "<h3>" . get_vocab("help") . "</h3>\n"; echo "<p>\n"; echo get_vocab("please_contact") . '<a href="mailto:' . htmlspecialchars($mrbs_admin_email) . '">' . htmlspecialchars($mrbs_admin) . "</a> " . get_vocab("for_any_questions") . "\n"; echo "</p>\n"; include "site_faq" . $faqfilelang . ".html"; include "trailer.inc";
# 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 from {$tbl_room} where area_id={$area} order by capacity"; $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 "<h1>" . get_vocab("no_rooms_for_area") . "</h1>"; sql_free($res); } else { #Show current date echo "<h2 align=center>" . utf8_strftime("%A %d %B %Y", $am7) . "</h2>\n"; if ($pview != 1) { #Show Go to day before and after links $output = "<table width=\"100%\"><tr><td><a href=\"day.php?year={$yy}&month={$ym}&day={$yd}&area={$area}\"><<" . get_vocab("daybefore") . "</a></td>\n <td align=center><a href=\"day.php?area={$area}\">" . get_vocab("gototoday") . "</a></td>\n <td align=right><a href=\"day.php?year={$ty}&month={$tm}&day={$td}&area={$area}\">" . get_vocab("dayafter") . ">></a></td></tr></table>\n"; print $output; } // Include the active cell content management routines. // Must be included before the beginnning of the main table. if ($javascript_cursor) { echo "<SCRIPT language=\"JavaScript\" type=\"text/javascript\" src=\"xbLib.js\"></SCRIPT>\n"; echo "<SCRIPT language=\"JavaScript\">InitActiveCell(" . ($show_plus_link ? "true" : "false") . ", " . "true, " . (FALSE != $times_right_side ? "true" : "false") . ", " . "\"{$highlight_method}\", " . "\"" . get_vocab("click_to_reserve") . "\"" . ");</SCRIPT>\n"; } #This is where we start displaying stuff echo "<table cellspacing=0 border=1 width=\"100%\">"; echo "<tr><th width=\"1%\">" . ($enable_periods ? get_vocab("period") : get_vocab("time")) . "</th>"; $room_column_width = (int) (95 / sql_count($res));
echo '<h4 class="titre">' . $this_area_name . ' - ' . get_vocab("all_rooms") . '<br> Du ' . utf8_strftime($dformat, $date_start) . ' au ' . utf8_strftime($dformat, $date_end) . '</h4>' . PHP_EOL; echo '</div>' . PHP_EOL; echo '</div>' . PHP_EOL; echo '<div class="row">' . PHP_EOL; echo '<div class="contenu_planning">' . PHP_EOL; echo '<table class="table-bordered table-striped">' . PHP_EOL; echo '<thead>' . PHP_EOL; echo '<tr>' . PHP_EOL; echo '<th class="jour_sem"> </th>' . PHP_EOL; $t = $time; $num_week_day = $weekstarts; $ferie = getHolidays($year); for ($weekcol = 0; $weekcol < 7; $weekcol++) { $num_day = strftime("%d", $t); $temp_month = utf8_encode(strftime("%m", $t)); $temp_month2 = utf8_strftime("%b", $t); $temp_year = strftime("%Y", $t); $tt = mktime(0, 0, 0, $temp_month, $num_day, $temp_year); $jour_cycle = grr_sql_query1("SELECT Jours FROM " . TABLE_PREFIX . "_calendrier_jours_cycle WHERE day='{$t}'"); $t += 86400; if (!isset($correct_heure_ete_hiver) || $correct_heure_ete_hiver == 1) { if (heure_ete_hiver("hiver", $temp_year, 0) == mktime(0, 0, 0, $temp_month, $num_day, $temp_year)) { $t += 3600; } if (date("H", $t) == "01") { $t -= 3600; } } if ($display_day[$num_week_day] == 1) { $class = ""; $title = "";
foreach ($ferie as $key => $value) { if ($tt == $value) { $ferie_true = 1; break; } } $sh = getSchoolHolidays($tt, $year_actuel); if ($sh[0] == true) { $class .= "vacance "; $title = " " . $sh[1]; } if ($ferie_true) { $class .= "ferie "; } } echo "<th style=\"width:14%;\"><a onclick=\"charger()\" class=\"lienPlanning " . $class . "\" title=\"" . $title . htmlspecialchars(get_vocab("see_all_the_rooms_for_the_day")) . "\" href=\"day.php?year={$year_actuel}&month={$month_actuel}&day={$num_day}&area={$area}\">" . utf8_strftime($dformat, $t) . "</a>"; if (Settings::get("jours_cycles_actif") == "Oui" && intval($jour_cycle) > -1) { if (intval($jour_cycle) > 0) { echo "<br />" . get_vocab("rep_type_6") . " " . $jour_cycle; } else { echo "<br />" . $jour_cycle; } } echo "</th>\n"; } if (!isset($correct_heure_ete_hiver) || $correct_heure_ete_hiver == 1) { $num_day = strftime("%d", $t); if (heure_ete_hiver("hiver", $year, 0) == mktime(0, 0, 0, $month, $num_day, $year)) { $t += 3600; } if (date("H", $t) == "13" || date("H", $t) == "02") {
break; case "> > ": // Starts after midnight, continues tomorrow $d[$day_num]["data"][] = htmlspecialchars(utf8_strftime(hour_min_format(), $row['start_time'])) . "~====>"; break; case "= = ": // Starts at midnight, ends at midnight $d[$day_num]["data"][] = $all_day; break; case "= > ": // Starts at midnight, continues tomorrow $d[$day_num]["data"][] = $all_day . "====>"; break; case "< < ": // Starts before today, ends before midnight $d[$day_num]["data"][] = "<====~" . htmlspecialchars(utf8_strftime(hour_min_format(), $row['end_time'])); break; case "< = ": // Starts before today, ends at midnight $d[$day_num]["data"][] = "<====" . $all_day; break; case "< > ": // Starts before today, continues tomorrow $d[$day_num]["data"][] = "<====" . $all_day . "====>"; break; } } else { $start_str = period_time_string($row['start_time']); $end_str = period_time_string($row['end_time'], -1); switch (cmp3($row['start_time'], $midnight[$day_num]) . cmp3($row['end_time'], $midnight_tonight[$day_num] + 1)) { case "> < ":
} else { echo $start_hour; } ?> " maxlength="2"> <span>:</span> <input name="minute" value="<?php echo $start_min; ?> " maxlength="2"> <?php if (!$twentyfourhour_format) { $checked = $start_hour < 12 ? "checked=\"checked\"" : ""; echo " <input name=\"ampm\" type=\"radio\" value=\"am\" {$checked}>" . utf8_strftime("%p", mktime(1, 0, 0, 1, 1, 2000)); $checked = $start_hour >= 12 ? "checked=\"checked\"" : ""; echo " <input name=\"ampm\" type=\"radio\" value=\"pm\" {$checked}>" . utf8_strftime("%p", mktime(13, 0, 0, 1, 1, 2000)); } ?> </div> <?php } else { ?> <div id="div_period"> <label for="period" ><?php echo get_vocab("period"); ?> :</label> <select id="period" name="period"> <?php foreach ($periods as $p_num => $p_val) { echo "<option value=\"{$p_num}\"";
} else { echo affiche_heure_creneau($t,$resolution)."</td>\n"; } echo "</tr>\n"; $t += $resolution; } // répétition de la première ligne echo "<tr>\n<th> </th>\n"; $num_week_day = $weekstarts; $i=$time; for ($t = $week_start; $t <= $week_end; $t += 86400) { $jour_cycle = grr_sql_query1("SELECT Jours FROM ".TABLE_PREFIX."_calendrier_jours_cycle WHERE DAY='$i'"); if ($display_day[$num_week_day] == 1) {// on n'affiche pas tous les jours de la semaine echo "<th style=\"width:14%;\">" . utf8_strftime($dformat, $t); if (getSettingValue("jours_cycles_actif") == "Oui" and $jour_cycle>0) echo "<br />".get_vocab("rep_type_6")." ".$jour_cycle; echo "</th>\n"; } $k++; if (!isset($correct_heure_ete_hiver) or ($correct_heure_ete_hiver == 1)) { $num_day = strftime("%d", $t); // Si le dernier dimanche d'octobre est dans la semaine, on avance d'une heure if (heure_ete_hiver("hiver",$year,0) == mktime(0,0,0,$month,$num_day,$year)) $t +=3600; if ((date("H",$t) == "13") or (date("H",$t) == "02")) $t -=3600; } $i += 86400;
} # end select if if ($pview != 1) { echo "</td>\n"; #Draw the three month calendars minicals($year, $month, $day, $area, $room, 'month'); echo "</tr></table>\n"; } # Don't continue if this area has no rooms: if ($room <= 0) { echo "<h1>" . get_vocab("no_rooms_for_area") . "</h1>"; include "trailer.inc"; exit; } # Show Month, Year, Area, Room header: echo "<h2 align=center>" . utf8_strftime("%B %Y", $month_start) . " - {$this_area_name} - {$this_room_name}</h2>\n"; # Show Go to month before and after links #y? are year and month of the previous month. #t? are year and month of the next month. $i = mktime(12, 0, 0, $month - 1, 1, $year); $yy = date("Y", $i); $ym = date("n", $i); $i = mktime(12, 0, 0, $month + 1, 1, $year); $ty = date("Y", $i); $tm = date("n", $i); if ($pview != 1) { echo "<table width=\"100%\"><tr><td>\n <a href=\"month.php?year={$yy}&month={$ym}&area={$area}&room={$room}\">\n << " . get_vocab("monthbefore") . "</a></td>\n <td align=center><a href=\"month.php?area={$area}&room={$room}\">" . get_vocab("gotothismonth") . "</a></td>\n <td align=right><a href=\"month.php?year={$ty}&month={$tm}&area={$area}&room={$room}\">\n " . get_vocab("monthafter") . ">></a></td></tr></table>"; } if ($debug_flag) { echo "<p>DEBUG: month={$month} year={$year} start={$weekday_start} range={$month_start}:{$month_end}\n"; }
function week_table_innerhtml($day, $month, $year, $user, $timetohighlight = NULL) { global $tbl_entry, $tbl_room, $tbl_area; global $enable_periods, $periods; global $times_along_top, $row_labels_both_sides, $column_labels_both_ends; global $resolution, $morningstarts, $morningstarts_minutes, $eveningends, $eveningends_minutes; global $weekstarts, $strftime_format; global $first_last_width, $column_hidden_width, $hidden_days; global $sql_mysqli_conn; // Check that we've got a valid, enabled room $sql = "SELECT COUNT(*)\n FROM users\n WHERE code='{$user}'\n AND disabled=0"; $n_users = sql_mysqli_query1($sql, $sql_mysqli_conn); if ($n_users < 0 || $n_users > 1) { if ($n_users < 0) { // SQL error, probably because the tables haven't been created trigger_error(sql_error(), E_USER_WARNING); } else { // Should never happen trigger_error("Internal error: multiple rooms with same id", E_USER_WARNING); } fatal_error(FALSE, get_vocab("fatal_db_error")); } if ($n_users == 0) { // No rooms have been created yet, or else they are all disabled // Add an 'empty' data flag so that the JavaScript knows whether this is a real table or not return "<tbody data-empty=1><tr><td><h1>" . get_vocab("no_rooms_for_area") . "</h1></td></tr></tbody>"; } // We have a valid room $num_of_days = 7; // days in a week // ensure that $morningstarts_minutes defaults to zero if not set if (!isset($morningstarts_minutes)) { $morningstarts_minutes = 0; } if ($enable_periods) { $resolution = 60; $morningstarts = 12; $morningstarts_minutes = 0; $eveningends = 12; $eveningends_minutes = count($periods) - 1; } // Calculate how many days to skip back to get to the start of the week $time = mktime(12, 0, 0, $month, $day, $year); $skipback = day_of_MRBS_week($time); $day_start_week = $day - $skipback; // We will use $day for links and $day_start_week for anything to do with showing the bookings, // because we want the booking display to start on the first day of the week (eg Sunday if $weekstarts is 0) // but we want to preserve the notion of the current day (or 'sticky day') when switching between pages // Define the start and end of each day of the week in a way which is not // affected by daylight saving... for ($j = 0; $j <= $num_of_days - 1; $j++) { $am7[$j] = get_start_first_slot($month, $day_start_week + $j, $year); $pm7[$j] = get_start_last_slot($month, $day_start_week + $j, $year); // Work out whether there's a possibility that a time slot is invalid, // in other words whether the booking day includes a transition into DST. // If we know that there's a transition into DST then some of the slots are // going to be invalid. Knowing whether or not there are possibly invalid slots // saves us bothering to do the detailed calculations of which slots are invalid. $is_possibly_invalid[$j] = !$enable_periods && is_possibly_invalid($am7[$j], $pm7[$j]); } unset($j); // Just so that we pick up any accidental attempt to use it later // Get all appointments for this week in the room that we care about. // // row['room_id'] = Room ID // row['start_time'] = Start time // row['end_time'] = End time // row['type'] = Entry type // row['name'] = Entry name (brief description) // row['entry_id'] = Entry ID // row['entry_description'] = Complete description // row['status'] = status code // row['entry_create_by'] = User who created entry // This data will be retrieved day-by-day $week_map = array(); for ($j = 0; $j <= $num_of_days - 1; $j++) { $sql = "SELECT user, start_time, end_time, type, number, repeat_id,\n id AS entry_id\n FROM times\n WHERE user = '******'\n AND start_time <= {$pm7[$j]} AND end_time > {$am7[$j]}\n ORDER BY start_time"; // necessary so that multiple bookings appear in the right order // Each row returned from the query is a meeting. Build an array of the // form: $week_map[room][weekday][slot][x], where x = id, color, data, long_desc. // [slot] is based at 000 (HHMM) for midnight, but only slots within // the hours of interest (morningstarts : eveningends) are filled in. // [id], [data] and [long_desc] are only filled in when the meeting // should be labeled, which is once for each meeting on each weekday. // Note: weekday here is relative to the $weekstarts configuration variable. // If 0, then weekday=0 means Sunday. If 1, weekday=0 means Monday. $res = sql_query($sql); if (!$res) { trigger_error(sql_error(), E_USER_WARNING); fatal_error(TRUE, get_vocab("fatal_db_error")); } else { for ($i = 0; $row = sql_row_keyed($res, $i); $i++) { map_add_booking($row, $week_map[0][$j], $am7[$j], $pm7[$j]); } } } // for ($j = 0; ... unset($j); // Just so that we pick up any accidental attempt to use it later // START DISPLAYING THE MAIN TABLE $n_time_slots = get_n_time_slots(); $morning_slot_seconds = ($morningstarts * 60 + $morningstarts_minutes) * 60; $evening_slot_seconds = $morning_slot_seconds + ($n_time_slots - 1) * $resolution; // TABLE HEADER $thead = "<thead>\n"; $header_inner = "<tr>\n"; $dformat = "%a<br>" . $strftime_format['daymonth']; // If we've got a table with times along the top then put everything on the same line // (ie replace the <br> with a space). It looks slightly better if ($times_along_top) { $dformat = preg_replace("/<br>/", " ", $dformat); } // We can display the table in two ways if ($times_along_top) { // with times along the top and days of the week down the side $first_last_html = '<th class="first_last" style="width: ' . $first_last_width . '%">' . get_vocab('date') . ":</th>\n"; $header_inner .= $first_last_html; $column_width = get_main_column_width($n_time_slots); for ($s = $morning_slot_seconds; $s <= $evening_slot_seconds; $s += $resolution) { // Put the seconds since the start of the day (nominal, not adjusted for DST) // into a data attribute so that it can be picked up by JavaScript $header_inner .= "<th data-seconds=\"{$s}\" style=\"width: {$column_width}%\">"; // We need the span so that we can apply some padding. We can't apply it // to the <th> because that is used by jQuery.offset() in resizable bookings $header_inner .= "<span>"; if ($enable_periods) { $header_inner .= period_name($s); } else { $header_inner .= hour_min($s); } $header_inner .= "</span>"; $header_inner .= "</th>\n"; } // next: line to display times on right side if (!empty($row_labels_both_sides)) { $header_inner .= $first_last_html; } } else { // the standard view, with days along the top and times down the side $first_last_html = '<th class="first_last" style="width: ' . $first_last_width . '%">' . ($enable_periods ? get_vocab('period') : get_vocab('time')) . ':</th>'; $header_inner .= $first_last_html; $column_width = get_main_column_width($num_of_days, count($hidden_days)); for ($j = 0; $j <= $num_of_days - 1; $j++) { $t = mktime(12, 0, 0, $month, $day_start_week + $j, $year); $date = date('Y-n-d', $t); if (is_hidden_day(($j + $weekstarts) % 7)) { // These days are to be hidden in the display (as they are hidden, just give the // day of the week in the header row $style = $column_hidden_width == 0 ? 'display: none' : 'width: ' . $column_hidden_width . '%'; $header_inner .= '<th class="hidden_day" style="' . $style . '">' . utf8_strftime($strftime_format['dayname_cal'], $t) . "</th>\n"; } else { // Put the date into a data attribute so that it can be picked up by JavaScript $header_inner .= '<th data-date="' . $date . '" style="width: ' . $column_width . '%>' . '<a href="day.php?year=' . strftime("%Y", $t) . '&month=' . strftime("%m", $t) . '&day=' . strftime('%d', $t) . '&area=' . $area . ' title="' . get_vocab('viewday') . '">' . utf8_strftime($dformat, $t) . "</a></th>\n"; } } // for ($j = 0 ... unset($j); // Just so that we pick up any accidental attempt to use it later // next line to display times on right side if (!empty($row_labels_both_sides)) { $header_inner .= $first_last_html; } } // end standard view (for the header) $header_inner .= "</tr>\n"; $thead .= $header_inner; $thead .= "</thead>\n"; // Now repeat the header in a footer if required $tfoot = $column_labels_both_ends ? "<tfoot>\n{$header_inner}</tfoot>\n" : ''; // TABLE BODY LISTING BOOKINGS $tbody = "<tbody>\n"; // URL for highlighting a time. Don't use REQUEST_URI or you will get // the timetohighlight parameter duplicated each time you click. $base_url = "temp.php?year={$year}&month={$month}&day={$day}&area={$area}&room={$room}"; $row_class = "even_row"; // We can display the table in two ways if ($times_along_top) { // with times along the top and days of the week down the side // See note above: weekday==0 is day $weekstarts, not necessarily Sunday. for ($thisday = 0; $thisday <= $num_of_days - 1; $thisday++, $row_class = $row_class == "even_row" ? "odd_row" : "even_row") { if (is_hidden_day(($thisday + $weekstarts) % 7)) { // These days are to be hidden in the display: don't display a row // Toggle the row class back to keep it in sequence $row_class = $row_class == "even_row" ? "odd_row" : "even_row"; continue; } else { $tbody .= "<tr class=\"{$row_class}\">\n"; $wt = mktime(12, 0, 0, $month, $day_start_week + $thisday, $year); $wday = date("d", $wt); $wmonth = date("m", $wt); $wyear = date("Y", $wt); $wdate = date('Y-n-d', $wt); $day_cell_text = utf8_strftime($dformat, $wt); $day_cell_link = "day.php?year=" . strftime("%Y", $wt) . "&month=" . strftime("%m", $wt) . "&day=" . strftime("%d", $wt) . "&area={$area}"; $tbody .= day_cell_html($day_cell_text, $day_cell_link, $wdate); for ($s = $morning_slot_seconds; $s <= $evening_slot_seconds; $s += $resolution) { $is_invalid = $is_possibly_invalid[$thisday] && is_invalid_datetime(0, 0, $s, $wmonth, $wday, $wyear); // set up the query strings to be used for the link in the cell $query_strings = get_query_strings($user, $wmonth, $wday, $wyear, $s); // and then draw the cell if (!isset($week_map[0][$thisday][$s])) { $week_map[0][$thisday][$s] = array(); // to avoid an undefined index NOTICE error } $tbody .= cell_html($week_map[0][$thisday][$s], $query_strings, $is_invalid); } // end looping through the time slots if (FALSE != $row_labels_both_sides) { $tbody .= day_cell_html($day_cell_text, $day_cell_link, $wdate); } $tbody .= "</tr>\n"; } } // end looping through the days of the week } else { // the standard view, with days of the week along the top and times down the side for ($s = $morning_slot_seconds; $s <= $evening_slot_seconds; $s += $resolution, $row_class = $row_class == "even_row" ? "odd_row" : "even_row") { // Show the time linked to the URL for highlighting that time: $class = $row_class; if (isset($timetohighlight) && $s == $timetohighlight) { $class .= " row_highlight"; $url = $base_url; } else { $url = $base_url . "&timetohighlight={$s}"; } $tbody .= "<tr class=\"{$class}\">"; $tbody .= time_cell_html($s, $url); // See note above: weekday==0 is day $weekstarts, not necessarily Sunday. for ($thisday = 0; $thisday <= $num_of_days - 1; $thisday++) { if (is_hidden_day(($thisday + $weekstarts) % 7)) { // These days are to be hidden in the display $tbody .= "<td class=\"hidden_day\"> </td>\n"; } else { // set up the query strings to be used for the link in the cell $wt = mktime(12, 0, 0, $month, $day_start_week + $thisday, $year); $wday = date("d", $wt); $wmonth = date("m", $wt); $wyear = date("Y", $wt); $is_invalid = $is_possibly_invalid[$thisday] && is_invalid_datetime(0, 0, $s, $wmonth, $wday, $wyear); $query_strings = get_query_strings($user, $wmonth, $wday, $wyear, $s); // and then draw the cell if (!isset($week_map[0][$thisday][$s])) { $week_map[0][$thisday][$s] = array(); // to avoid an undefined index NOTICE error } $tbody .= cell_html($week_map[0][$thisday][$s], $query_strings, $is_invalid); } } // for loop // next lines to display times on right side if (FALSE != $row_labels_both_sides) { $tbody .= time_cell_html($s, $url); } $tbody .= "</tr>\n"; } } // end standard view (for the body) $tbody .= "</tbody>\n"; return $thead . $tfoot . $tbody; }
$res = grr_sql_query($sql); // Début affichage de la première ligne echo "<tr>"; tdcell("cell_hours"); echo " </td>\n"; //Corrige un bug avec certains fuseaux horaires (par exemple GMT-05:00 celui du Québec) : //plusieurs mois débutent par le dernier jours du mois précédent. //En changeant "gmmktime" par "mktime" le bug est corrigé //$t2=gmmktime(0,0,0,$month_num,1,$year_num); $t2 = mktime(0, 0, 0, $month_num, 1, $year_num); for ($k = 0; $k < $days_in_month; $k++) { $cday = date("j", $t2); $cmonth = date("m", $t2); $cweek = date("w", $t2); $cyear = date("Y", $t2); $name_day = ucfirst(utf8_strftime("%a<br />%d", $t2)); $temp = mktime(0, 0, 0, $cmonth, $cday, $cyear); $jour_cycle = grr_sql_query1("SELECT Jours FROM " . TABLE_PREFIX . "_calendrier_jours_cycle WHERE DAY='{$temp}'"); $t2 += 86400; // On inscrit le numéro du mois dans la deuxième ligne if ($display_day[$cweek] == 1) { echo tdcell("cell_hours"); echo "<div><a title=\"" . htmlspecialchars(get_vocab("see_all_the_rooms_for_the_day")) . "\" href=\"day.php?year={$year_num}&month={$month_num}&day={$cday}&area={$area}\">{$name_day}</a>"; if (Settings::get("jours_cycles_actif") == "Oui" && intval($jour_cycle) > -1) { if (intval($jour_cycle) > 0) { echo "<br /><b><i>" . ucfirst(substr(get_vocab("rep_type_6"), 0, 1)) . $jour_cycle . "</i></b>"; } else { if (strlen($jour_cycle) > 5) { $jour_cycle = substr($jour_cycle, 0, 3) . ".."; } echo "<br /><b><i>" . $jour_cycle . "</i></b>";
*/ $dataFromGet = filter_input_array(INPUT_GET); $dataFromGet['idLastInsert'] = $idPourEvent; $event = new EditEntryHandler($area_id, $dataFromGet, $id); $dispatcher->dispatch(EditEntryHandlerEvent::EDITENTRYHANDLER_AFTER_DB, $event); $area = mrbsGetRoomArea($room_id); $_SESSION['displ_msg'] = 'yes'; if ($message_error != '') { $_SESSION['session_message_error'] = $message_error; } Header('Location: ' . $page . ".php?year={$year}&month={$month}&day={$day}&area={$area}&room={$room_back}"); exit; } grr_sql_mutex_unlock('' . TABLE_PREFIX . '_entry'); if ($error_booking_in_past == 'yes') { $str_date = utf8_strftime('%d %B %Y, %H:%M', $date_now); print_header(); echo '<h2>' . get_vocab('booking_in_past') . '</h2>'; if ($rep_type != 0 && !empty($reps)) { echo '<p>' . get_vocab('booking_in_past_explain_with_periodicity') . $str_date . '</p>'; } else { echo '<p>' . get_vocab('booking_in_past_explain') . $str_date . '</p>'; } echo '<a href="' . $back . '&Err=yes">' . get_vocab('returnprev') . '</a>'; include 'include/trailer.inc.php'; die; } if ($error_duree_max_resa_area == 'yes') { $area_id = grr_sql_query1('SELECT area_id FROM ' . TABLE_PREFIX . "_room WHERE id='" . protect_data_sql($room_id) . "'"); $duree_max_resa_area = grr_sql_query1('SELECT duree_max_resa_area FROM ' . TABLE_PREFIX . "_area WHERE id='" . $area_id . "'"); print_header();
$tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['accessFicheResa'] = false; //echo PHP_EOL.'<table class="table-header"><tr>'; //tdcell($d[$cday]['color'][$i]); $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['color'] = getColor($d[$cday]['color'][$i]); $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['color'] = getColor($d[$cday]['color'][$i]); /** * todo refacto duplicate entre les deux choix du if */ if ($d[$cday]['res'][$i] != '-') { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['empruntee'] = true; //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; } else { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['empruntee'] = false; } if (isset($d[$cday]['option_reser'][$i]) && $d[$cday]['option_reser'][$i] != -1) { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['aConfirmerAuPlusTard'] = utf8_strftime($dformat, $d[$cday]['option_reser'][$i]); //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($d[$cday]['option_reser'][$i], $dformat),'" width="20" height="20" class="image" />',PHP_EOL; } else { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['aConfirmerAuPlusTard'] = false; } if (isset($d[$cday]['moderation'][$i]) && $d[$cday]['moderation'][$i] == 1) { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['moderation'] = true; //echo '<img src="img_grr/flag_moderation.png" alt="',get_vocab('en_attente_moderation'),'" title="',get_vocab('en_attente_moderation'),'" class="image" />',PHP_EOL; } else { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['aConfirmerAuPlusTard'] = false; } $Son_GenreRepeat = grr_sql_query1('SELECT ' . TABLE_PREFIX . '_type_area.type_name FROM ' . TABLE_PREFIX . '_type_area,' . TABLE_PREFIX . '_entry WHERE ' . TABLE_PREFIX . '_entry.type=' . TABLE_PREFIX . '_type_area.type_letter AND ' . TABLE_PREFIX . "_entry.id = '" . $d[$cday]['id'][$i] . "';"); if ($Son_GenreRepeat == -1) { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['repeat'] = false; //echo '<span class="small_planning">',$d[$cday]['data'][$i]; } else {
if ($weekcol != $weekday_start) { echo '<tr>', PHP_EOL; for ($weekcol = 0; $weekcol < $weekday_start; $weekcol++) { $num_week_day = ($weekcol + $weekstarts) % 7; if ($display_day[$num_week_day] == 1) { echo '<td class="cell_month_o">', PHP_EOL, '</td>', PHP_EOL; } } } $ferie = getHolidays($year); for ($cday = 1; $cday <= $days_in_month; $cday++) { $class = ""; $title = ""; $num_week_day = ($weekcol + $weekstarts) % 7; $t = mktime(0, 0, 0, $month, $cday, $year); $name_day = ucfirst(utf8_strftime("%d", $t)); $jour_cycle = grr_sql_query1("SELECT Jours FROM " . TABLE_PREFIX . "_calendrier_jours_cycle WHERE DAY='{$t}'"); if ($weekcol == 0) { echo '<tr>', PHP_EOL; } if ($display_day[$num_week_day] == 1) { if (Settings::get("show_holidays") == "Oui") { $ferie_true = 0; foreach ($ferie as $key => $value) { if ($t == $value) { $ferie_true = 1; break; } } $sh = getSchoolHolidays($t, $year); if ($sh[0] == true) {
echo "</table>"; // Configuration des plages horaires ... echo "<h3>" . get_vocab("configuration_plages_horaires") . "</h3>"; // Debut de la semaine: 0 pour dimanche, 1 pou lundi, etc. echo "<table border=\"1\" cellspacing=\"1\" cellpadding=\"6\">"; echo "<tr>\n"; echo "<td>" . get_vocab("weekstarts_area") . get_vocab("deux_points") . "</td>\n"; echo "<td style=\"width:30%;\"><select class=\"form-control\" name=\"weekstarts_area\" size=\"1\">\n"; $k = 0; while ($k < 7) { $tmp = mktime(0, 0, 0, 10, 2 + $k, 2005); echo "<option value=\"" . $k . "\" "; if ($k == $row['weekstarts_area']) { echo " selected=\"selected\""; } echo ">" . utf8_strftime("%A", $tmp) . "</option>\n"; $k++; } echo "</select></td>\n"; echo "</tr>"; // Definition des jours de la semaine e afficher sur les plannings et calendriers echo "<tr>\n"; echo "<td>" . get_vocab("cocher_jours_a_afficher") . "</td>\n"; echo "<td>\n"; for ($i = 0; $i < 7; $i++) { echo "<label><input name=\"display_day[" . $i . "]\" type=\"checkbox\""; if (substr($row["display_days"], $i, 1) == 'y') { echo " checked=\"checked\""; } echo " />" . day_name($i) . "</label><br />\n"; }
} $day++; } $month++; if ($month == 13) { $year++; $month = 1; } } } echo '<p>', get_vocab("les_journees_cochees_sont_ignorees"), '</p>', PHP_EOL; echo '<table class="table table-bordered">', PHP_EOL; $basetime = mktime(12, 0, 0, 6, 11 + $weekstarts, 2000); for ($i = 0; $i < 7; $i++) { $show = $basetime + $i * 24 * 60 * 60; $lday = utf8_strftime('%A', $show); echo '<tr>', PHP_EOL; echo '<td>', PHP_EOL, '<span class="small"><a href="admin_calend_ignore.php" onclick="setCheckboxesGrr(document.getElementById("formulaire"), true, ', $lday, ' ); return false;">', get_vocab("check_all_the"), $lday, 's</a></span>', PHP_EOL, '</td>', PHP_EOL; echo '<td>', PHP_EOL, '<span class="small"><a href="admin_calend_ignore.php" onclick="setCheckboxesGrr(document.getElementById("formulaire"), false, ', $lday, ' ); return false;">', get_vocab("uncheck_all_the"), $lday, 's</a></span>', PHP_EOL, '</td>', PHP_EOL; echo '</tr>', PHP_EOL; } echo '<tr>', PHP_EOL, '<td>', PHP_EOL, '<span class="small"><a href="admin_calend_ignore.php" onclick="setCheckboxesGrr(document.getElementById("formulaire"), false, "all"); return false;">', get_vocab("uncheck_all_"), '</a></span>', PHP_EOL, '</td>', PHP_EOL; echo '<td>', PHP_EOL, '</td>', PHP_EOL, '</tr>', PHP_EOL; echo '</table>', PHP_EOL; echo '<form action="admin_calend_ignore.php" method="post" id="formulaire">', PHP_EOL; echo '<table class="table table-bordered">', PHP_EOL; $n = Settings::get("begin_bookings"); $end_bookings = Settings::get("end_bookings"); $debligne = 1; $month = utf8_encode(strftime("%m", Settings::get("begin_bookings"))); $year = strftime("%Y", Settings::get("begin_bookings"));
echo "<script type=\"text/javascript\">\n<!--\n"; echo "EndActiveCell();\n"; echo "// -->\n</script>"; } } else { echo ' '; } } elseif ($descr != "") { #if it is booked then show echo " <a href=\"view_entry.php?id={$id}" . "&area={$area}&day={$wday}&month={$wmonth}&year={$wyear}\" " . "title=\"{$long_descr}\">{$descr}</a>"; } else { echo " \" "; } echo "</td>\n"; } # next lines to display times on right side if (FALSE != $times_right_side) { if ($enable_periods) { tdcell("red"); $time_t_stripped = preg_replace("/^0/", "", $time_t); echo "<a href=\"{$hilite_url}={$time_t}\" title=\"" . get_vocab("highlight_line") . "\">" . $periods[$time_t_stripped] . "</a></td>"; } else { tdcell("red"); echo "<a href=\"{$hilite_url}={$time_t}\" title=\"" . get_vocab("highlight_line") . "\">" . utf8_strftime(hour_min_format(), $t) . "</a></td>"; } } echo "</tr>\n"; } echo "</table>"; show_colour_key(); include "trailer.inc";
} $this_area_name = grr_sql_query1("select area_name from ".TABLE_PREFIX."_area where id=$area"); # Show Month, Year, Area, Room header: switch ($dateformat) { case "en": $dformat = "%A, %b %d"; break; case "fr": $dformat = "%A %d %b"; break; } echo "<div class=\"titre_planning\">".get_vocab("week").get_vocab("deux_points").utf8_strftime($dformat, $date_start)." - ". utf8_strftime($dformat, $date_end) . "<br /> $this_area_name - ".get_vocab("all_rooms")."</div>\n"; #y? are year, month and day of the previous week. #t? are year, month and day of the next week. $i= mktime(0,0,0,$month_week,$day_week-7,$year_week); $yy = date("Y",$i); $ym = date("m",$i); $yd = date("d",$i); $i= mktime(0,0,0,$month_week,$day_week+7,$year_week); $ty = date("Y",$i); $tm = date("m",$i); $td = date("d",$i); // Si format imprimable ($_GET['pview'] = 1), on n'affiche pas cette partie
} echo '<div class="titre_planning ' . $class . '">' . PHP_EOL; if (!isset($_GET['pview']) || $_GET['pview'] != 1) { echo '<table class="table-header">', PHP_EOL, '<tr>', PHP_EOL, '<td class="left">', PHP_EOL, '<button class="btn btn-default btn-xs" onclick="charger();javascript: location.href=\'day.php?year=' . $yy . '&month=' . $ym . '&day=' . $yd . '&area=' . $area . '\';"> <span class="glyphicon glyphicon-backward"></span> ', get_vocab("daybefore"), '</button>', PHP_EOL, '</td>', PHP_EOL, '<td>', PHP_EOL; include "include/trailer.inc.php"; echo '</td>', PHP_EOL, '<td class="right">', PHP_EOL, '<button class="btn btn-default btn-xs" onclick="charger();javascript: location.href=\'day.php?year=' . $ty . '&month=' . $tm . '&day=' . $td . '&area=' . $area . '\';"> ' . get_vocab('dayafter') . ' <span class="glyphicon glyphicon-forward"></span></button>', PHP_EOL, '</td>', PHP_EOL, '</tr>', PHP_EOL, '</table>', PHP_EOL; } echo '<h4 class="titre">' . ucfirst($this_area_name) . ' - ' . get_vocab("all_areas"); if ($settings->get("jours_cycles_actif") == "Oui" && intval($jour_cycle) > -1) { if (intval($jour_cycle) > 0) { echo ' - ' . get_vocab("rep_type_6") . " " . $jour_cycle; } else { echo ' - ' . $jour_cycle; } } echo '<br>' . ucfirst(utf8_strftime($dformat, $am7)) . '</h4>' . PHP_EOL; echo '</div>' . PHP_EOL; if (isset($_GET['precedent'])) { if ($_GET['pview'] == 1 && $_GET['precedent'] == 1) { echo '<span id="lienPrecedent"><button class="btn btn-default btn-xs" onclick="charger();javascript:history.back();">Précedent</button></span>' . PHP_EOL; } } echo '<div class="contenu_planning">' . PHP_EOL; echo '<table class="table-bordered table-striped">' . PHP_EOL; echo '<tr>' . PHP_EOL . '<th style="width:5%;">' . PHP_EOL; if ($enable_periods == 'y') { echo get_vocab("period"); } else { echo get_vocab("time"); } echo '</th>' . PHP_EOL;
if ($times_along_top) { // with times along the top and days of the week down the side // See note above: weekday==0 is day $weekstarts, not necessarily Sunday. for ($thisday = 0; $thisday <= $num_of_days - 1; $thisday++, $row_class = $row_class == "even_row" ? "odd_row" : "even_row") { if (is_hidden_day(($thisday + $weekstarts) % 7)) { // These days are to be hidden in the display: don't display a row // Toggle the row class back to keep it in sequence $row_class = $row_class == "even_row" ? "odd_row" : "even_row"; continue; } else { echo "<tr>\n"; $wt = mktime(12, 0, 0, $month, $day_start_week + $thisday, $year); $wday = date("d", $wt); $wmonth = date("m", $wt); $wyear = date("Y", $wt); $day_cell_text = utf8_strftime($dformat, $wt); $day_cell_link = "day.php?year=" . strftime("%Y", $wt) . "&month=" . strftime("%m", $wt) . "&day=" . strftime("%d", $wt) . "&area={$area}"; draw_day_cell($day_cell_text, $day_cell_link); for ($t = mktime($morningstarts, $morningstarts_minutes, 0, $month, $day_start_week + $j, $year); $t <= mktime($eveningends, $eveningends_minutes, 0, $month, $day_start_week + $j, $year); $t += $resolution) { // use hour:minute format $time_t = date($format, $t); // and get a stripped version for use with periods $time_t_stripped = preg_replace("/^0/", "", $time_t); // calculate hour and minute (needed for links) $hour = date("H", $t); $minute = date("i", $t); // set up the query strings to be used for the link in the cell $query_strings = array(); $query_strings['new_periods'] = "room={$room}&area={$area}&period={$time_t_stripped}&year={$wyear}&month={$wmonth}&day={$wday}"; $query_strings['new_times'] = "room={$room}&area={$area}&hour={$hour}&minute={$minute}&year={$wyear}&month={$wmonth}&day={$wday}"; $query_strings['booking'] = "area={$area}&day={$wday}&month={$wmonth}&year={$wyear}";
function reporton(&$row, &$last_area_room, &$last_date, $sortby, $display) { global $typel; global $enable_periods; // Display Area/Room, but only when it changes: $area_room = htmlspecialchars($row['area_name']) . " - " . htmlspecialchars($row['room_name']); $date = utf8_strftime("%d-%b-%Y", $row['start_time']); // entries to be sorted on area/room echo "<div class=\"div_report\">\n"; if ($sortby == "r") { if ($area_room != $last_area_room) { echo "<h2>" . get_vocab("room") . ": " . $area_room . "</h2>\n"; } if ($date != $last_date || $area_room != $last_area_room) { echo "<h3>" . get_vocab("date") . ": " . $date . "</h3>\n"; $last_date = $date; } // remember current area/room that is being processed. // this is done here as the if statement above needs the old // values if ($area_room != $last_area_room) { $last_area_room = $area_room; } } else { if ($date != $last_date) { echo "<h2>" . get_vocab("date") . ": " . $date . "</h2>\n"; } if ($area_room != $last_area_room || $date != $last_date) { echo "<h3>" . get_vocab("room") . ": " . $area_room . "</h3>\n"; $last_area_room = $area_room; } // remember current date that is being processed. // this is done here as the if statement above needs the old // values if ($date != $last_date) { $last_date = $date; } } echo "<div class=\"report_entry_title\">\n"; echo "<div class=\"report_entry_name\">\n"; // Brief Description (title), linked to view_entry: echo "<a href=\"view_entry.php?id=" . $row['entry_id'] . "\">" . htmlspecialchars($row['name']) . "</a>\n"; echo "</div>\n"; echo "<div class=\"report_entry_when\">\n"; // what do you want to display duration or end date/time if ($display == "d") { // Start date/time and duration: echo (empty($enable_periods) ? describe_span($row['start_time'], $row['end_time']) : describe_period_span($row['start_time'], $row['end_time'])) . "\n"; } else { // Start date/time and End date/time: echo (empty($enable_periods) ? start_to_end($row['start_time'], $row['end_time']) : start_to_end_period($row['start_time'], $row['end_time'])) . "\n"; } echo "</div>\n"; echo "</div>\n"; echo "<table>\n"; echo "<colgroup>\n"; echo "<col class=\"col1\">\n"; echo "<col class=\"col2\">\n"; echo "</colgroup>\n"; // Description: echo "<tr><td>" . get_vocab("description") . ":</td><td>" . mrbs_nl2br(htmlspecialchars($row['description'])) . "</td></tr>\n"; // Entry Type: $et = empty($typel[$row['type']]) ? "?" . $row['type'] . "?" : $typel[$row['type']]; echo "<tr><td>" . get_vocab("type") . ":</td><td>{$et}</td></tr>\n"; // Created by and last update timestamp: echo "<tr class=\"createdby\"><td>" . get_vocab("createdby") . ":</td><td>" . htmlspecialchars($row['create_by']) . "</td></tr>\n"; echo "<tr class=\"lastupdate\"><td>" . get_vocab("lastupdate") . ":</td><td>" . date_time_string($row['last_updated']) . "</td></tr>\n"; echo "</table>\n"; echo "</div>\n\n"; }
if ($javascript_cursor) { echo "<SCRIPT language=\"JavaScript\" type=\"text/javascript\" src=\"xbLib.js\"></SCRIPT>\n"; echo "<SCRIPT language=\"JavaScript\">InitActiveCell(" . ($show_plus_link ? "true" : "false") . ", " . "true, " . (FALSE != $times_right_side ? "true" : "false") . ", " . "\"{$highlight_method}\", " . "\"" . get_vocab("click_to_reserve") . "\"" . ");</SCRIPT>\n"; } #This is where we start displaying stuff echo "<table cellspacing=0 border=1 width=\"100%\">"; # The header row contains the weekday names and short dates. echo "<tr><th width=\"1%\"><br>" . ($enable_periods ? get_vocab("period") : get_vocab("time")) . "</th>"; if (empty($dateformat)) { $dformat = "%a<br>%b %d"; } else { $dformat = "%a<br>%d %b"; } for ($j = 0; $j <= $num_of_days - 1; $j++) { $t = mktime(12, 0, 0, $month, $day + $j, $year); echo "<th width=\"14%\"><a href=\"day.php?year=" . strftime("%Y", $t) . "&month=" . strftime("%m", $t) . "&day=" . strftime("%d", $t) . "&area={$area}\" title=\"" . get_vocab("viewday") . "\">" . utf8_strftime($dformat, $t) . "</a></th>\n"; } # next line to display times on right side if (FALSE != $times_right_side) { echo "<th width=\"1%\"><br>" . ($enable_periods ? get_vocab("period") : get_vocab("time")) . "</th>"; } echo "</tr>\n"; # This is the main bit of the display. Outer loop is for the time slots, # inner loop is for days of the week. # URL for highlighting a time. Don't use REQUEST_URI or you will get # the timetohighlight parameter duplicated each time you click. $hilite_url = "week.php?year={$year}&month={$month}&day={$day}&area={$area}&room={$room}&timetohighlight"; # if the first day of the week to be displayed contains as DST change then # move to the next day to get the hours in the day. $dst_change[0] != -1 ? $j = 1 : ($j = 0); $row_class = "even_row";
} elseif ($eveningends == 0) { $value = 12; } else { $value = $eveningends; } $params = array('label' => get_vocab("area_last_slot_start") . ":", 'name' => 'area_eveningends', 'value' => $value, 'attributes' => array('class="time_hour"', 'maxlength="2"')); generate_input($params); echo "<span>:</span>\n"; $params = array('name' => 'area_eveningends_minutes', 'value' => sprintf("%02d", $eveningends_minutes), 'attributes' => array('class="time_minute"', 'maxlength="2"')); generate_input($params); if (!$twentyfourhour_format) { echo "<div class=\"group ampm\">\n"; $checked = $eveningends < 12 ? "checked=\"checked\"" : ""; echo "<label><input name=\"area_evening_ampm\" type=\"radio\" value=\"am\" {$checked}>" . utf8_strftime($strftime_format['ampm'], mktime(1, 0, 0, 1, 1, 2000)) . "</label>\n"; $checked = $eveningends >= 12 ? "checked=\"checked\"" : ""; echo "<label><input name=\"area_evening_ampm\" type=\"radio\" value=\"pm\" {$checked}>" . utf8_strftime($strftime_format['ampm'], mktime(13, 0, 0, 1, 1, 2000)) . "</label>\n"; echo "</div>\n"; } echo "</div>\n"; echo "</div>\n"; // last_slot echo "</fieldset>\n"; // Booking policies $min_ba_value = $min_book_ahead_secs; toTimeString($min_ba_value, $min_ba_units); $max_ba_value = $max_book_ahead_secs; toTimeString($max_ba_value, $max_ba_units); echo "<fieldset id=\"booking_policies\">\n"; echo "<legend>" . get_vocab("booking_policies") . "</legend>\n"; // Note when using periods echo "<div id=\"book_ahead_periods_note\"" . ($enable_periods ? '' : ' class="js_none"') . ">\n";
function describe_span($starts, $ends, $dformat) { global $vocab, $twentyfourhour_format; $start_date = utf8_strftime($dformat, $starts); if ($twentyfourhour_format) { $timeformat = "%T"; } else { $ampm = date("a", $starts); $timeformat = "%I:%M{$ampm}"; } $start_time = strftime($timeformat, $starts); $duration = $ends - $starts; if ($start_time == "00:00:00" && $duration == 60 * 60 * 24) { return $start_date . " - " . get_vocab("all_day"); } toTimeString($duration, $dur_units); return $start_date . " " . $start_time . " - " . $duration . " " . $dur_units; }