コード例 #1
0
ファイル: step1.php プロジェクト: loevendahl/flexbil
				<div class="input-group grp">

					<input class="form-control booking_date" type="text" name="date_return" size="10" required="required" <?php 
echo count($sposts) != 1 ? 'disabled' : '';
?>
 />

					<select class="form-control time_field" name="time_return" required="required" <?php 
echo count($sposts) != 1 ? 'disabled' : '';
?>
>

						<?php 
echo '<option value="">' . __('-- select --', 'bizzthemes') . '</option>' . "\n";
$times = bizz_create_time_range('00:00', '23:30', apply_filters('bizz_location_time_interval', '30 mins'));
foreach ($times as $key => $time) {
    echo '<option value="' . date('H:i', $time) . '" ' . selected(date('H:i', $time), apply_filters('bizz_default_return_time', '12:00'), false) . '>' . date(get_option('time_format', 'H:i'), $time) . '</option>';
}
?>

					</select>

					<input type="hidden" name="return_d" class="return_d" value="" />

					<input type="hidden" name="return_m" class="return_m" value="" />

					<input type="hidden" name="return_y" class="return_y" value="" />

					<input type="hidden" name="return_dn" class="return_dn" value="" />
コード例 #2
0
function bizz_booking_process_time()
{
    global $wpdb;
    // Page ID by page name
    $location = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_name = '" . $_POST['location'] . "' AND post_type = 'bizz_locations'");
    $location = is_numeric($_POST['location']) ? $_POST['location'] : $location;
    // Get location hours
    $hours = bizz_location_hours($location, $_POST['day']);
    /* format the date
    	$dature = $_POST['dature'];
    	$format = get_option( 'date_format', 'y-m-d');
    	$selecteddate = date_create_from_format ($format, $dature);
    	$today = new DateTime('now');
    	
    	$dature = ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) ? DateTime::createFromFormat( 'Y-m-d', $dature ) : new DateTime( $dature );
    	$dature = date( $format, strtotime( $_POST['dature'] ) );
    	*/
    // format the date
    $format = get_option('date_format', 'Y-m-d');
    $selecteddate = date('Y-m-d', strtotime($_POST['y'] . '-' . $_POST['m'] . '-' . $_POST['d']));
    $today = new DateTime('now');
    $today = date_format($today, 'Y-m-d');
    // var_dump( $selecteddate . '__' . $today );
    $pre = apply_filters('pre_booking_process_time', null, $location, $hours, $_POST);
    if (null !== $pre) {
        print_r($pre);
        exit;
    }
    // EMPTY
    if (empty($location) || empty($_POST['location'])) {
        print_r('EMPTY');
    } elseif ($hours['closed']) {
        print_r('CLOSED');
    } elseif (strtotime($selecteddate) < strtotime($today)) {
        print_r('PAST');
    } else {
        $times = bizz_create_time_range($hours['start'], $hours['end'], apply_filters('bizz_location_time_interval', '30 mins'));
        $return = '';
        foreach ($times as $key => $time) {
            $return .= '<option value="' . date('H:i', $time) . '" ' . selected(date('H:i', $time), apply_filters('bizz_location_time_selected', '')) . '>' . date(get_option('time_format', 'H:i'), $time) . '</option>';
        }
        print_r($return);
    }
    exit;
}