Beispiel #1
0
 static function getListDate($start, $end)
 {
     $start = new DateTime($start);
     $end = new DateTime($end . ' +1 day');
     $list = array();
     foreach (new DatePeriod($start, new DateInterval('P1D'), $end) as $day) {
         $list[] = $day->format(TravelHelper::getDateFormat());
     }
     return $list;
 }
 static function _get_disable_date()
 {
     $disable = array();
     $activity_id = STInput::request('activity_id', '');
     $activity_id = apply_filters('st_get_post_id_origin', $activity_id);
     if (empty($activity_id)) {
         echo json_encode($disable);
         die;
     }
     $year = STInput::request('year', date('Y'));
     global $wpdb;
     $sql = "SELECT\r\n\t\t\t\torigin_id as activity_id,\r\n\t\t\t\tcheck_in_timestamp as check_in,\r\n\t\t\t\tcheck_out_timestamp as check_out,\r\n\t\t\t\tadult_number,\r\n\t\t\t\tchild_number,\r\n\t\t\t\tinfant_number\r\n\t\t\t\tFROM\r\n\t\t\t\t\t{$wpdb->prefix}st_order_item_meta\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tst_booking_post_type = 'st_activity'\r\n\t\t\t\tAND origin_id = '{$activity_id}'\r\n\t\t\t\tAND status NOT IN ('trash', 'canceled')\r\n\t\t\t\tAND YEAR (\r\n\t\t\t\t\tFROM_UNIXTIME(check_in_timestamp)\r\n\t\t\t\t) = {$year}\r\n\t\t\t\tAND YEAR (\r\n\t\t\t\t\tFROM_UNIXTIME(check_out_timestamp)\r\n\t\t\t\t) = {$year}";
     $result = $wpdb->get_results($sql, ARRAY_A);
     if (is_array($result) && count($result)) {
         $list_date = array();
         foreach ($result as $key => $val) {
             $list_date[] = array('check_in' => $val['check_in'], 'check_out' => $val['check_out'], 'adult_number' => $val['adult_number'], 'child_number' => $val['child_number'], 'infant_number' => $val['infant_number']);
         }
     }
     if (isset($list_date) && count($list_date)) {
         $min_max = self::_get_minmax($activity_id, $year);
         if (is_array($min_max) && count($min_max)) {
             $max_people = intval(get_post_meta($activity_id, 'max_people', true));
             for ($i = intval($min_max['check_in']); $i <= intval($min_max['check_out']); $i = strtotime('+1 day', $i)) {
                 $people = 0;
                 foreach ($result as $key => $date) {
                     if ($i == intval($date['check_in'])) {
                         $people += intval($date['adult_number']) + intval($date['child_number']) + intval($date['infant_number']);
                     }
                 }
                 if ($people >= $max_people) {
                     $disable[] = date(TravelHelper::getDateFormat(), $i);
                 }
             }
         }
     }
     if (count($disable)) {
         echo json_encode($disable);
         die;
     }
     echo json_encode($disable);
     die;
 }
Beispiel #3
0
    echo TravelHelper::getDateFormatJs();
    ?>
" type="text"
                                   value="<?php 
    echo $start;
    ?>
" name="check_in">
                        </div>
                    </div>
                </div>
            <?php 
} else {
    $check_in = get_post_meta(get_the_ID(), 'check_in', true);
    $check_in = $check_in ? date(TravelHelper::getDateFormat(), strtotime($check_in)) : '';
    $check_out = get_post_meta(get_the_ID(), 'check_out', true);
    $check_out = $check_out ? date(TravelHelper::getDateFormat(), strtotime($check_out)) : '';
    ?>
                <input name="check_in" type="hidden" class="activity_check_in"
                       value="<?php 
    echo $check_in;
    ?>
">
                <input name="check_out" type="hidden" class="activity_check_out"
                       value="<?php 
    echo $check_out;
    ?>
">

            <?php 
}
?>
if (isset($item_data['_st_check_in_timestamp'])) {
    ?>
    <li>
        <span class="meta-label"><?php 
    _e('Date:', ST_TEXTDOMAIN);
    ?>
</span>
        <span class="meta-data"><?php 
    echo date_i18n(TravelHelper::getDateFormat() . ' ' . get_option('time_format'), st_wc_parse_order_item_meta($item_data['_st_check_in_timestamp']));
    ?>
            <?php 
    if (isset($item_data['_st_check_out_timestamp'])) {
        ?>
                <i class="fa fa-long-arrow-right"></i>
                <?php 
        echo date_i18n(TravelHelper::getDateFormat() . ' ' . get_option('time_format'), st_wc_parse_order_item_meta($item_data['_st_check_out_timestamp']));
        ?>
            <?php 
    }
    ?>
        </span>
    </li>
    <?php 
}
?>
    <?php 
