Beispiel #1
0
function start_to_end($starts, $ends)
{
    global $twentyfourhour_format;
    $start_date = utf8_strftime('%A %d %B %Y', $starts);
    if ($twentyfourhour_format) {
        $timeformat = "%H:%M:%S";
    } 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);
    $end_date = utf8_strftime('%A %d %B %Y', $ends);
    if ($twentyfourhour_format) {
        $timeformat = "%H:%M:%S";
    } else {
        # This bit's necessary, because it seems %p in strftime format
        # strings doesn't work
        $ampm = utf8_date("a", $ends);
        $timeformat = "%I:%M:%S{$ampm}";
    }
    $end_time = utf8_strftime($timeformat, $ends);
    return $start_date . " " . $start_time . " - " . $end_date . " " . $end_time;
}
Beispiel #2
0
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;
}
Beispiel #3
0
    if (!$twentyfourhour_format && $start_hour > 12) {
        echo $start_hour - 12;
    } else {
        echo $start_hour;
    }
    ?>
" MAXLENGTH=2>:<INPUT NAME="minute" SIZE=2 VALUE="<?php 
    echo $start_min;
    ?>
" MAXLENGTH=2>
<?php 
    if (!$twentyfourhour_format) {
        $checked = $start_hour < 12 ? "checked" : "";
        echo "<INPUT NAME=\"ampm\" type=\"radio\" value=\"am\" {$checked}>" . utf8_date("a", mktime(1, 0, 0, 1, 1, 2000));
        $checked = $start_hour >= 12 ? "checked" : "";
        echo "<INPUT NAME=\"ampm\" type=\"radio\" value=\"pm\" {$checked}>" . utf8_date("a", mktime(13, 0, 0, 1, 1, 2000));
    }
    ?>
</TD></TR>
<?php 
} else {
    ?>
<TR><TD CLASS=CR><B><?php 
    echo get_vocab("period");
    ?>
</B></TD>
  <TD CLASS=CL>
    <SELECT NAME="period">
<?php 
    foreach ($periods as $p_num => $p_val) {
        echo "<OPTION VALUE={$p_num}";
Beispiel #4
0
                    }
                } else {
                    echo '&nbsp;';
                }
            } elseif ($descr != "") {
                #if it is booked then show
                echo " <a href=\"view_entry.php?id={$id}&area={$area}&day={$day}&month={$month}&year={$year}\" title=\"{$long_descr}\">{$descr}</a>";
            } else {
                echo "&nbsp;\"&nbsp;";
            }
            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>\n";
            } else {
                tdcell("red");
                echo "<a href=\"{$hilite_url}={$time_t}\" title=\"" . get_vocab("highlight_line") . "\">" . utf8_date(hour_min_format(), $t) . "</a></td>\n";
            }
        }
        echo "</tr>\n";
        reset($rooms);
    }
    echo "</table>\n";
    isset($output) ? print $output : '';
    show_colour_key();
}
include "trailer.inc";
Beispiel #5
0
 # URL for highlighting a time. Don't use REQUEST_URI or you will get
 # the timetohighlight parameter duplicated each time you click.
 $hilite_url = "day.php?year={$year}&month={$month}&day={$day}&area={$area}&timetohighlight";
 # This is the main bit of the display
 # We loop through time and then the rooms we just got
 # if the today is a day which includes a DST change then use
 # the day after to generate timesteps through the day as this
 # will ensure a constant time step
 $dst_change != -1 ? $j = 1 : ($j = 0);
 for ($t = mktime($morningstarts, 0, 0, $month, $day + $j, $year); $t <= mktime($eveningends, $eveningends_minutes, 0, $month, $day + $j, $year); $t += $resolution) {
     # convert timestamps to HHMM format without leading zeros
     $time_t = date("Gi", $t);
     # Show the time linked to the URL for highlighting that time
     echo "<tr>";
     tdcell("red");
     echo "<a href=\"{$hilite_url}={$time_t}\">" . utf8_date(hour_min_format(), $t) . "</a></td>";
     # Loop through the list of rooms we have for this area
     while (list($key, $room) = each($rooms)) {
         if (isset($today[$room][$time_t]["id"])) {
             $id = $today[$room][$time_t]["id"];
             $color = $today[$room][$time_t]["color"];
             $descr = htmlspecialchars($today[$room][$time_t]["data"]);
             $long_descr = $today[$room][$time_t]["long_descr"];
         } else {
             unset($id);
         }
         # $c is the colour of the cell that the browser sees. White normally,
         # red if were hightlighting that line and a nice attractive green if the room is booked.
         # We tell if its booked by $id having something in it
         if (isset($id)) {
             $c = $color;