// If we haven't been given a sensible date then get out of here and don't trey and make a booking
if (!isset($day) || !isset($month) || !isset($year) || !checkdate($month, $day, $year)) {
    header("Location: {$returl}");
    exit;
}
// Now construct the new query string
$returl .= formatURLDate($year, $month, $day);
// If the old sticky room is one of the rooms requested for booking, then don't change the sticky room.
// Otherwise change the sticky room to be one of the new rooms.
if (!in_array($room, $rooms)) {
    $room = $rooms[0];
}
// Find the corresponding area
$area = mrbsGetRoomArea($room);
// Complete the query string
$returl .= formatURLArea($area, $room);
// Handle private booking
// Enforce config file settings if needed
if ($private_mandatory) {
    $isprivate = $private_default;
} else {
    $isprivate = $private ? TRUE : FALSE;
}
// Check the user is authorised for this page
checkAuthorised();
// Also need to know whether they have admin rights
$user = getUserName();
$is_admin = authGetUserLevel($user) >= 2;
// If they're not an admin and multi-day bookings are not allowed, then
// set the end date to the start date
if (!$is_admin && $auth['only_admin_can_book_multiday']) {
Пример #2
0
    echo "<h1>" . get_vocab("no_rooms_for_area") . "</h1>";
    sql_free($res);
} else {
    // Show current date and timezone
    echo "<div id=\"dwm\">\n";
    echo "<h2>" . utf8_strftime($strftime_format['date'], $am7) . "</h2>\n";
    if ($display_timezone) {
        echo "<div class=\"timezone\">";
        echo get_vocab("timezone") . ": " . date('T', $am7) . " (UTC" . date('O', $am7) . ")";
        echo "</div>\n";
    }
    echo "</div>\n";
    // Generate Go to day before and after links
    $urlBefore = formatURLFull($yy, $ym, $yd, $area, $room_param);
    $urlAfter = formatURLFull($ty, $tm, $td, $area, $room_param);
    $urlArea = formatURLArea($area, $room_param);
    $before_after_links_html = "\n<div class=\"screenonly\">\n  <div class=\"date_nav\">\n    <div class=\"date_before\">\n      <a href=\"day/{$urlBefore}\">&lt;&lt;&nbsp;" . get_vocab("daybefore") . "\n      </a>\n    </div>\n    <div class=\"date_now\">\n      <a href=\"day/{$urlArea}\">" . get_vocab("gototoday") . "</a>\n    </div>\n    <div class=\"date_after\">\n      <a href=\"day/{$urlAfter}\">" . get_vocab("dayafter") . "&nbsp;&gt;&gt;\n      </a>\n    </div>\n  </div>\n</div>\n";
    // and output them
    print $before_after_links_html;
    // Include the active cell content management routines.
    // Must be included before the beginnning of the main table.
    if ($javascript_cursor) {
        echo "<script type=\"text/javascript\" src=\"xbLib.js\"></script>\n";
        echo "<script type=\"text/javascript\">\n";
        echo "//<![CDATA[\n";
        echo "InitActiveCell(" . ($show_plus_link ? "true" : "false") . ", " . "true, " . (FALSE != $row_labels_both_sides ? "true" : "false") . ", " . "\"{$highlight_method}\", " . "\"" . get_vocab("click_to_reserve") . "\"" . ");\n";
        echo "//]]>\n";
        echo "</script>\n";
    }
    // START DISPLAYING THE MAIN TABLE
    echo "<table class=\"dwm_main\" id=\"day_main\">\n";
Пример #3
0
echo "<div id=\"dwm\">\n";
echo "<h2>" . htmlspecialchars("{$this_area_name} - {$this_room_name}") . "</h2>\n";
echo "</div>\n";
//y? are year, month and day of the previous week.
//t? are year, month and day of the next week.
$i = mktime(12, 0, 0, $month, $day - 7, $year);
$yy = date("Y", $i);
$ym = date("m", $i);
$yd = date("d", $i);
$i = mktime(12, 0, 0, $month, $day + 7, $year);
$ty = date("Y", $i);
$tm = date("m", $i);
$td = date("d", $i);
// Show Go to week before and after links
$urlBefore = formatURLFull($yy, $ym, $yd, $area, $room);
$url = formatURLArea($area, $room);
$urlAfter = formatURLFull($ty, $tm, $td, $area, $room);
$before_after_links_html = "\n<div class=\"screenonly\">\n  <div class=\"date_nav\">\n    <div class=\"date_before\">\n      <a href=\"week/{$urlBefore}\">\n          &lt;&lt;&nbsp;" . get_vocab("weekbefore") . "\n      </a>\n    </div>\n    <div class=\"date_now\">\n      <a href=\"week/{$url}\">\n          " . get_vocab("gotothisweek") . "\n      </a>\n    </div>\n    <div class=\"date_after\">\n      <a href=\"week/{$urlAfter}\">\n          " . get_vocab("weekafter") . "&nbsp;&gt;&gt;\n      </a>\n    </div>\n  </div>\n</div>\n";
print $before_after_links_html;
// 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
Пример #4
0
     echo "<th><div>" . get_vocab("enabled") . "</div></th>\n";
 }
 echo "</tr>\n";
 echo "</thead>\n";
 echo "<tbody>\n";
 $row_class = "odd_row";
 foreach ($rooms as $r) {
     // Don't show ordinary users disabled rooms
     if ($is_admin || !$r['disabled']) {
         $row_class = $row_class == "even_row" ? "odd_row" : "even_row";
         echo "<tr class=\"{$row_class}\">\n";
         // Give admins delete and edit links
         $id = $r['id'];
         if ($is_admin) {
             // Delete link
             $url = formatURLArea($area, $id);
             echo "<td><div>\n";
             echo "<a href=\"del/{$url}-type:room\">\n";
             echo "<img src=\"images/delete.png\" width=\"16\" height=\"16\" \n                         alt=\"" . get_vocab("delete") . "\"\n                         title=\"" . get_vocab("delete") . "\">\n";
             echo "</a>\n";
             echo "</div></td>\n";
             // Delete link
             echo "<td><div>\n";
             echo "<a href=\"edit_area_room/room:{$id}-change_room:1-phase:1\">\n";
             echo "<img src=\"images/edit.png\" width=\"16\" height=\"16\" \n                         alt=\"" . get_vocab("edit") . "\"\n                         title=\"" . get_vocab("edit") . "\">\n";
             echo "</a>\n";
             echo "</div></td>\n";
         }
         echo "<td><div><a href=\"edit_area_room/room:{$id}-change_room:1-phase:1\">" . htmlspecialchars($r['room_name']) . "</a></div></td>\n";
         if ($is_admin) {
             // Don't show ordinary users the disabled status:  they are only going to see enabled rooms
            $assign_array[] = "private_default=" . $area_private_default;
            $assign_array[] = "private_mandatory=" . $area_private_mandatory;
            $assign_array[] = "private_override='" . $area_private_override . "'";
            $assign_array[] = "approval_enabled=" . $area_approval_enabled;
            $assign_array[] = "reminders_enabled=" . $area_reminders_enabled;
            $assign_array[] = "enable_periods=" . $area_enable_periods;
            $assign_array[] = "confirmation_enabled=" . $area_confirmation_enabled;
            $assign_array[] = "confirmed_default=" . $area_confirmed_default;
            $sql .= implode(",", $assign_array) . " WHERE id={$area}";
            if (sql_command($sql) < 0) {
                echo get_vocab("update_area_failed") . "<br>\n";
                trigger_error(sql_error(), E_USER_WARNING);
                fatal_error(FALSE, get_vocab("fatal_db_error"));
            }
            // If the database update worked OK, go back to the admin page
            $url = formatURLArea($area, NULL);
            Header("Location: admin/{$url}");
            exit;
        }
    }
}
// PHASE 1 - GET THE USER INPUT
// ----------------------------
print_header($day, $month, $year, isset($area) ? $area : "", isset($room) ? $room : "");
if ($is_admin) {
    // Heading is confusing for non-admins
    echo "<h2>" . get_vocab("editroomarea") . "</h2>\n";
}
// Non-admins will only be allowed to view room details, not change them
// (We would use readonly instead of disabled, but it is not valid for some
// elements, eg <select>)