if (isset($item_data['_st_data_equipment'])) {
    $selected_equipment = st_wc_parse_order_item_meta($item_data['_st_data_equipment']);
    if ($selected_equipment and $selected_equipment = unserialize($selected_equipment)) {
        if (is_array($selected_equipment) and !empty($selected_equipment)) {
            ?>
<?php

$room_id = get_the_ID();
$item_id = get_post_meta(get_the_ID(), 'room_parent', true);
$start = STInput::request('start') ? STInput::request('start') : date(TravelHelper::getDateFormat(), strtotime("now"));
$end = STInput::request('end') ? STInput::request('end') : date(TravelHelper::getDateFormat(), strtotime("+1 day"));
$check_in = TravelHelper::convertDateFormat($start);
$check_out = TravelHelper::convertDateFormat($end);
$room_num_search = STInput::request('room_num_search');
if (!$room_num_search) {
    $room_num_search = 1;
}
$data_price = STRoom::get_room_price(get_the_ID(), $check_in, $check_out);
$html_price = $data_price['price'] * STInput::request('room_num_search');
?>
<div class="booking-item-dates-change">
    <?php 
echo STTemplate::message();
?>
	<form class="single-room-form" method="get">
		<?php 
wp_nonce_field('room_search', 'room_search');
?>
		<div class="input-daterange" data-date-format="<?php 
echo TravelHelper::getDateFormatJs();
?>
">
            <div class="form-group form-group-icon-left"><i class="fa fa-calendar input-icon input-icon-hightlight"></i>
                <label><?php 
st_the_language('check_in');
?>
Beispiel #6
0
                        <div class="package-info">
                            <i class="fa fa-calendar"></i>
                            <span class=""><?php 
    st_the_language('user_availability');
    ?>
 : </span>
                            <?php 
    $check_in = get_post_meta(get_the_ID(), 'check_in', true);
    if (!empty($check_in)) {
        $check_in = strtotime($check_in);
        echo date_i18n(TravelHelper::getDateFormat(), $check_in);
    }
    $check_out = get_post_meta(get_the_ID(), 'check_out', true);
    if (!empty($check_out)) {
        $check_out = strtotime($check_out);
        echo ' <i class="fa fa-arrow-right"></i> ' . date_i18n(TravelHelper::getDateFormat(), $check_out);
    }
    ?>
                        </div>
                    <?php 
}
?>
                    <?php 
$activity_time = get_post_meta(get_the_ID(), 'activity-time', true);
if (!empty($activity_time)) {
    ?>
                        <div class="info">
                            <span class="head"><i class="fa fa-clock-o"></i> <?php 
    st_the_language('user_activity_time');
    ?>
 : </span>
Beispiel #7
0
                    <div class="package-info">
                        <i class="fa fa-calendar">&nbsp;</i>
                        <span class=""><?php 
STLanguage::st_the_language('holiday_date');
?>
: </span>
                        <?php 
$type_holiday = get_post_meta(get_the_ID(), 'type_holiday', true);
if ($type_holiday == 'daily_holiday') {
    $day = STHoliday::get_duration_unit();
    echo esc_html($day);
} else {
    $check_in = get_post_meta(get_the_ID(), 'check_in', true);
    $check_out = get_post_meta(get_the_ID(), 'check_out', true);
    if (!empty($check_in) and !empty($check_out)) {
        $date = date_i18n(TravelHelper::getDateFormat(), strtotime($check_in)) . ' <i class="fa fa-long-arrow-right"></i> ' . date_i18n(TravelHelper::getDateFormat(), strtotime($check_out));
        echo balanceTags($date);
    } else {
        st_the_language('holiday_none');
    }
}
?>
                    </div>
                </div>
            </div>
            <div class="row mt10">
                <div class="col-md-6 col-sm-6 col-xs-6">
                   <p class="mb0 text-darken">
                       <i class="fa fa-money">&nbsp;</i>
                       <?php 
_e('Price', ST_TEXTDOMAIN);
Beispiel #8
0
         }
         echo __("Duration", ST_TEXTDOMAIN) . ": " . $duration;
     }
     ?>
                         </td>
                         <td class="post-title page-title column-title">
                            <?php 
     $price = get_post_meta($post_id, 'total_price', true);
     $currency = get_post_meta($post_id, 'currency', true);
     $rate = floatval(get_post_meta($post_id, 'currency_rate', true));
     echo TravelHelper::format_money_from_db($price, $currency, $rate);
     ?>
                         </td>
                         <td class="post-title page-title column-title">
                             <?php 
     echo date(TravelHelper::getDateFormat(), strtotime($value->post_date));
     ?>
                         </td>
                         <td class="post-title page-title column-title">
                             <?php 
     echo get_post_meta($order_id, 'status', true);
     ?>
                         </td>
                         <td class="post-title page-title column-title">
                             <?php 
     echo STPaymentGateways::get_gatewayname(get_post_meta($order_id, 'payment_method', true));
     ?>
                         </td>
                     </tr>
                 <?php 
 }
