Esempio n. 1
0
     echo "<br>DEBUG: result {$i}, id {$row['4']}, starts {$row['0']}, ends {$row['1']}\n";
 }
 # $d is a map of the screen that will be displayed
 # It looks like:
 #     $d[Day][Time][id]
 #                  [color]
 #                  [data]
 # where Day is in the range 0 to $num_of_days.
 # 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[0], $resolution, $am7[$j]), $am7[$j]);
 $end_t = min(round_t_up($row[1], $resolution, $am7[$j]) - $resolution, $pm7[$j]);
 for ($t = $start_t; $t <= $end_t; $t += $resolution) {
     $d[$j][date($format, $t)]["id"] = $row[4];
     $d[$j][date($format, $t)]["color"] = $row[2];
     $d[$j][date($format, $t)]["data"] = "";
     $d[$j][date($format, $t)]["long_descr"] = "";
 }
 # 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[$j]) {
     $d[$j][date($format, $am7[$j])]["data"] = $row[3];
     $d[$j][date($format, $am7[$j])]["long_descr"] = $row[5];
 } else {
     $d[$j][date($format, $start_t)]["data"] = $row[3];
     $d[$j][date($format, $start_t)]["long_descr"] = $row[5];
Esempio n. 2
0
File: day.php Progetto: swirly/GRR
    $test = $display_day[date("w", $i)];
    $ind++;
}
$ty = date("Y", $i);
$tm = date("m", $i);
$td = date("d", $i);
$am7 = mktime($morningstarts, 0, 0, $month, $day, $year);
$pm7 = mktime($eveningends, $eveningends_minutes, 0, $month, $day, $year);
$this_area_name = grr_sql_query1("SELECT area_name FROM " . TABLE_PREFIX . "_area WHERE id='" . protect_data_sql($area) . "'");
$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\nFROM " . TABLE_PREFIX . "_entry, " . TABLE_PREFIX . "_room\nWHERE " . TABLE_PREFIX . "_entry.room_id = " . TABLE_PREFIX . "_room.id\nAND area_id = '" . protect_data_sql($area) . "'\nAND start_time < " . ($pm7 + $resolution) . " AND end_time > {$am7} ORDER BY start_time";
$res = grr_sql_query($sql);
if (!$res) {
    echo grr_sql_error();
} else {
    for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
        $start_t = max(round_t_down($row['1'], $resolution, $am7), $am7);
        $end_t = min(round_t_up($row['2'], $resolution, $am7) - $resolution, $pm7);
        $cellules[$row['4']] = ($end_t - $start_t) / $resolution + 1;
        $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'];
            $today[$row['0']][$t]["description"] = affichage_resa_planning($row['8'], $row['4']);
        }
        if ($row['1'] < $am7) {
            $today[$row['0']][$am7]["data"] = affichage_lien_resa_planning($row['3'], $row['4']);
Esempio n. 3
0
File: week.php Progetto: Birssan/GRR
if ($debug_flag) {
    echo "<br />DEBUG: query={$sql} <br />first_slot={$first_slot} - last_slot={$last_slot}\n";
}
$res = grr_sql_query($sql);
if (!$res) {
    echo grr_sql_error();
} else {
    for ($i = 0; $row = grr_sql_row($res, $i); $i++) {
        if ($debug_flag) {
            echo "<br />DEBUG: result {$i}, id {$row['4']}, starts {$row['0']} (" . affiche_date($row[0]) . "), ends {$row['1']} (" . affiche_date($row[1]) . ")\n";
        }
        $month_current = date("m", $row[0]);
        $day_current = date("d", $row[0]);
        $year_current = date("Y", $row[0]);
        $debut_jour = mktime($morningstarts, 0, 0, $month_current, $day_current, $year_current);
        $t = max(round_t_down($row[0], $resolution, $debut_jour), $week_start);
        $end_t = min((int) round_t_up((int) $row[1], (int) $resolution, $debut_jour), (int) $week_end + 1);
        $weekday = (date("w", $t) + 7 - $weekstarts) % 7;
        $prev_weekday = -1;
        $slot = ($t - $week_midnight) % 86400 / $resolution;
        $firstday = date("d", $t);
        $lastday = date("d", $row[1]);
        $heigthSlotHoure = 60 / ($this_area_resolution / 60);
        do {
            if ($debug_flag) {
                echo "<br />DEBUG: t={$t} (" . affiche_date($t) . "), end_t={$end_t} (" . affiche_date($end_t) . "), weekday={$weekday}, slot={$slot}\n";
            }
            if ($slot < $first_slot) {
                $slot = $first_slot;
                $t = $weekday * 86400 + $am7;
                continue;
Esempio n. 4
0
function map_add_booking($row, &$column, $am7, $pm7)
{
    // Enters the contents of the booking found in $row into $column, which is
    // a column of the map of the bookings being prepared ready for display.
    //
    // $column    the column of the map that is being prepared (see below)
    // $row       a booking from the database
    // $am7       the start of the first slot of the booking day (Unix timestamp)
    // $pm7       the start of the last slot of the booking day (Unix timestamp)
    // $row is expected to have the following field names, when present:
    //       room_id
    //       start_time
    //       end_time
    //       name
    //       repeat_id
    //       entry_id
    //       type
    //       entry_description
    //       entry_create_by
    //       status
    // $column is a column of the map of the screen that will be displayed
    // It looks like:
    //     $column[s][n][id]
    //                  [is_repeat]
    //                  [is_multiday_start]  a boolean indicating if the booking stretches
    //                                       beyond the day start
    //                  [is_multiday_end]    a boolean indicating if the booking stretches
    //                                          beyond the day end
    //                  [color]
    //                  [data]
    //                  [long_descr]
    //                  [create_by]
    //                  [room_id]
    //                  [start_time]
    //                  [slots]
    //                  [status]
    // s is the number of nominal seconds (ie ignoring DST changes] since the
    // start of the calendar day which has the start of the booking day
    // slots records the duration of the booking in number of time slots.
    // Used to calculate how high to make the block used for clipping
    // overflow descriptions.
    // 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.
    // Time is of the format HHMM without leading zeros.
    //
    // [n] exists because it's possible that there may be multiple bookings
    // in the same time slot.   Normally this won't be the case.   However it
    // can arise legitimately if you increase the resolution, or shift the
    // displayed day.   For example if you previously had a resolution of 1800
    // seconds you might have a booking (A) for 1000-1130 and another (B) for 1130-1230.
    // If you then increase the resolution to 3600 seconds, these two bookings
    // will both occupy the 1100-1200 time slot.   [n] starts at 0.   For
    // the example above the map for the room would look like this
    //
    //       0  1
    // 1000  A
    // 1100  A  B
    // 1200  B
    //
    // Adjust the starting and ending times so that bookings which don't
    // start or end at a recognized time still appear.
    global $resolution;
    global $is_private_field;
    //$user = getUserName();
    /*if (is_private_event($row['status'] & STATUS_PRIVATE) &&
          !getWritable($row['entry_create_by'], $user, $row['room_id']))
      {
          $row['status'] |= STATUS_PRIVATE;   // Set the private bit
          if ($is_private_field['entry.name'])
          {
              $row['name']= "[".get_vocab('unavailable')."]";
          }
          if ($is_private_field['entry.description'])
          {
              $row['entry_description']= "[".get_vocab('unavailable')."]";
          }
      }
      else
      {
          $row['status'] &= ~STATUS_PRIVATE;  // Clear the private bit
      }*/
    $is_multiday_start = $row['start_time'] < $am7;
    $is_multiday_end = $row['end_time'] > $pm7 + $resolution;
    $start_t = max(round_t_down($row['start_time'], $resolution, $am7), $am7);
    $end_t = min(round_t_up($row['end_time'], $resolution, $am7) - $resolution, $pm7);
    // calculate the times used for indexing - we index by nominal seconds since the start
    // of the calendar day which has the start of the booking day
    $start_s = nominal_seconds($start_t);
    $end_s = nominal_seconds($end_t);
    for ($s = $start_s; $s <= $end_s; $s += $resolution) {
        // find the first free index (in case there are multiple bookings in a timeslot)
        $n = 0;
        while (!empty($column[$s][$n]["id"])) {
            $n++;
        }
        // fill in the id, type and start time
        $column[$s][$n]["id"] = $row['entry_id'];
        $column[$s][$n]["is_repeat"] = isset($row['repeat_id']);
        $column[$s][$n]["is_multiday_start"] = $is_multiday_start;
        $column[$s][$n]["is_multiday_end"] = $is_multiday_end;
        $column[$s][$n]["status"] = $row['status'];
        $column[$s][$n]["color"] = $row['type'];
        $column[$s][$n]["start_time"] = hour_min($start_s);
        $column[$s][$n]["slots"] = NULL;
        // to avoid undefined index NOTICE errors
        // if it's a multiple booking also fill in the name and description
        if ($n > 0) {
            $column[$s][$n]["data"] = $row['type'];
            //$column[$s][$n]["long_descr"] = $row['entry_description'];
            //$column[$s][$n]["create_by"] = $row['entry_create_by'];
            //$column[$s][$n]["room_id"] = $row['room_id'];
        } else {
            $column[$s][$n]["data"] = NULL;
            $column[$s][$n]["long_descr"] = NULL;
            $column[$s][$n]["create_by"] = NULL;
            $column[$s][$n]["room_id"] = NULL;
        }
    }
    // end for
    // Show the name of the booker, the description and the number of complete
    // slots in the first complete slot that the booking happens in, or at the
    // start of the day if it started before today.
    // Find the number of time slots that the booking occupies, and the index
    // of the first slot that this booking has entirely to itself
    // We need to adjust the start and end times for DST transitions as the display
    // ignores DST
    $n_slots = intval(($end_t - $start_t - cross_dst($start_t, $end_t)) / $resolution) + 1;
    $first_slot = $start_s;
    // If the last time slot is already occupied, we have a multiple
    // booking in the last slot, so decrement the number of slots that
    // we will display for this booking
    if (isset($column[$end_s][1]["id"])) {
        $n_slots--;
        // If we're only the second booking to land on this time slot
        // then we'll have to adjust the information held for the first booking
        // (unless it's just one slot long in the first place, when it
        // doesn't matter as it will now be part of a multiple booking).
        // If we are the third booking or more, then it will have already
        // been adjusted.
        if (!isset($column[$end_s][2]["id"])) {
            if ($column[$end_s][0]["slots"] > 1) {
                // Move the name and description into the new first slot and decrement the number of slots
                $column[$end_s + $resolution][0]["data"] = $column[$end_s][0]["data"];
                //$column[$end_s + $resolution][0]["long_descr"] = $column[$end_s][0]["long_descr"];
                //$column[$end_s + $resolution][0]["create_by"]  = $column[$end_s][0]["create_by"];
                //$column[$end_s + $resolution][0]["room_id"]    = $column[$end_s][0]["room_id"];
                $column[$end_s + $resolution][0]["slots"] = $column[$end_s][0]["slots"] - 1;
            }
        }
    }
    // and if the first time slot is already occupied, decrement
    // again, adjust the first slot for this booking
    if (isset($column[$start_s][1]["id"])) {
        $n_slots--;
        $first_slot += $resolution;
        // If we're only the second booking to land on this time slot
        // then we'll have to adjust the information held for the first booking
        if (!isset($column[$start_s][2]["id"])) {
            // Find the first slot ($s) of the first booking
            $first_booking_id = $column[$start_s][0]["id"];
            $r = $start_s;
            // If you've got to the first slot of the day then that must be the
            // first slot of the first booking
            while ($r > $am7) {
                // Otherwise, step back one slot.
                $r -= $resolution;
                // If that slot contains the first booking, then step back again
                if (isset($column[$r])) {
                    foreach ($column[$r] as $booking) {
                        if ($booking["id"] == $first_booking_id) {
                            continue 2;
                            // next iteration of the while loop
                        }
                    }
                }
                // If not, then we've stepped back one slot past the start of
                // the first booking, so step forward again and finish
                $r += $resolution;
                break;
            }
            // end while
            // Now we've found the time ($r) of the first slot of the first booking
            // we need to find its index ($i)
            foreach ($column[$r] as $i => $booking) {
                if ($booking["id"] == $first_booking_id) {
                    break;
                }
            }
            // Finally decrement the slot count for the first booking
            // no need to worry about count going < 1: the multiple booking display
            // does not use the slot count.
            $column[$r][$i]["slots"]--;
            // and put the name and description in the multiply booked slot
            $column[$start_s][0]["data"] = $column[$r][$i]["data"];
            //$column[$start_s][0]["long_descr"] = $column[$r][$i]["long_descr"];
            //$column[$start_s][0]["create_by"]  = $column[$r][$i]["create_by"];
            //$column[$start_s][0]["room_id"]    = $column[$r][$i]["room_id"];
        }
    }
    // now we've got all the information we can enter it in the first complete
    // slot for the booking (provided it's not a multiple booking slot)
    if (!isset($column[$first_slot][1]["id"])) {
        $column[$first_slot][0]["data"] = $row['type'];
        //$column[$first_slot][0]["long_descr"] = $row['entry_description'];
        //$column[$first_slot][0]["create_by"]  = $row['entry_create_by'];
        //$column[$first_slot][0]["room_id"]    = $row['room_id'];
        $column[$first_slot][0]["slots"] = $n_slots;
    }
}
Esempio n. 5
0
    $resolution = 60;
}
// Now work out the start and times
$starttime = mktime(0, 0, $start_seconds, $start_month, $start_day, $start_year);
$endtime = mktime(0, 0, $end_seconds, $end_month, $end_day, $end_year);
// If we're using periods then the endtime we've been returned by the form is actually
// the beginning of the last period in the booking (it's more intuitive for users this way)
// so we need to add on 60 seconds (1 period)
if ($enable_periods) {
    $endtime = $endtime + 60;
}
// Round down the starttime and round up the endtime to the nearest slot boundaries
// (This step is probably unnecesary now that MRBS always returns times aligned
// on slot boundaries, but is left in for good measure).
$am7 = get_start_first_slot($start_month, $start_day, $start_year);
$starttime = round_t_down($starttime, $resolution, $am7);
$endtime = round_t_up($endtime, $resolution, $am7);
// If they asked for 0 minutes, and even after the rounding the slot length is still
// 0 minutes, push that up to 1 resolution unit.
if ($endtime == $starttime) {
    $endtime += $resolution;
}
if (isset($rep_type) && $rep_type != REP_NONE && isset($rep_end_month) && isset($rep_end_day) && isset($rep_end_year)) {
    // Get the repeat entry settings
    $end_date = mktime(intval($start_seconds / SECONDS_PER_HOUR), intval($start_seconds % SECONDS_PER_HOUR / 60), 0, $rep_end_month, $rep_end_day, $rep_end_year);
} else {
    $rep_type = REP_NONE;
    $end_date = 0;
    // to avoid an undefined variable notice
}
if (!isset($rep_day)) {
Esempio n. 6
0
function process_event($vevent)
{
    global $import_default_type, $skip;
    global $morningstarts, $morningstarts_minutes, $resolution;
    // We are going to cache the settings ($resolution etc.) for the rooms
    // in order to avoid lots of database lookups
    static $room_settings = array();
    // Set up the booking with some defaults
    $booking = array();
    $booking['status'] = 0;
    $booking['rep_type'] = REP_NONE;
    $booking['type'] = $import_default_type;
    // Parse all the lines first because we'll need to get the start date
    // for calculating some of the other settings
    $properties = array();
    $problems = array();
    $line = current($vevent);
    while ($line !== FALSE) {
        $property = parse_ical_property($line);
        // Ignore any sub-components (eg a VALARM inside a VEVENT) as MRBS does not
        // yet handle things like reminders.  Skip through to the end of the sub-
        // component.   Just in case you can have sub-components at a greater depth
        // than 1 (not sure if you can), make sure we've got to the matching END.
        if ($property['name'] != 'BEGIN') {
            $properties[$property['name']] = array('params' => $property['params'], 'value' => $property['value']);
        } else {
            $component = $property['value'];
            while (!($property['name'] == 'END' && $property['value'] == $component) && ($line = next($vevent))) {
                $property = parse_ical_property($line);
            }
        }
        $line = next($vevent);
    }
    // Get the start time because we'll need it later
    if (!isset($properties['DTSTART'])) {
        trigger_error("No DTSTART", E_USER_WARNING);
    } else {
        $booking['start_time'] = get_time($properties['DTSTART']['value'], $properties['DTSTART']['params']);
    }
    // Now go through the rest of the properties
    foreach ($properties as $name => $details) {
        switch ($name) {
            case 'ORGANIZER':
                $booking['create_by'] = get_create_by($details['value']);
                break;
            case 'SUMMARY':
                $booking['name'] = $details['value'];
                break;
            case 'DESCRIPTION':
                $booking['description'] = $details['value'];
                break;
            case 'LOCATION':
                $error = '';
                $booking['room_id'] = get_room_id($details['value'], $error);
                if ($booking['room_id'] === FALSE) {
                    $problems[] = $error;
                }
                break;
            case 'DTEND':
                $booking['end_time'] = get_time($details['value'], $details['params']);
                break;
            case 'DURATION':
                trigger_error("DURATION not yet supported by MRBS", E_USER_WARNING);
                break;
            case 'RRULE':
                $rrule_errors = array();
                $repeat_details = get_repeat_details($details['value'], $booking['start_time'], $rrule_errors);
                if ($repeat_details === FALSE) {
                    $problems = array_merge($problems, $rrule_errors);
                } else {
                    foreach ($repeat_details as $key => $value) {
                        $booking[$key] = $value;
                    }
                }
                break;
            case 'CLASS':
                if (in_array($details['value'], array('PRIVATE', 'CONFIDENTIAL'))) {
                    $booking['status'] |= STATUS_PRIVATE;
                }
                break;
            case 'STATUS':
                if ($details['value'] == 'TENTATIVE') {
                    $booking['status'] |= STATUS_TENTATIVE;
                }
                break;
            case 'UID':
                $booking['ical_uid'] = $details['value'];
                break;
            case 'SEQUENCE':
                $booking['ical_sequence'] = $details['value'];
                break;
            case 'LAST-MODIFIED':
                // We probably ought to do something with LAST-MODIFIED and use it
                // for the timestamp field
                break;
            default:
                break;
        }
    }
    // If we didn't manage to work out a username then just put the booking
    // under the name of the current user
    if (!isset($booking['create_by'])) {
        $booking['create_by'] = getUserName();
    }
    // A SUMMARY is optional in RFC 5545, however a brief description is mandatory
    // in MRBS.   So if the VEVENT didn't include a name, we'll give it one
    if (!isset($booking['name'])) {
        $booking['name'] = "Imported event - no SUMMARY name";
    }
    // On the other hand a UID is mandatory in RFC 5545.   We'll be lenient and
    // provide one if it is missing
    if (!isset($booking['ical_uid'])) {
        $booking['ical_uid'] = generate_global_uid($booking['name']);
        $booking['sequence'] = 0;
        // and we'll start the sequence from 0
    }
    // LOCATION is optional in RFC 5545 but is obviously mandatory in MRBS.
    // We could maybe have a default room on the form and use that
    if (!isset($booking['room_id'])) {
        $problems[] = get_vocab("no_LOCATION");
    }
    if (empty($problems)) {
        // Get the area settings for this room, if we haven't got them already
        if (!isset($room_settings[$booking['room_id']])) {
            get_area_settings(get_area($booking['room_id']));
            $room_settings[$booking['room_id']]['morningstarts'] = $morningstarts;
            $room_settings[$booking['room_id']]['morningstarts_minutes'] = $morningstarts_minutes;
            $room_settings[$booking['room_id']]['resolution'] = $resolution;
        }
        // Round the start and end times to slot boundaries
        $date = getdate($booking['start_time']);
        $m = $date['mon'];
        $d = $date['mday'];
        $y = $date['year'];
        $am7 = mktime($room_settings[$booking['room_id']]['morningstarts'], $room_settings[$booking['room_id']]['morningstarts_minutes'], 0, $m, $d, $y);
        $booking['start_time'] = round_t_down($booking['start_time'], $room_settings[$booking['room_id']]['resolution'], $am7);
        $booking['end_time'] = round_t_up($booking['end_time'], $room_settings[$booking['room_id']]['resolution'], $am7);
        // Make the bookings
        $bookings = array($booking);
        $result = mrbsMakeBookings($bookings, NULL, FALSE, $skip);
        if ($result['valid_booking']) {
            return TRUE;
        }
    }
    // There were problems - list them
    echo "<div class=\"problem_report\">\n";
    echo get_vocab("could_not_import") . " UID:" . htmlspecialchars($booking['ical_uid']);
    echo "<ul>\n";
    foreach ($problems as $problem) {
        echo "<li>" . htmlspecialchars($problem) . "</li>\n";
    }
    if (!empty($result['rules_broken'])) {
        echo "<li>" . get_vocab("rules_broken") . "\n";
        echo "<ul>\n";
        foreach ($result['rules_broken'] as $rule) {
            echo "<li>{$rule}</li>\n";
        }
        echo "</ul></li>\n";
    }
    if (!empty($result['conflicts'])) {
        echo "<li>" . get_vocab("conflict") . "\n";
        echo "<ul>\n";
        foreach ($result['conflicts'] as $conflict) {
            echo "<li>{$conflict}</li>\n";
        }
        echo "</ul></li>\n";
    }
    echo "</ul>\n";
    echo "</div>\n";
    return FALSE;
}
Esempio n. 7
0
if ($debug_flag) {
    echo "<br>DEBUG: query={$sql} <br>slots={$first_slot}:{$last_slot}\n";
}
$res = sql_query($sql);
if (!$res) {
    echo sql_error();
} else {
    for ($i = 0; $row = sql_row($res, $i); $i++) {
        if ($debug_flag) {
            echo "<br>DEBUG: result {$i}, id {$row['4']}, starts {$row['0']}, ends {$row['1']}\n";
        }
        # Fill in slots for the meeting. Start at the meeting start time or
        # week start (which ever is later), and end one slot before the meeting
        # end time or week end (which ever is earlier).
        # Note: int casts on database rows for min and max is needed for PHP3.
        $t = max(round_t_down($row[0], $resolution, $am7), $week_start);
        $end_t = min((int) round_t_up((int) $row[1], (int) $resolution, $am7), (int) $week_end + 1);
        $weekday = (date("w", $t) + 7 - $weekstarts) % 7;
        $prev_weekday = -1;
        # Invalid value to force initial label.
        $slot = ($t - $week_midnight) % 86400 / $resolution;
        do {
            if ($debug_flag) {
                echo "<br>DEBUG: t={$t}, weekday={$weekday}, slot={$slot}\n";
            }
            if ($slot < $first_slot) {
                # This is before the start of the displayed day; skip to first slot.
                $slot = $first_slot;
                $t = $weekday * 86400 + $am7;
                continue;
            }
Esempio n. 8
0
while ($R_room = mysql_fetch_assoc($Q_room)) {
    $rooms[$R_room['room_id']] = $R_room['room_name'];
}
$entries = array();
$timed_entries = array();
foreach ($rooms as $room_id => $room) {
    $events_room = checktime_Room($start, $end, $area, $room_id);
    if (isset($events_room[$room_id])) {
        foreach ($events_room[$room_id] as $entry_id) {
            $event = getEntry($entry_id);
            if (count($event)) {
                $entries[$event['entry_id']] = $event;
                if ($event['time_start'] < $start) {
                    $event['time_start'] = $start;
                }
                $event['time_start'] = round_t_down($event['time_start'], $resolution);
                $timed_entries[$event['time_start']][$event['entry_id']] = $event['entry_id'];
            }
        }
    }
}
echo '<table width="1024" style="border-collapse: collapse;">' . chr(10);
echo ' <tr>' . chr(10);
echo '  <td height="135px">' . chr(10);
echo ' <tr>' . chr(10);
echo '  <td width="160" height="200px">&nbsp;</td>' . chr(10);
echo '  <td align="center" valign="top"><font style="font-size: 110px; font-family: arial;">' . $area2['area_name'] . '</font></td>' . chr(10);
echo ' <tr>' . chr(10);
echo '<td width="1000" align="center" colspan="2" height="360px" style="padding: 40px 100px 40px 100px;">';
foreach ($entries as $entry) {
    if ($entry['infoscreen_txt'] != '') {
Esempio n. 9
0
    #row[3] = short description
    #row[4] = id of this booking
    #row[5] = type (internal/external)
    # $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);
    $end_t = min(round_t_up($row[2], $resolution) - $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"] = "";
    }
    # 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"] = $row[3];
    } else {
        $today[$row[0]][$start_t]["data"] = $row[3];
    }
}
# We need to know what all the rooms area called, so we can show them all