Example #1
0
function create_field_entry_end_date($disabled = FALSE)
{
    global $end_time, $areas, $area_id, $periods, $multiday_allowed;
    $date = getbookingdate($end_time, TRUE);
    $current_s = ($date['hours'] * 60 + $date['minutes']) * 60;
    echo "<div id=\"div_end_date\">\n";
    echo "<label>" . get_vocab("end") . ":</label>\n";
    // Don't show the end date selector if multiday is not allowed
    echo "<div" . ($multiday_allowed ? '' : " style=\"visibility: hidden\"") . ">\n";
    gendateselector("end_", $date['mday'], $date['mon'], $date['year'], '', $disabled);
    echo "</div>\n";
    // Generate the live slot selector
    // If we're using periods the booking model is slightly different,
    // so subtract one period because the "end" period is actually the beginning
    // of the last period booked
    $a = $areas[$area_id];
    $this_current_s = $a['enable_periods'] ? $current_s - $a['resolution'] : $current_s;
    genSlotSelector($areas[$area_id], 'end_seconds', 'end_seconds', $this_current_s, FALSE, $disabled);
    // Generate the templates
    foreach ($areas as $a) {
        $this_current_s = $a['enable_periods'] ? $current_s - $a['resolution'] : $current_s;
        genSlotSelector($a, 'end_seconds' . $a['id'], 'end_seconds', $this_current_s, TRUE, TRUE);
    }
    echo "<span id=\"end_time_error\" class=\"error\"></span>\n";
    echo "</div>\n";
}
function create_field_entry_end_date($disabled = FALSE)
{
    global $end_time, $areas, $area_id, $periods, $multiday_allowed;
    echo "<div id=\"div_end_date\">\n";
    echo "<label>" . get_vocab("end") . ":</label>\n";
    $date = getdate($end_time);
    // Don't show the end date selector if multiday is not allowed
    echo "<div" . ($multiday_allowed ? '' : " style=\"visibility: hidden\"") . ">\n";
    gendateselector("end_", $date['mday'], $date['mon'], $date['year'], '', $disabled);
    echo "</div>\n";
    // If we're using periods the booking model is slightly different,
    // so subtract one period because the "end" period is actually the beginning
    // of the last period booked
    foreach ($areas as $a) {
        if ($a['enable_periods']) {
            $a['resolution'] = 60;
            $first = 12 * 60 * 60;
            // If we're using periods we just go to the beginning of the last slot
            $last = $first + (count($periods) - 1) * $a['resolution'];
        } else {
            $first = ($a['morningstarts'] * 60 + $a['morningstarts_minutes']) * 60;
            $last = ($a['eveningends'] * 60 + $a['eveningends_minutes']) * 60;
            $last = $last + $a['resolution'];
        }
        $end_value = $a['enable_periods'] ? $end_time - $a['resolution'] : $end_time;
        $display_none = $a['id'] != $area_id;
        genSlotSelector($a, "end_", $first, $last, $end_value, $display_none, $disabled);
    }
    echo "<span id=\"end_time_error\" class=\"error\"></span>\n";
    echo "</div>\n";
}