Beispiel #9
0
 public function _get_availability_hotel_room()
 {
     $list_date = array();
     $room_id = STInput::request('post_id', '');
     $check_in = STInput::request('start', '');
     $check_out = STInput::request('end', '');
     $hotel_id = intval(get_post_meta($room_id, 'room_parent', true));
     $allow_full_day = get_post_meta($hotel_id, 'allow_full_day', true);
     if (!$allow_full_day || $allow_full_day == '') {
         $allow_full_day = 'on';
     }
     $year = date('Y', $check_in);
     if (empty($year)) {
         $year = date('Y');
     }
     $year2 = date('Y', $check_out);
     if (empty($year2)) {
         $year2 = date('Y');
     }
     $month = date('m', $check_in);
     if (empty($month)) {
         $month = date('m');
     }
     $month2 = date('m', $check_out);
     if (empty($month2)) {
         $month2 = date('m');
     }
     $result = HotelHelper::_get_full_ordered($room_id, $month, $month2, $year, $year2);
     $number_room = get_post_meta($room_id, 'number_room', true);
     $min_max = HotelHelper::_get_min_max_date_ordered($room_id, $year, $year2);
     if (is_array($min_max) && count($min_max) && is_array($result) && count($result)) {
         $disable = array();
         for ($i = intval($min_max['min_date']); $i <= intval($min_max['max_date']); $i = strtotime('+1 day', $i)) {
             $num_room = 0;
             foreach ($result as $key => $date) {
                 if ($allow_full_day == 'on') {
                     if ($i >= intval($date['check_in_timestamp']) && $i <= intval($date['check_out_timestamp'])) {
                         $num_room += $date['number_room'];
                     }
                 } else {
                     if ($i > intval($date['check_in_timestamp']) && $i < intval($date['check_out_timestamp'])) {
                         $num_room += $date['number_room'];
                     }
                 }
             }
             $disable[$i] = $num_room;
         }
         if (count($disable)) {
             foreach ($disable as $key => $num_room) {
                 if (intval($num_room) >= $number_room) {
                     $list_date[] = date(TravelHelper::getDateFormat(), $key);
                 }
             }
         }
     }
     $list_date_2 = AvailabilityHelper::_getDisableCustomDate($room_id, $month, $month2, $year, $year2);
     $date1 = strtotime($year . '-' . $month . '-01');
     $date2 = strtotime($year2 . '-' . $month2 . '-01');
     $date2 = strtotime(date('Y-m-t', $date2));
     $today = strtotime(date('Y-m-d'));
     $return = array();
     $booking_period = intval(get_post_meta($hotel_id, 'hotel_booking_period', true));
     for ($i = $date1; $i <= $date2; $i = strtotime('+1 day', $i)) {
         $period = TravelHelper::dateDiff(date('Y-m-d', $today), date('Y-m-d', $i));
         $d = date(TravelHelper::getDateFormat(), $i);
         if (in_array($d, $list_date)) {
             $return[] = array('start' => date('Y-m-d', $i), 'date' => date('Y-m-d', $i), 'day' => date('d', $i), 'status' => 'booked');
         } else {
             if ($i < $today) {
                 $return[] = array('start' => date('Y-m-d', $i), 'date' => date('Y-m-d', $i), 'day' => date('d', $i), 'status' => 'past');
             } else {
                 if (in_array($d, $list_date_2)) {
                     $return[] = array('start' => date('Y-m-d', $i), 'date' => date('Y-m-d', $i), 'day' => date('d', $i), 'status' => 'disabled');
                 } else {
                     if ($period < $booking_period) {
                         $return[] = array('start' => date('Y-m-d', $i), 'date' => date('Y-m-d', $i), 'day' => date('d', $i), 'status' => 'disabled');
                     } else {
                         $return[] = array('start' => date('Y-m-d', $i), 'date' => date('Y-m-d', $i), 'day' => date('d', $i), 'status' => 'avalable', 'price' => TravelHelper::format_money(STPrice::getRoomPriceOnlyCustomPrice($room_id, $i, strtotime('+1 day', $i), 1)));
                     }
                 }
             }
         }
     }
     echo json_encode($return);
     die;
 }
echo get_post_meta($order_id, 'room_num_search', true);
?>
</p>
                    
                    <p><strong><?php 
