示例#1
0
             # Starts before today, ends before midnight
             $d[$day_num]["data"][] = "<====~" . userdate($row[1], hour_min_format());
             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 = ereg_replace(" ", "&nbsp;", period_time_string($row[0]));
     $end_str = ereg_replace(" ", "&nbsp;", period_time_string($row[1], -1));
     switch (cmp3($row[0], $midnight[$day_num]) . cmp3($row[1], $midnight_tonight[$day_num] + 1)) {
         case "> < ":
             # Starts after midnight, ends before midnight
         # Starts after midnight, ends before midnight
         case "= < ":
             # Starts at midnight, ends before midnight
             $d[$day_num]["data"][] = $start_str . "~" . $end_str;
             break;
         case "> = ":
             # Starts after midnight, ends at midnight
             $d[$day_num]["data"][] = $start_str . "~24:00";
             break;
         case "> > ":
             # Starts after midnight, continues tomorrow
             $d[$day_num]["data"][] = $start_str . "~====>";
             break;
示例#2
0
 $day_num = date("j", $t);
 $midnight = mktime(0, 0, 0, $month, $day_num, $year);
 while ($t < $end_t) {
     if ($debug_flag) {
         echo "<br>DEBUG: Entry {$row['2']} day {$day_num}\n";
     }
     $d[$day_num]["id"][] = $row[2];
     $d[$day_num]["shortdescrip"][] = $row[3];
     $midnight_tonight = $midnight + 86400;
     # Describe the start and end time, accounting for "all day"
     # and for entries starting before/ending after today.
     # There are 9 cases, for start time < = or > midnight this morning,
     # and end time < = or > midnight tonight.
     # Use ~ (not -) to separate the start and stop times, because MSIE
     # will incorrectly line break after a -.
     switch (cmp3($row[0], $midnight) . cmp3($row[1], $midnight_tonight)) {
         case "> < ":
             # Starts after midnight, ends before midnight
         # Starts after midnight, ends before midnight
         case "= < ":
             # Starts at midnight, ends before midnight
             $d[$day_num]["data"][] = date(hour_min_format(), $row[0]) . "~" . date(hour_min_format(), $row[1]);
             break;
         case "> = ":
             # Starts after midnight, ends at midnight
             $d[$day_num]["data"][] = date(hour_min_format(), $row[0]) . "~24:00";
             break;
         case "> > ":
             # Starts after midnight, continues tomorrow
             $d[$day_num]["data"][] = date(hour_min_format(), $row[0]) . "~====&gt;";
             break;
示例#3
0
             // Starts before today, ends before midnight
             $d[$day_num]["data"][] = "&lt;====~" . htmlspecialchars(utf8_strftime(hour_min_format(), $row['end_time']));
             break;
         case "< = ":
             // Starts before today, ends at midnight
             $d[$day_num]["data"][] = "&lt;====" . $all_day;
             break;
         case "< > ":
             // Starts before today, continues tomorrow
             $d[$day_num]["data"][] = "&lt;====" . $all_day . "====&gt;";
             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 "> < ":
             // Starts after midnight, ends before midnight
         // Starts after midnight, ends before midnight
         case "= < ":
             // Starts at midnight, ends before midnight
             $d[$day_num]["data"][] = $start_str . "~" . $end_str;
             break;
         case "> = ":
             // Starts after midnight, ends at midnight
             $d[$day_num]["data"][] = $start_str . "~24:00";
             break;
         case "> > ":
             // Starts after midnight, continues tomorrow
             $d[$day_num]["data"][] = $start_str . "~====&gt;";
             break;
示例#4
0
             // Starts before today, ends before midnight
             $d[$day_num]["data"][] = "&lt;====~" . htmlspecialchars(utf8_strftime(hour_min_format(), $row['end_time']));
             break;
         case "< = ":
             // Starts before today, ends at midnight
             $d[$day_num]["data"][] = "&lt;====" . $all_day;
             break;
         case "< > ":
             // Starts before today, continues tomorrow
             $d[$day_num]["data"][] = "&lt;====" . $all_day . "====&gt;";
             break;
     }
 } else {
     $start_str = period_time_string($row['start_time']);
     $end_str = period_time_string($row['end_time'], -1);
     switch (cmp3($row['start_time'], $am7[$day_num]) . cmp3($row['end_time'], $pm7[$day_num] + 1)) {
         case "> < ":
             // Starts after midnight, ends before midnight
         // Starts after midnight, ends before midnight
         case "= < ":
             // Starts at midnight, ends before midnight
             $d[$day_num]["data"][] = $start_str . "~" . $end_str;
             break;
         case "> = ":
             // Starts after midnight, ends at midnight
             $d[$day_num]["data"][] = $start_str . "~24:00";
             break;
         case "> > ":
             // Starts after midnight, continues tomorrow
             $d[$day_num]["data"][] = $start_str . "~====&gt;";
             break;
示例#5
0
function cmp2($x, $y)
{
    cmp3($x, $y);
    cmp3($y, $x);
}
示例#6
0
function get_booking_summary($start, $end, $day_start, $day_end)
{
    global $enable_periods;
    // Use ~ (not -) to separate the start and stop times, because MSIE
    // will incorrectly line break after a -.
    $separator = '~';
    $after_today = "====&gt;";
    $before_today = "&lt;====";
    $midnight = "24:00";
    // need to fix this so it works with AM/PM configurations (and for that matter 24h)
    // Localized "all day" text but with non-breaking spaces:
    $all_day = preg_replace("/ /", "&nbsp;", get_vocab("all_day"));
    if ($enable_periods) {
        $start_str = period_time_string($start);
        $end_str = period_time_string($end, -1);
    } else {
        $start_str = htmlspecialchars(utf8_strftime(hour_min_format(), $start));
        $end_str = htmlspecialchars(utf8_strftime(hour_min_format(), $end));
    }
    switch (cmp3($start, $day_start) . cmp3($end, $day_end + 1)) {
        case "> < ":
            // Starts after midnight, ends before midnight
        // Starts after midnight, ends before midnight
        case "= < ":
            // Starts at midnight, ends before midnight
            $result = $start_str;
            // Don't bother showing the end if it's the same as the start period
            if ($end_str !== $start_str) {
                $result .= $separator . $end_str;
            }
            break;
        case "> = ":
            // Starts after midnight, ends at midnight
            $result = $start_str . $separator . $midnight;
            break;
        case "> > ":
            // Starts after midnight, continues tomorrow
            $result = $start_str . $separator . $after_today;
            break;
        case "= = ":
            // Starts at midnight, ends at midnight
            $result = $all_day;
            break;
        case "= > ":
            // Starts at midnight, continues tomorrow
            $result = $all_day . $after_today;
            break;
        case "< < ":
            // Starts before today, ends before midnight
            $result = $before_today . $separator . $end_str;
            break;
        case "< = ":
            // Starts before today, ends at midnight
            $result = $before_today . $all_day;
            break;
        case "< > ":
            // Starts before today, continues tomorrow
            $result = $before_today . $all_day . $after_today;
            break;
    }
    return $result;
}