function gdlr_print_hostel_availability_item($settings = array()) { $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" '; global $gdlr_spaces, $hostel_option; $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-blog-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : ''; $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : ''; $current_date = current_time('Y-m-d'); $next_date = date('Y-m-d', strtotime($current_date . "+1 days")); $value = array('gdlr-check-in' => $current_date, 'gdlr-night' => 1, 'gdlr-check-out' => $next_date, 'gdlr-room-number' => 1); $ret = gdlr_get_item_title($settings); $ret .= '<div class="gdlr-hotel-availability-wrapper'; if (!empty($hostel_option['enable-hotel-branch']) && $hostel_option['enable-hotel-branch'] == 'enable') { $ret .= ' gdlr-hotel-branches-enable'; } $ret .= '" ' . $margin_style . $item_id . ' >'; $ret .= '<form class="gdlr-hotel-availability gdlr-hostel gdlr-item" id="gdlr-hotel-availability" method="post" action="' . esc_url(add_query_arg(array($hostel_option['booking-slug'] => ''), home_url('/'))) . '" >'; if (!empty($hostel_option['enable-hotel-branch']) && $hostel_option['enable-hotel-branch'] == 'enable') { $ret .= gdlrs_get_reservation_branch_combobox(array('title' => __('Hotel Branches', 'gdlr-hotel'), 'slug' => 'gdlr-hotel-branches', 'id' => 'gdlr-hotel-branches', 'value' => '')); } $ret .= gdlr_get_reservation_datepicker(array('title' => __('Check In', 'gdlr-hotel'), 'slug' => 'gdlr-check-in', 'id' => 'gdlr-check-in', 'value' => $value['gdlr-check-in'])); $ret .= gdlr_get_reservation_combobox(array('title' => __('Night', 'gdlr-hotel'), 'slug' => 'gdlr-night', 'id' => 'gdlr-night', 'value' => $value['gdlr-night'])); $ret .= gdlr_get_reservation_datepicker(array('title' => __('Check Out', 'gdlr-hotel'), 'slug' => 'gdlr-check-out', 'id' => 'gdlr-check-out', 'value' => $value['gdlr-check-out'])); $ret .= gdlr_get_reservation_combobox(array('title' => __('Guests', 'gdlr-hotel'), 'slug' => 'gdlr-room-number', 'id' => 'gdlr-room-number', 'value' => $value['gdlr-room-number']), 1); $ret .= '<div class="gdlr-hotel-availability-submit" >'; $ret .= '<input type="hidden" name="hotel_data" value="1" >'; $ret .= '<input type="submit" class="gdlr-reservation-bar-button gdlr-button with-border" value="' . __('Check Availability', 'gdlr-hotel') . '" >'; $ret .= '</div>'; $ret .= '<div class="clear"></div>'; $ret .= '</form>'; $ret .= '</div>'; return $ret; }
function gdlrs_get_reservation_date_form($single_form = false, $data = array()) { $ret = ''; if (!empty($_POST['hotel_data'])) { $value = $_POST; } else { $current_date = current_time('Y-m-d'); $next_date = date('Y-m-d', strtotime($current_date . "+1 days")); $value = array('gdlr-check-in' => $current_date, 'gdlr-night' => 1, 'gdlr-check-out' => $next_date, 'gdlr-room-number' => 1); } // branch (if enable) global $hostel_option; if (!empty($hostel_option['enable-hotel-branch']) && $hostel_option['enable-hotel-branch'] == 'enable') { if (is_single()) { $term = get_the_terms(get_the_ID(), 'hostel_room_category'); if (!empty($term)) { $term = reset($term); $value['gdlr-hotel-branches'] = $term->term_id; } else { $value['gdlr-hotel-branches'] = ''; } } else { if (empty($value['gdlr-hotel-branches'])) { $value['gdlr-hotel-branches'] = ''; } } $ret .= gdlrs_get_reservation_branch_combobox(array('title' => __('Hotel Branches', 'gdlr-hotel'), 'slug' => 'gdlr-hotel-branches', 'id' => 'gdlr-hotel-branches', 'value' => $value['gdlr-hotel-branches'])); $ret .= '<div class="clear"></div>'; } // date $ret .= gdlr_get_reservation_datepicker(array('title' => __('Check In', 'gdlr-hotel'), 'slug' => 'gdlr-check-in', 'id' => 'gdlr-check-in', 'value' => $value['gdlr-check-in'])); $ret .= gdlr_get_reservation_combobox(array('title' => __('Night', 'gdlr-hotel'), 'slug' => 'gdlr-night', 'id' => 'gdlr-night', 'value' => $value['gdlr-night']), 1); $ret .= '<div class="clear"></div>'; $ret .= gdlr_get_reservation_datepicker(array('title' => __('Check Out', 'gdlr-hotel'), 'slug' => 'gdlr-check-out', 'id' => 'gdlr-check-out', 'value' => $value['gdlr-check-out'])); $ret .= '<div class="clear"></div>'; // room $ret .= gdlr_get_reservation_combobox(array('title' => __('Guests', 'gdlr-hotel'), 'slug' => 'gdlr-room-number', 'id' => 'gdlr-room-number', 'value' => $value['gdlr-room-number']), 1); $ret .= '<div class="clear"></div>'; if ($single_form) { $ret .= '<input type="hidden" name="hotel_data" value="1" >'; $ret .= '<input type="submit" class="gdlr-reservation-bar-button gdlr-button with-border" value="' . __('Check Availability', 'gdlr-hotel') . '" >'; } else { if (empty($_POST['hotel_data'])) { $ret .= '<a id="gdlr-reservation-bar-button" class="gdlr-reservation-bar-button gdlr-button with-border" href="#" >' . __('Check Availability', 'gdlr-hotel') . '</a>'; } } $ret .= '<div class="clear"></div>'; return $ret; }