echo __('Check In :', ST_TEXTDOMAIN);
?>
</strong> <?php 
echo date(TravelHelper::getDateFormat(), strtotime(get_post_meta($order_id, 'check_in', true)));
?>
</p>
                    <p><strong><?php 
echo __('Check Out :', ST_TEXTDOMAIN);
?>
</strong> <?php 
echo date(TravelHelper::getDateFormat(), strtotime(get_post_meta($order_id, 'check_out', true)));
?>
</p>
                    <?php 
if (isset($extras['value']) && is_array($extras['value']) && count($extras['value'])) {
    ?>
                    <p>
                        <strong><?php 
    echo __('Extra', ST_TEXTDOMAIN);
    ?>
</strong>
                    </p>
                    <p>    
                    <?php 
    foreach ($extras['value'] as $name => $value) {
        $price_item = floatval($extras['price'][$name]);
 static function _getDisableCustomDateRental($rental_id, $month, $month2, $year, $year2)
 {
     $date1 = $year . '-' . $month . '-01';
     $date2 = strtotime($year2 . '-' . $month2 . '-01');
     $date2 = date('Y-m-t', $date2);
     global $wpdb;
     $sql = "\r\n\t\t\tSELECT\r\n\t\t\t\t`check_in`,\r\n\t\t\t\t`check_out`,\r\n\t\t\t\t`number`,\r\n\t\t\t\t`status`\r\n\t\t\tFROM\r\n\t\t\t\t{$wpdb->prefix}st_availability\r\n\t\t\tWHERE\r\n\t\t\t\tpost_id = {$rental_id}\r\n\r\n\t\t\tAND (\r\n\t\t\t\t(\r\n\t\t\t\t\t'{$date1}' < DATE_FORMAT(FROM_UNIXTIME(check_in), '%Y-%m-%d')\r\n\t\t\t\t\tAND '{$date2}' > DATE_FORMAT(FROM_UNIXTIME(check_out), '%Y-%m-%d')\r\n\t\t\t\t)\r\n\t\t\t\tOR (\r\n\t\t\t\t\t'{$date1}' BETWEEN DATE_FORMAT(FROM_UNIXTIME(check_in), '%Y-%m-%d')\r\n\t\t\t\t\tAND DATE_FORMAT(FROM_UNIXTIME(check_out), '%Y-%m-%d')\r\n\t\t\t\t)\r\n\t\t\t\tOR (\r\n\t\t\t\t\t'{$date2}' BETWEEN DATE_FORMAT(FROM_UNIXTIME(check_in), '%Y-%m-%d')\r\n\t\t\t\t\tAND DATE_FORMAT(FROM_UNIXTIME(check_out), '%Y-%m-%d')\r\n\t\t\t\t)\r\n\t\t\t)";
     $results = $wpdb->get_results($sql);
     $list_date = array();
     $start = strtotime($date1);
     $end = strtotime($date2);
     if (is_array($results) && count($results)) {
         for ($i = $start; $i <= $end; $i = strtotime('+1 day', $i)) {
             $in_date = false;
             foreach ($results as $key => $val) {
                 $status = $val->status;
                 if ($i == $val->check_in && $i == $val->check_out) {
                     if ($status == 'unavailable') {
                         $date = $i;
                     } else {
                         unset($date);
                     }
                     if (!$in_date) {
                         $in_date = true;
                     }
                 }
             }
             if ($in_date && isset($date)) {
                 $list_date[] = date(TravelHelper::getDateFormat(), $date);
                 unset($date);
             }
         }
     }
     return $list_date;
 }
 </h5>

<p><strong><?php 
echo __('Booking Number :', ST_TEXTDOMAIN);
?>
</strong> <?php 
echo esc_html($order_code);
?>
</p>

<p>
<strong><?php 
echo __('Booking Date :', ST_TEXTDOMAIN);
?>
</strong> <?php 
echo get_the_time(TravelHelper::getDateFormat(), $order_code);
?>
</p>

<p><strong><?php 
echo __('Payment Method :', ST_TEXTDOMAIN);
?>
</strong> <?php 
echo STPaymentGateways::get_gatewayname(get_post_meta($order_code, 'payment_method', true));
?>
</p>
<table cellpadding="0" cellspacing="0" width="100%" class="tb_list_cart">
<thead>
<tr>
    <td>
        *
?>
                        <p>
                            <strong><?php 
_e("Pick-up Time: ", ST_TEXTDOMAIN);
?>
</strong> <?php 
echo @date_i18n(TravelHelper::getDateFormat(), strtotime(get_post_meta($order_item_id, 'check_in', TRUE))) . ' - ' . get_post_meta($order_item_id, 'check_in_time', TRUE);
?>
                        </p>

                        <p>
                            <strong><?php 
_e("Drop-off Time: ", ST_TEXTDOMAIN);
?>
</strong> <?php 
echo @date_i18n(TravelHelper::getDateFormat(), strtotime(get_post_meta($order_item_id, 'check_out', TRUE))) . ' - ' . get_post_meta($order_item_id, 'check_out_time', TRUE);
?>
                        </p>
                        <?php 
if ($drive_name = get_post_meta($order_code, 'driver_name', TRUE)) {
    ?>
                        <p>
                            <strong><?php 
    _e("Driver’s Name: ", ST_TEXTDOMAIN);
    ?>
</strong> <?php 
    echo $drive_name;
    ?>
                        </p>
                        <?php 
}
Beispiel #14
0
 static function _send_owner_booking_email($order)
 {
     global $order_id;
     $order_id = $order;
     $item_post_type = get_post_meta($order_id, 'st_booking_post_type', true);
     $to = false;
     $subject = sprintf(__('New Booking at %s', ST_TEXTDOMAIN), get_bloginfo('title'));
     $check = false;
     $item_id = get_post_meta($order_id, 'item_id', true);
     $check_in = get_post_meta($order_id, 'check_in', true);
     $check_out = get_post_meta($order_id, 'check_out', true);
     $date_check_in = @date(TravelHelper::getDateFormat(), strtotime($check_in));
     $date_check_out = @date(TravelHelper::getDateFormat(), strtotime($check_out));
     if ($item_id) {
         $message = st()->load_template('email/header');
         $email_for_partner = st()->get_option('email_for_partner', '');
         $message .= do_shortcode($email_for_partner);
         $message .= st()->load_template('email/footer');
         $title = '';
         if ($title = get_the_title($item_id)) {
             $subject = sprintf(__('New Booking at %s: %s - %s', ST_TEXTDOMAIN), $title, $date_check_in, $date_check_out);
         }
         if (!empty($item_post_type) and $item_post_type == 'st_tours') {
             $type_tour = get_post_meta($order_id, 'type_tour', true);
             if ($type_tour == 'daily_tour') {
                 $duration = get_post_meta($order_id, 'duration', true);
                 $subject = sprintf(__('Your booking at %s: %s - %s', ST_TEXTDOMAIN), $title, $date_check_in, $duration);
             }
         }
         if (!empty($item_post_type) and $item_post_type == 'st_holidays') {
             $type_holiday = get_post_meta($order_id, 'type_holiday', true);
             if ($type_holiday == 'daily_holiday') {
                 $duration = get_post_meta($order_id, 'duration', true);
                 $subject = sprintf(__('Your booking at %s: %s - %s', ST_TEXTDOMAIN), $title, $date_check_in, $duration);
             }
         }
         $to = STCart::get_owner_email($item_id);
         if ($to) {
             $check = self::_send_mail($to, $subject, $message);
         }
     }
     return $check;
 }
 static function _validate_cart_rental($data)
 {
     if (is_array($data) && count($data)) {
         $result = ValidateWooCheckout::_get_order_rental($data['rental_id'], $data['check_in'], $data['check_out']);
         $total_rental = intval(get_post_meta($data['rental_id'], 'rental_number', true));
         if ($total_rental <= 0) {
             $total_rental = 0;
         }
         for ($i = $data['check_in']; $i <= $data['check_out']; $i = strtotime('+1 day', $i)) {
             $number_room = 0;
             $number_room_cart = 1;
             if (is_array($result) && count($result)) {
                 foreach ($result as $item) {
                     if ($i >= intval($item['check_in_timestamp']) && $i <= intval($item['check_out_timestamp'])) {
                         $number_room += 1;
                     }
                 }
                 if ($number_room_cart + $number_room > $total_rental) {
                     $free_room = $total_rental - $number_room;
                     $_SESSION['flash_validate_checkout'] = '<p class="bg-danger" style="padding: 10px 5px">' . sprintf(__('This <b>%s</b> rental has only %s rental(s) available on <b>%s</b>.', ST_TEXTDOMAIN), get_the_title($data['rental_id']), $free_room, date(TravelHelper::getDateFormat(), $i)) . '</p>';
                     return false;
                 }
             } else {
                 if ($number_room_cart > $total_rental) {
                     $_SESSION['flash_validate_checkout'] = '<p class="bg-danger" style="padding: 10px 5px">' . sprintf(__('This <b>%s</b> rental has only %s rental(s) available on <b>%s</b>.', ST_TEXTDOMAIN), get_the_title($data['rental_id']), $total_rental, date(TravelHelper::getDateFormat(), $i)) . '</p>';
                     return false;
                 }
             }
         }
     }
     return true;
 }
Beispiel #16
0
                    <?php 
$pick_up_date = $drop_off_date = '';
$pick_up_date_html = $drop_off_date_html = '';
if (!empty($_REQUEST['pick-up-date'])) {
    $pick_up_date_html = $_REQUEST['pick-up-date'];
    $pick_up_date = TravelHelper::convertDateFormat($_REQUEST['pick-up-date']);
} else {
    $pick_up_date_html = date(TravelHelper::getDateFormat(), strtotime("now"));
    $pick_up_date = date(TravelHelper::getDateFormat(), strtotime("now"));
}
if (!empty($_REQUEST['drop-off-date'])) {
    $drop_off_date_html = $_REQUEST['drop-off-date'];
    $drop_off_date = TravelHelper::convertDateFormat($_REQUEST['drop-off-date']);
} else {
    $drop_off_date_html = date(TravelHelper::getDateFormat(), strtotime("+1 day"));
    $drop_off_date = date(TravelHelper::getDateFormat(), strtotime("+1 day"));
}
if (!empty($pick_up_date_html)) {
    ?>
                      <small><?php 
    echo esc_attr($time);
    ?>
 <?php 
    if ($time > 1) {
        echo STCars::get_price_unit('plural');
    } else {
        echo STCars::get_price_unit();
    }
    ?>
 ( <?php 
    echo esc_html($pick_up_date_html);
    ?>
</p>
            <ul class="booking-item-payment-price">

                <?php 
    if (!empty($info_price)) {
        foreach ($info_price as $k => $v) {
            ?>
                    <li>
                        <p class="booking-item-payment-price-title">
                            <?php 
            echo date(TravelHelper::getDateFormat(), strtotime($v['start']));
            ?>
                            <i class="fa fa-arrow-right "></i>
                            <?php 
            echo date(TravelHelper::getDateFormat(), strtotime($v['end']));
            ?>
                        </p>
                        <p class="booking-item-payment-price-amount">
                            <?php 
            echo TravelHelper::format_money($v['price']);
            ?>
/<small><?php 
            st_the_language('per_night');
            ?>
</small>
                        </p>
                    </li>
                <?php 
        }
    }
		<tr>
			<th>
				Prices:
			</th>
			<td>
                <p>Price: <?php 
echo TravelHelper::format_money($html_price);
?>
 / night</p>
                <p>Discount: <?php 
echo $discount;
?>
 %</p>
			</td>
			<td>
				<p>Sale price from: <?php 
if (!empty($sale_price_from)) {
    echo date(TravelHelper::getDateFormat(), strtotime($sale_price_from));
}
?>
</p>
				<p>Sale price to: <?php 
if (!empty($sale_price_to)) {
    echo date(TravelHelper::getDateFormat(), strtotime($sale_price_to));
}
?>
</p>
			</td>
		</tr>
	</table>
</div>
Beispiel #19
0
echo date_i18n(TravelHelper::getDateFormat(), strtotime($date_start));
?>
" required="" readonly>
                            </div>
                            <div class="form-group form-group-icon-left">
                                
                                <label for="date_end"><?php 
_e("To", ST_TEXTDOMAIN);
?>
</label>
                                <i class="fa fa-calendar input-icon input-icon-highlight"></i>
                                <input id="date_end" class="form-control input-date-end"  data-date-format="<?php 
echo TravelHelper::getDateFormatJs();
?>
" type="text" name="date_end" value="<?php 
echo date_i18n(TravelHelper::getDateFormat(), strtotime($date_end));
?>
" required="" readonly>
                            </div>
                        </div>
                        <div class="form-group form-group-icon-left">
                            <button type="submit" class="btn btn-primary btn-sm"><?php 
_e("Apply", ST_TEXTDOMAIN);
?>
</button>
                            <button type="button" class="btn btn-default btn-sm pull-right btn_cancel"><?php 
_e("Cancel", ST_TEXTDOMAIN);
?>
</button>
                        </div>
                    </form>
 static function check_validate_car($data)
 {
     if (is_array($data) && count($data)) {
         foreach ($data as $key => $val) {
             $car_id = $key;
             $max_car = intval(get_post_meta($car_id, 'number_car', true));
             if ($max_car <= 0) {
                 $max_car = 0;
             }
             $result = self::_get_order_car($key, $val['min'], $val['max']);
             for ($i = intval($val['min']); $i <= intval($val['max']); $i = strtotime('+1 day', $i)) {
                 $number_car = 0;
                 $number_car_cart = 0;
                 if (is_array($result) && count($result)) {
                     foreach ($result as $item) {
                         if ($i >= intval($item['check_in_timestamp']) && $i <= intval($item['check_out_timestamp'])) {
                             $number_car += 1;
                         }
                     }
                     foreach ($val['date'] as $k => $date) {
                         if ($i >= intval($date['check_in']) && $i <= intval($date['check_out'])) {
                             $number_car_cart += 1;
                         }
                     }
                     if ($number_car_cart + $number_car > $max_car) {
                         $free_car = $max_car - $number_car;
                         $_SESSION['flash_validate_checkout'] = '<p class="bg-danger" style="padding: 10px 5px">' . sprintf(__('The <b>%s</b> car has only %s item(s) available on <b>%s</b>.', ST_TEXTDOMAIN), get_the_title($car_id), $free_car, date(TravelHelper::getDateFormat(), $i)) . '</p>';
                         return false;
                     }
                 } else {
                     $number_car_cart = 0;
                     foreach ($val['date'] as $k => $date) {
                         if ($i >= intval($date['check_in']) && $i <= intval($date['check_out'])) {
                             $number_car_cart += 1;
                         }
                     }
                     if ($number_car_cart > $max_car) {
                         $_SESSION['flash_validate_checkout'] = '<p class="bg-danger" style="padding: 10px 5px">' . sprintf(__('This <b>%s</b> car has only %s item(s) available on <b>%s</b>.', ST_TEXTDOMAIN), get_the_title($car_id), $max_car, date(TravelHelper::getDateFormat(), $i)) . '</p>';
                         return false;
                     }
                 }
             }
         }
     }
     return true;
 }
Beispiel #21
0
                        <?php 
    }
} else {
    ?>
                        <?php 
    $check_in = get_post_meta(get_the_ID(), 'check_in', true);
    $check_out = get_post_meta(get_the_ID(), 'check_out', true);
    if (!empty($check_out) and !empty($check_out)) {
        ?>
                            <i class="fa fa-calendar"></i>
                            <span class=""><?php 
        st_the_language('holiday_date');
        ?>
 : </span>
                            <?php 
        $format = TravelHelper::getDateFormat();
        $date = date_i18n($format, strtotime($check_in)) . ' <i class="fa fa-long-arrow-right"></i> ' . date_i18n($format, strtotime($check_out));
        echo balanceTags($date);
    }
    ?>
                    <?php 
}
?>
                </small>
            </p>
            <?php 
$is_st_show_number_user_book = st()->get_option('st_show_number_user_book', 'off');
if ($is_st_show_number_user_book == 'on') {
    ?>
            <p class="mb0">
                <small>
Beispiel #22
0
 function st_detail_date_location_cars_func()
 {
     if (is_singular('st_cars')) {
         $default = array('drop-off' => __('none', ST_TEXTDOMAIN), 'pick-up' => __('none', ST_TEXTDOMAIN), 'location_id_drop_off' => '', 'location_id_pick_up' => '');
         $_REQUEST = wp_parse_args($_REQUEST, $default);
         if (!empty($_REQUEST['pick-up-date'])) {
             $pick_up_date = $_REQUEST['pick-up-date'];
         } else {
             $pick_up_date = date(TravelHelper::getDateFormat(), strtotime("now"));
         }
         if (!empty($_REQUEST['pick-up-time'])) {
             $pick_up_time = $_REQUEST['pick-up-time'];
         } else {
             $pick_up_time = "12:00 AM";
         }
         if (STInput::request("location_id_pick_up")) {
             $address_pick_up = get_the_title(STInput::request("location_id_pick_up"));
         } else {
             $address_pick_up = STInput::request('pick-up');
         }
         $pick_up = '<h5>' . st_get_language('car_pick_up') . ':</h5>
     <p><i class="fa fa-map-marker box-icon-inline box-icon-gray"></i>' . $address_pick_up . '</p>
     <p><i class="fa fa-calendar box-icon-inline box-icon-gray"></i>' . $pick_up_date . '</p>
     <p><i class="fa fa-clock-o box-icon-inline box-icon-gray"></i>' . $pick_up_time . '</p>';
         if (!empty($_REQUEST['drop-off-date'])) {
             $drop_off_date = $_REQUEST['drop-off-date'];
         } else {
             $drop_off_date = $pick_up_date = date(TravelHelper::getDateFormat(), strtotime("+1 day"));
         }
         if (!empty($_REQUEST['drop-off-time'])) {
             $drop_off_time = $_REQUEST['drop-off-time'];
         } else {
             $drop_off_time = "12:00 AM";
         }
         if (STInput::request('location_id_drop_off')) {
             $address_drop_off = get_the_title(STInput::request('location_id_drop_off'));
         } else {
             $address_drop_off = STInput::request('drop_off');
         }
         $drop_off = '   <h5>' . st_get_language('car_drop_off') . ':</h5>
                     <p><i class="fa fa-map-marker box-icon-inline box-icon-gray"></i>' . $address_drop_off . '</p>
                     <p><i class="fa fa-calendar box-icon-inline box-icon-gray"></i>' . $drop_off_date . '</p>
                     <p><i class="fa fa-clock-o box-icon-inline box-icon-gray"></i>' . $drop_off_time . '</p>';
         $logo = get_post_meta(get_the_ID(), 'cars_logo', true);
         if (is_numeric($logo)) {
             $logo = wp_get_attachment_url($logo);
         }
         if (!empty($logo)) {
             $logo = '<img src="' . bfi_thumb($logo, array('width' => '120', 'height' => '120')) . '" alt="logo" />';
         }
         $about = get_post_meta(get_the_ID(), 'cars_about', true);
         if (!empty($about)) {
             $about = ' <h5>' . st_get_language('car_about') . '</h5>
                   <p>' . get_post_meta(get_the_ID(), 'cars_about', true) . '</p>';
         }
         return '<div class="booking-item-deails-date-location">
                     <ul>
                         <li class="text-center">
                             ' . $logo . '
                         </li>
                         <li>
                             <p class="f-20 text-center">' . get_post_meta(get_the_ID(), 'cars_name', true) . '</p>
                         </li>
                         <li>
                             <h5>' . st_get_language('car_phone') . ':</h5>
                             <p><i class="fa fa-phone box-icon-inline box-icon-gray"></i>' . get_post_meta(get_the_ID(), 'cars_phone', true) . '</p>
                         </li>
                          <li>
                             <h5>' . st_get_language('car_email') . ':</h5>
                             <p><i class="fa fa-envelope-o box-icon-inline box-icon-gray"></i>' . get_post_meta(get_the_ID(), 'cars_email', true) . '</p>
                         </li>
                         <li>
                             ' . $about . '
                         </li>
                         <li>' . $pick_up . '</li>
                         <li>' . $drop_off . '</li>
                     </ul>
                     <a href="#search-dialog" data-effect="mfp-zoom-out" class="btn btn-primary popup-text" href="#">' . st_get_language('change_location_and_date') . '</a>
                 </div>';
     }
 }
                                <?php 
echo esc_html($title_type_tour);
?>
                            </p>
                            <p><strong><?php 
echo __('Check In :', ST_TEXTDOMAIN);
?>
</strong> <?php 
echo date_i18n(TravelHelper::getDateFormat(), strtotime($check_in));
?>
</p>
                            <p><strong><?php 
echo __('Check Out:', ST_TEXTDOMAIN);
?>
</strong> <?php 
echo date_i18n(TravelHelper::getDateFormat(), strtotime($check_out));
?>
</p>
                            <p>
                                <strong><?php 
_e("Duration:", ST_TEXTDOMAIN);
?>
</strong> 
                                <?php 
echo esc_html($duration);
?>
                            </p>
                        </td>
                    </tr>
                <?php 
?>
Beispiel #24
0
 static function _get_disable_date()
 {
     $list_date = array();
     if (!TravelHelper::checkTableDuplicate('st_rental')) {
         echo json_encode($list_date);
         die;
     }
     $rental_id = STInput::request('rental_id');
     $year = STInput::request('year');
     if (empty($year)) {
         $year = date('Y');
     }
     $month = STInput::request('month');
     if (empty($month)) {
         $month = date('m');
     }
     $result = RentalHelper::_get_full_ordered($rental_id, $month, $month, $year, $year);
     $number_rental = intval(get_post_meta($rental_id, 'rental_number', true));
     $min_max = RentalHelper::_get_min_max_date_ordered($rental_id, $year, $year);
     if (is_array($min_max) && count($min_max) && is_array($result) && count($result)) {
         $disable = array();
         for ($i = intval($min_max['min_date']); $i <= intval($min_max['max_date']); $i = strtotime('+1 day', $i)) {
             $num_rental = 0;
             foreach ($result as $key => $date) {
                 if ($i >= intval($date['check_in_timestamp']) && $i <= intval($date['check_out_timestamp'])) {
                     $num_rental += 1;
                 }
             }
             $disable[$i] = $num_rental;
         }
         if (count($disable)) {
             foreach ($disable as $key => $num_rental) {
                 if (intval($num_rental) >= $number_rental) {
                     $list_date[] = date(TravelHelper::getDateFormat(), $key);
                 }
             }
         }
     }
     $list_date_2 = AvailabilityHelper::_getDisableCustomDateRental($rental_id, $month, $month, $year, $year);
     if (is_array($list_date_2) && count($list_date_2)) {
         $list_date = array_merge($list_date, $list_date_2);
     }
     echo json_encode($list_date);
     die;
 }