| 1 |
<?php /** |
| 2 |
* @version 1.0 |
| 3 |
* @package Booking Calendar |
| 4 |
* @category Toolbar. Data for UI Elements at Booking Calendar admin pages |
| 5 |
* @author wpdevelop |
| 6 |
* |
| 7 |
* @web-site https://wpbookingcalendar.com/ |
| 8 |
* @email info@wpbookingcalendar.com |
| 9 |
* |
| 10 |
* @modified 2015-11-16 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit, if accessed directly |
| 14 |
|
| 15 |
|
| 16 |
// --------------------------------------------------------------------------------------------------------------------- |
| 17 |
// T o o l b a r s |
| 18 |
// --------------------------------------------------------------------------------------------------------------------- |
| 19 |
|
| 20 |
// FixIn: 9.6.3.5. |
| 21 |
|
| 22 |
/** T o o l b a r C o n t a i n e r f o r Timeline */ |
| 23 |
function wpbc_timeline_toolbar() { |
| 24 |
|
| 25 |
wpbc_clear_div(); |
| 26 |
|
| 27 |
//wpbc_toolbar_search_by_id_bookings(); // Search bookings by ID - form at the top right side of the page |
| 28 |
|
| 29 |
//wpbc_toolbar_btn__view_mode(); // Vertical Buttons // FixIn: 9.8.15.2. |
| 30 |
|
| 31 |
// Toolbar //////////////////////////////////////////////////////////////// |
| 32 |
|
| 33 |
?><div id="toolbar_booking_listing" class="wpbc_timeline_toolbar_container"><?php |
| 34 |
/* |
| 35 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 36 |
|
| 37 |
// <editor-fold defaultstate="collapsed" desc=" T O P T A B s " > |
| 38 |
|
| 39 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 40 |
if ( ! isset( $_REQUEST['tab_cvm'] ) ) $_REQUEST['tab_cvm'] = 'actions_cvm'; |
| 41 |
$selected_tab = sanitize_text_field( wp_unslash( $_REQUEST['tab_cvm'] ) ); |
| 42 |
|
| 43 |
wpbc_bs_display_tab( array( |
| 44 |
'title' => __('View', 'booking') |
| 45 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 46 |
, 'onclick' => "jQuery('.visibility_container').hide();" |
| 47 |
. "jQuery('#actions_toolbar_container').show();" |
| 48 |
. "jQuery('#toolbar_booking_listing .nav-tab').removeClass('nav-tab-active');" // FixIn: 9.8.15.2. |
| 49 |
. "jQuery(this).addClass('nav-tab-active');" |
| 50 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 51 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 52 |
, 'font_icon' => 'wpbc-bi-calendar2-range-fill' |
| 53 |
, 'default' => ( $selected_tab == 'actions_cvm' ) ? true : false |
| 54 |
|
| 55 |
) ); |
| 56 |
|
| 57 |
|
| 58 |
wpbc_bs_dropdown_menu_help(); |
| 59 |
|
| 60 |
// </editor-fold> |
| 61 |
|
| 62 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 63 |
*/ |
| 64 |
//////////////////////////////////////////////////////////////////////// |
| 65 |
|
| 66 |
wpbc_bs_toolbar_sub_html_container_start(); |
| 67 |
|
| 68 |
// A c t i o n s T o o l b a r f o r T i m e l i n e |
| 69 |
|
| 70 |
|
| 71 |
?><div class="wpbc_timeline_toolbar_structure"><?php |
| 72 |
|
| 73 |
make_bk_action( 'wpbc_br_selection_for_timeline' ); |
| 74 |
|
| 75 |
wpbc_toolbar_is_send_emails_btn( ''); |
| 76 |
|
| 77 |
?></div><?php |
| 78 |
|
| 79 |
wpbc_bs_toolbar_sub_html_container_end(); |
| 80 |
|
| 81 |
?></div><?php |
| 82 |
|
| 83 |
wpbc_clear_div(); |
| 84 |
|
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Show Search by Booking ID form at top right side of Calendar Overview page |
| 89 |
* |
| 90 |
* @param $page_tag |
| 91 |
* @param $active_page_tab |
| 92 |
* @param $active_page_subtab |
| 93 |
* |
| 94 |
* @return false|void |
| 95 |
*/ |
| 96 |
function wpbc_calendar_overview__search_by_id_bookings( $page_tag, $active_page_tab, $active_page_subtab ) { |
| 97 |
|
| 98 |
if ( ( 'wpbc' !== $page_tag ) || ( 'vm_calendar' !== $active_page_tab ) ) { |
| 99 |
return false; |
| 100 |
} |
| 101 |
?><span class="wpdevelop wpbc_page wpbc_toolbar_search_by_id_bookings"><?php |
| 102 |
wpbc_toolbar_search_by_id_bookings(); // Search bookings by ID - form at the top right side of the page |
| 103 |
?></span><?php |
| 104 |
} |
| 105 |
add_bk_action('wpbc_h1_header_content_end', 'wpbc_calendar_overview__search_by_id_bookings'); |
| 106 |
|
| 107 |
|
| 108 |
/** T o o l b a r C o n t a i n e r f o r Add New Booking */ |
| 109 |
function wpbc_add_new_booking_toolbar() { |
| 110 |
|
| 111 |
wpbc_clear_div(); |
| 112 |
|
| 113 |
// Toolbar //////////////////////////////////////////////////////////////// |
| 114 |
|
| 115 |
?><div id="toolbar_booking_listing" style="position:relative;"><?php |
| 116 |
|
| 117 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 118 |
|
| 119 |
// <editor-fold defaultstate="collapsed" desc=" T O P T A B s " > |
| 120 |
|
| 121 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 122 |
if ( ! isset( $_REQUEST['toolbar'] ) ) $_REQUEST['toolbar'] = 'filter'; |
| 123 |
$selected_tab = sanitize_text_field( wp_unslash( $_REQUEST['toolbar'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 124 |
|
| 125 |
wpbc_bs_display_tab( array( |
| 126 |
'title' => __('Options', 'booking') |
| 127 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 128 |
, 'onclick' => "jQuery('.visibility_container').hide();" |
| 129 |
. "jQuery('#filter_toolbar_container').show();" |
| 130 |
. "jQuery('#toolbar_booking_listing .nav-tab').removeClass('nav-tab-active');" // FixIn: 9.8.15.2. |
| 131 |
. "jQuery(this).addClass('nav-tab-active');" |
| 132 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 133 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 134 |
, 'font_icon' => 'wpbc_icn_adjust' |
| 135 |
, 'default' => ( $selected_tab == 'filter' ) ? true : false |
| 136 |
|
| 137 |
) ); |
| 138 |
|
| 139 |
wpbc_bs_display_tab( array( |
| 140 |
'title' => __('Calendar View', 'booking') |
| 141 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 142 |
, 'onclick' => "jQuery('.visibility_container').hide();" |
| 143 |
. "jQuery('#calendar_size_toolbar_container').show();" |
| 144 |
. "jQuery('#toolbar_booking_listing .nav-tab').removeClass('nav-tab-active');" // FixIn: 9.8.15.2. |
| 145 |
. "jQuery(this).addClass('nav-tab-active');" |
| 146 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 147 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 148 |
, 'font_icon' => 'wpbc-bi-calendar2' |
| 149 |
, 'default' => ( $selected_tab == 'calendar' ) ? true : false |
| 150 |
|
| 151 |
) ); |
| 152 |
|
| 153 |
|
| 154 |
wpbc_bs_dropdown_menu_help(); |
| 155 |
|
| 156 |
// </editor-fold> |
| 157 |
|
| 158 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 159 |
|
| 160 |
//////////////////////////////////////////////////////////////////////// |
| 161 |
|
| 162 |
wpbc_bs_toolbar_sub_html_container_start(); |
| 163 |
|
| 164 |
// T o o l b a r |
| 165 |
?><div id="filter_toolbar_container" class="visibility_container clearfix-height" style="display:<?php echo ( $selected_tab == 'filter' ) ? 'block' : 'none' ?>;margin-top:-5px;"><?php |
| 166 |
|
| 167 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 168 |
if ( ( function_exists( 'wpbc_toolbar_btn__resource_selection' ) ) && ( empty( $_GET['booking_hash'] ) ) ) { |
| 169 |
// Do not show resource seleciton if editing booking. // FixIn: 7.1.2.10. |
| 170 |
|
| 171 |
wpbc_toolbar_btn__resource_selection(); |
| 172 |
} |
| 173 |
|
| 174 |
if ( function_exists( 'wpbc_toolbar_btn__form_selection' ) ) |
| 175 |
wpbc_toolbar_btn__form_selection(); |
| 176 |
|
| 177 |
//////////////////////////////////////////////////////////////////// |
| 178 |
?><div class="clear-for-mobile"></div><?php |
| 179 |
|
| 180 |
?><div class="control-group wpbc-no-padding" style="float:right;margin-right: 0;margin-left: 15px;"><?php |
| 181 |
|
| 182 |
if ( function_exists( 'wpbc_toolbar_btn__auto_fill' ) ) |
| 183 |
wpbc_toolbar_btn__auto_fill(); |
| 184 |
|
| 185 |
wpbc_toolbar_btn__add_new_booking(); |
| 186 |
|
| 187 |
?></div><?php |
| 188 |
//////////////////////////////////////////////////////////////////// |
| 189 |
|
| 190 |
?></div><?php |
| 191 |
?><div id="calendar_size_toolbar_container" class="visibility_container clearfix-height" style="display:<?php echo ( $selected_tab == 'calendar_size' ) ? 'block' : 'none' ?>;margin-top:-5px;"><?php |
| 192 |
/* |
| 193 |
?><span class="advanced_booking_filter" style="display:none;"><div class="clear" style="width:100%;border-bottom:1px solid #ccc;height:10px;"></div><?php |
| 194 |
*/ |
| 195 |
// Get possible saved previous "Custom User Calendar data" |
| 196 |
$user_calendar_options = get_user_option( 'booking_custom_' . 'add_booking_calendar_options', wpbc_get_current_user_id() ); |
| 197 |
|
| 198 |
if ( $user_calendar_options === false ) { // Default, if no saved previously. |
| 199 |
$user_calendar_options = array(); |
| 200 |
$user_calendar_options['calendar_months_count'] = 1; |
| 201 |
$user_calendar_options['calendar_months_num_in_1_row'] = 0 ; |
| 202 |
$user_calendar_options['calendar_width'] = ''; |
| 203 |
$user_calendar_options['calendar_widthunits'] = 'px'; |
| 204 |
$user_calendar_options['calendar_cell_height'] = ''; |
| 205 |
$user_calendar_options['calendar_cell_heightunits'] = 'px'; |
| 206 |
} else { |
| 207 |
$user_calendar_options = maybe_unserialize( $user_calendar_options ); |
| 208 |
} |
| 209 |
|
| 210 |
wpbc_toolbar_btn__calendar_months_number_selection( $user_calendar_options ); |
| 211 |
|
| 212 |
wpbc_toolbar_btn__calendar_months_num_in_1_row_selection( $user_calendar_options ); |
| 213 |
|
| 214 |
wpbc_toolbar_btn__calendar_width( $user_calendar_options ); |
| 215 |
|
| 216 |
wpbc_toolbar_btn__calendar_cell_height( $user_calendar_options ); |
| 217 |
|
| 218 |
wpbc_toolbar_btn__calendar_options_save(); |
| 219 |
|
| 220 |
wpbc_toolbar_btn__calendar_options_reset(); |
| 221 |
/* |
| 222 |
?><div class="clear"></div></span><?php |
| 223 |
|
| 224 |
|
| 225 |
wpbc_clear_div(); |
| 226 |
|
| 227 |
wpbc_toolbar_expand_collapse_btn( 'advanced_booking_filter' ); |
| 228 |
*/ |
| 229 |
?></div><?php |
| 230 |
|
| 231 |
|
| 232 |
wpbc_bs_toolbar_sub_html_container_end(); |
| 233 |
|
| 234 |
wpbc_toolbar_is_send_emails_btn(); |
| 235 |
|
| 236 |
?></div><?php |
| 237 |
|
| 238 |
wpbc_clear_div(); |
| 239 |
|
| 240 |
} |
| 241 |
|
| 242 |
|
| 243 |
// --------------------------------------------------------------------------------------------------------------------- |
| 244 |
// HTML elements for Toolbar |
| 245 |
// --------------------------------------------------------------------------------------------------------------------- |
| 246 |
|
| 247 |
/** |
| 248 |
* Expand or Collapse Advanced Filter set |
| 249 |
* |
| 250 |
* @param string $css_class_of_expand_element - CSS Class of element section to show or hide |
| 251 |
*/ |
| 252 |
function wpbc_toolbar_expand_collapse_btn( $css_class_of_expand_element ) { |
| 253 |
|
| 254 |
?><span id="show_link_advanced_booking_filter" class="tab-bottom tooltip_right advanced_booking_filter" |
| 255 |
title="<?php esc_attr_e('Expand Advanced Toolbar' ,'booking'); ?>" |
| 256 |
><a href="javascript:void(0)" |
| 257 |
onclick="javascript:jQuery('.<?php echo esc_js( $css_class_of_expand_element ); ?>').show(); |
| 258 |
jQuery('#show_link_advanced_booking_filter').hide(); |
| 259 |
jQuery('#hide_link_advanced_booking_filter').show();"><i |
| 260 |
class="wpbc_icn_expand_more"></i></a></span> |
| 261 |
<span id="hide_link_advanced_booking_filter" class="tab-bottom tooltip_right advanced_booking_filter" style="display:none;" |
| 262 |
title="<?php esc_attr_e('Collapse Advanced Toolbar' ,'booking'); ?>" |
| 263 |
><a href="javascript:void(0)" |
| 264 |
onclick="javascript:jQuery('.<?php echo esc_js( $css_class_of_expand_element ); ?>').hide(); |
| 265 |
jQuery('#hide_link_advanced_booking_filter').hide(); |
| 266 |
jQuery('#show_link_advanced_booking_filter').show();"><i |
| 267 |
class="wpbc_icn_expand_less"></i></a></span><?php |
| 268 |
|
| 269 |
} |
| 270 |
|
| 271 |
|
| 272 |
/** |
| 273 |
* Checkbox - sending emails or not |
| 274 |
* |
| 275 |
* @param $style Styles of this element group |
| 276 |
* |
| 277 |
* @return void |
| 278 |
*/ |
| 279 |
function wpbc_toolbar_is_send_emails_btn( $style = 'position:absolute;right:0px;margin-top:10px;' ) { |
| 280 |
|
| 281 |
?><div class="btn-group" style="<?php echo esc_attr( $style ); ?>"><?php |
| 282 |
|
| 283 |
$el_id = 'is_send_email_for_pending'; |
| 284 |
|
| 285 |
$el_value = ( get_bk_option( 'booking_send_emails_off_addbooking' ) !== 'On' ) ? 'On' : 'Off'; |
| 286 |
|
| 287 |
$params_checkbox = array( |
| 288 |
'id' => $el_id // HTML ID of element |
| 289 |
, 'name' => $el_id |
| 290 |
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5. |
| 291 |
, 'style' => '' // CSS of select element |
| 292 |
, 'class' => '' // CSS Class of select element |
| 293 |
, 'disabled' => false |
| 294 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 295 |
, 'legend' => '' // aria-label parameter |
| 296 |
, 'value' => $el_value // Some Value from optins array that selected by default |
| 297 |
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not |
| 298 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 299 |
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code |
| 300 |
, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' ) |
| 301 |
); |
| 302 |
|
| 303 |
wpbc_flex_toggle( $params_checkbox ); |
| 304 |
|
| 305 |
?></div><?php |
| 306 |
} |
| 307 |
|
| 308 |
|
| 309 |
/** Search form by booking ID (at top right side of page) */ |
| 310 |
function wpbc_toolbar_search_by_id_bookings() { |
| 311 |
|
| 312 |
$bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( true, false ), array('view_mode', 'wh_booking_id', 'page_num' ) ); |
| 313 |
|
| 314 |
?> |
| 315 |
<div style=" position: absolute; right: 23px; top: 11px;z-index: 9;"> |
| 316 |
<form name="booking_filters_formID" action="<?php echo esc_url( $bk_admin_url . '&view_mode=vm_listing' ); ?>" method="post" id="booking_filters_formID" > |
| 317 |
<?php |
| 318 |
|
| 319 |
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 320 |
if (isset($_REQUEST['wh_booking_id'])) $wh_booking_id = wpbc_clean_digit_or_csd( $_REQUEST['wh_booking_id'] ); // {'1', '2', .... }. |
| 321 |
else $wh_booking_id = ''; |
| 322 |
|
| 323 |
|
| 324 |
$params = array( 'label_for' => 'wh_booking_id' |
| 325 |
, 'label' => ''//__('Keyword:', 'booking') |
| 326 |
, 'items' => array( |
| 327 |
array( 'type' => 'text', 'id' => 'wh_booking_id', 'value' => $wh_booking_id, 'placeholder' => __('Booking ID', 'booking'), 'style' => 'border-right: none;' ) |
| 328 |
, array( |
| 329 |
'type' => 'button' |
| 330 |
, 'title' => __('Go', 'booking') |
| 331 |
, 'class' => 'button-secondary' |
| 332 |
, 'font_icon' => 'wpbc_icn_search' |
| 333 |
, 'icon_position' => 'right' |
| 334 |
, 'action' => "jQuery('#booking_filters_formID').trigger( 'submit' );" ) |
| 335 |
) |
| 336 |
); |
| 337 |
?><div class="control-group wpbc-no-padding" ><?php |
| 338 |
wpbc_bs_input_group( $params ); |
| 339 |
?></div><?php |
| 340 |
?> |
| 341 |
</form> |
| 342 |
<?php wpbc_clear_div(); ?> |
| 343 |
</div> |
| 344 |
<?php |
| 345 |
} |
| 346 |
|
| 347 |
|
| 348 |
// --------------------------------------------------------------------------------------------------------------------- |
| 349 |
// U I E l e m e n t s |
| 350 |
// --------------------------------------------------------------------------------------------------------------------- |
| 351 |
|
| 352 |
/** Help - Drop Down Menu - T a b */ |
| 353 |
function wpbc_bs_dropdown_menu_help() { |
| 354 |
|
| 355 |
wpbc_bs_dropdown_menu( array( |
| 356 |
'title' => __( 'Help', 'booking' ) |
| 357 |
, 'font_icon' => 'wpbc_icn_support' //FixIn: 9.0.1.4 'glyphicon glyphicon-question-sign' |
| 358 |
, 'position' => 'right' |
| 359 |
, 'items' => array( |
| 360 |
array( 'type' => 'link', 'title' => __('FAQ', 'booking'), 'url' => 'https://wpbookingcalendar.com/faq/' ) |
| 361 |
, array( 'type' => 'link', 'title' => __('Support Forum', 'booking'), 'url' => 'https://wpbookingcalendar.com/support/' ) |
| 362 |
, array( 'type' => 'divider' ) |
| 363 |
, array( 'type' => 'link', 'title' => __('Contact Support', 'booking'), 'url' => 'mailto:support@wpbookingcalendar.com' |
| 364 |
, 'attr' => array( 'style' => 'font-weight: 600;' ) ) |
| 365 |
, array( 'type' => 'divider' ) |
| 366 |
, array( 'type' => 'link', 'title' => "What's New"/*__('Get Started')*/, 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) ) ) |
| 367 |
, array( 'type' => 'link', 'title' => __('About', 'booking') |
| 368 |
// , 'url' => wpbc_up_link() |
| 369 |
, 'url' => 'https://wpbookingcalendar.com/' //esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about-premium' ), 'index.php' ) ) ) |
| 370 |
, 'attr' => array( |
| 371 |
// 'target' => '_blank' |
| 372 |
// 'style' => 'font-weight: 600;' |
| 373 |
) |
| 374 |
) |
| 375 |
) |
| 376 |
) ); |
| 377 |
} |
| 378 |
|
| 379 |
|
| 380 |
/** View Mode - B u t t o n */ |
| 381 |
function wpbc_toolbar_btn__view_mode() { |
| 382 |
|
| 383 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 384 |
$selected_view_mode = ( isset( $_REQUEST['view_mode'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['view_mode'] ) ) : ''; |
| 385 |
|
| 386 |
$bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ), array('view_mode', 'wh_booking_id', 'page_num' ) ); |
| 387 |
|
| 388 |
$params = array(); |
| 389 |
|
| 390 |
|
| 391 |
// FixIn: 9.6.3.5. |
| 392 |
$is_selected = ( ( $selected_view_mode == 'vm_booking_listing' ) || ( $selected_view_mode == 'vm_listing' ) ) ? true : false; |
| 393 |
|
| 394 |
$params['btn_vm_listing_new'] = array( |
| 395 |
'title' => '' |
| 396 |
, 'hint' => array( 'title' => __('Booking Listing' ,'booking') , 'position' => 'top' ) |
| 397 |
, 'selected' => $is_selected |
| 398 |
, 'link' => wpbc_get_bookings_url('booking-listing', true ) . '&view_mode=vm_booking_listing' |
| 399 |
, 'icon' => '' |
| 400 |
, 'font_icon' => 'wpbc-bi-collection'//'glyphicon glyphicon-align-justify' |
| 401 |
); |
| 402 |
|
| 403 |
|
| 404 |
$bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ) , array() // Exclude Value of this parameter |
| 405 |
, array( 'page', 'tab', 'tab_cvm', 'wh_booking_type', 'scroll_start_date', 'scroll_month', 'view_days_num' |
| 406 |
, 'wh_trash' // FixIn: 6.1.1.10. |
| 407 |
) // Only this parameters |
| 408 |
); |
| 409 |
$params['btn_vm_calendar'] = array( |
| 410 |
'title' => '' |
| 411 |
, 'hint' => array( 'title' => __('Timeline View' ,'booking') , 'position' => 'bottom' ) |
| 412 |
, 'selected' => ( $selected_view_mode == 'vm_calendar' ) ? true : false |
| 413 |
, 'link' => $bk_admin_url . '&view_mode=vm_calendar' |
| 414 |
, 'icon' => '' |
| 415 |
, 'font_icon' => 'wpbc-bi-calendar2-range'// 'glyphicon glyphicon-calendar' |
| 416 |
); |
| 417 |
|
| 418 |
?><div style="position:absolute;" class="wpbc_mode_switcher"><?php |
| 419 |
|
| 420 |
wpbc_bs_vertical_buttons_group( $params ); |
| 421 |
|
| 422 |
?></div><?php |
| 423 |
} |
| 424 |
|
| 425 |
// FixIn: 9.6.3.5. |
| 426 |
|
| 427 |
// --------------------------------------------------------------------------------------------------------------------- |
| 428 |
// Toolbar Actions B u t t o n s - T i m e l i n e ////////////////// |
| 429 |
// --------------------------------------------------------------------------------------------------------------------- |
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
/** Navigation Timeline - B u t t o n s */ |
| 435 |
function wpbc_toolbar_btn__timeline_navigation() { |
| 436 |
|
| 437 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 438 |
if ((isset($_REQUEST['wh_booking_type'])) && ( strpos($_REQUEST['wh_booking_type'], ',') !== false ) ) |
| 439 |
$is_show_resources_matrix = true; |
| 440 |
else $is_show_resources_matrix = false; |
| 441 |
|
| 442 |
|
| 443 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 444 |
if ( isset( $_REQUEST['view_days_num'] ) ) |
| 445 |
$view_days_num = intval( $_REQUEST['view_days_num'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 446 |
else $view_days_num = get_bk_option( 'booking_view_days_num'); |
| 447 |
|
| 448 |
|
| 449 |
$bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ), array('scroll_month', 'scroll_day') ); |
| 450 |
//debuge($_REQUEST, $bk_admin_url); |
| 451 |
|
| 452 |
// Get Data For buttons |
| 453 |
if (! $is_show_resources_matrix) { |
| 454 |
|
| 455 |
switch ($view_days_num) { |
| 456 |
case '90': |
| 457 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 458 |
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 459 |
else $scroll_day = 0; |
| 460 |
$scroll_params = array( '&scroll_day='.intval($scroll_day-4*7), |
| 461 |
'&scroll_day='.intval($scroll_day-7), |
| 462 |
'&scroll_day=0', |
| 463 |
'&scroll_day='.intval($scroll_day+7 ), |
| 464 |
'&scroll_day='.intval($scroll_day+4*7) ); |
| 465 |
$scroll_titles = array( __('Previous 4 weeks' ,'booking'), |
| 466 |
__('Previous week' ,'booking'), |
| 467 |
__('Current week' ,'booking'), |
| 468 |
__('Next week' ,'booking'), |
| 469 |
__('Next 4 weeks' ,'booking') ); |
| 470 |
break; |
| 471 |
case '30': |
| 472 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 473 |
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 474 |
else $scroll_day = 0; |
| 475 |
|
| 476 |
// FixIn: 8.9.4.3. |
| 477 |
// Here we need to define number of days to scroll depends from selected number of days to show. |
| 478 |
$days_num_to_scroll = intval( get_bk_option( 'booking_calendar_overview__day_mode__days_number_show' ) );; |
| 479 |
if ( empty( $days_num_to_scroll ) ) { |
| 480 |
$days_num_to_scroll = 7; |
| 481 |
} |
| 482 |
|
| 483 |
$scroll_params = array( '&scroll_day='.intval( $scroll_day - $days_num_to_scroll * 2 ), |
| 484 |
'&scroll_day='.intval( $scroll_day - $days_num_to_scroll ), |
| 485 |
'&scroll_day=0', |
| 486 |
'&scroll_day='.intval( $scroll_day + $days_num_to_scroll ), |
| 487 |
'&scroll_day='.intval( $scroll_day + $days_num_to_scroll *2 ) ); |
| 488 |
$scroll_titles = array( __( 'Previous', 'booking' ) . ' ' . ( 2 * $days_num_to_scroll ) . ' ' . __( 'days', 'booking' ), |
| 489 |
__( 'Previous', 'booking' ) . ' ' . $days_num_to_scroll . ' ' . __( 'days', 'booking' ), |
| 490 |
__('Current week' ,'booking'), |
| 491 |
__( 'Next', 'booking' ) . ' ' . $days_num_to_scroll . ' ' . __( 'days', 'booking' ), |
| 492 |
__( 'Next', 'booking' ) . ' ' . ( 2 * $days_num_to_scroll ) . ' ' . __( 'days', 'booking' ) ); |
| 493 |
break; |
| 494 |
default: // 365 |
| 495 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 496 |
if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0; |
| 497 |
$scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 498 |
$scroll_params = array( '&scroll_month='.intval($scroll_month-3), |
| 499 |
'&scroll_month='.intval($scroll_month-1), |
| 500 |
'&scroll_month=0', |
| 501 |
'&scroll_month='.intval($scroll_month+1 ), |
| 502 |
'&scroll_month='.intval($scroll_month+3) ); |
| 503 |
$scroll_titles = array( __('Previous 3 months' ,'booking'), |
| 504 |
__('Previous month' ,'booking'), |
| 505 |
__('Current month' ,'booking'), |
| 506 |
__('Next month' ,'booking'), |
| 507 |
__('Next 3 months' ,'booking') ); |
| 508 |
break; |
| 509 |
} |
| 510 |
} else { // Matrix |
| 511 |
|
| 512 |
switch ($view_days_num) { |
| 513 |
case '1': //Day |
| 514 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 515 |
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 516 |
else $scroll_day = 0; |
| 517 |
$scroll_params = array( '&scroll_day='.intval($scroll_day-7), |
| 518 |
'&scroll_day='.intval($scroll_day-1), |
| 519 |
'&scroll_day=0', |
| 520 |
'&scroll_day='.intval($scroll_day+1 ), |
| 521 |
'&scroll_day='.intval($scroll_day+7) ); |
| 522 |
$scroll_titles = array( __('Previous 7 days' ,'booking'), |
| 523 |
__('Previous day' ,'booking'), |
| 524 |
__('Current day' ,'booking'), |
| 525 |
__('Next day' ,'booking'), |
| 526 |
__('Next 7 days' ,'booking') ); |
| 527 |
break; |
| 528 |
|
| 529 |
case '7': //Week |
| 530 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 531 |
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 532 |
else $scroll_day = 0; |
| 533 |
$scroll_params = array( '&scroll_day='.intval($scroll_day-4*7), |
| 534 |
'&scroll_day='.intval($scroll_day-7), |
| 535 |
'&scroll_day=0', |
| 536 |
'&scroll_day='.intval($scroll_day+7 ), |
| 537 |
'&scroll_day='.intval($scroll_day+4*7) ); |
| 538 |
$scroll_titles = array( __('Previous 4 weeks' ,'booking'), |
| 539 |
__('Previous week' ,'booking'), |
| 540 |
__('Current week' ,'booking'), |
| 541 |
__('Next week' ,'booking'), |
| 542 |
__('Next 4 weeks' ,'booking') ); |
| 543 |
break; |
| 544 |
|
| 545 |
case '30': |
| 546 |
case '60': |
| 547 |
case '90': //3 months |
| 548 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 549 |
if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0; |
| 550 |
$scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 551 |
$scroll_params = array( '&scroll_month='.intval($scroll_month-3), |
| 552 |
'&scroll_month='.intval($scroll_month-1), |
| 553 |
'&scroll_month=0', |
| 554 |
'&scroll_month='.intval($scroll_month+1 ), |
| 555 |
'&scroll_month='.intval($scroll_month+3) ); |
| 556 |
$scroll_titles = array( __('Previous 3 months' ,'booking'), |
| 557 |
__('Previous month' ,'booking'), |
| 558 |
__('Current month' ,'booking'), |
| 559 |
__('Next month' ,'booking'), |
| 560 |
__('Next 3 months' ,'booking') ); |
| 561 |
break; |
| 562 |
|
| 563 |
default: // 30, 60, 90... |
| 564 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 565 |
if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0; |
| 566 |
$scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 567 |
$scroll_params = array( '&scroll_month='.intval($scroll_month-3), |
| 568 |
'&scroll_month='.intval($scroll_month-1), |
| 569 |
'&scroll_month=0', |
| 570 |
'&scroll_month='.intval($scroll_month+1 ), |
| 571 |
'&scroll_month='.intval($scroll_month+3) ); |
| 572 |
$scroll_titles = array( __('Previous 3 months' ,'booking'), |
| 573 |
__('Previous month' ,'booking'), |
| 574 |
__('Current month' ,'booking'), |
| 575 |
__('Next month' ,'booking'), |
| 576 |
__('Next 3 months' ,'booking') ); |
| 577 |
break; |
| 578 |
} |
| 579 |
} |
| 580 |
|
| 581 |
|
| 582 |
$params = array( |
| 583 |
'label_for' => 'calendar_overview_navigation' // "For" parameter of button group element |
| 584 |
, 'label' => '' //__('Calendar Navigation', 'booking') // Label above the button group |
| 585 |
, 'style' => '' // CSS Style of entire div element |
| 586 |
, 'items' => array( |
| 587 |
array( |
| 588 |
'type' => 'button' |
| 589 |
, 'title' => '' // Title of the button |
| 590 |
, 'hint' => array( 'title' => $scroll_titles[0] , 'position' => 'top' ) // Hint |
| 591 |
, 'link' => $bk_admin_url .$scroll_params[0] // Direct link or skip it |
| 592 |
, 'action' => "" // Some JavaScript to execure, for example run the function |
| 593 |
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary |
| 594 |
, 'icon' => '' |
| 595 |
, 'font_icon' => 'wpbc_icn_keyboard_double_arrow_left' |
| 596 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 597 |
, 'style' => '' // Any CSS class here |
| 598 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 599 |
, 'attr' => array() |
| 600 |
) |
| 601 |
, array( |
| 602 |
'type' => 'button' |
| 603 |
, 'title' => '' // Title of the button |
| 604 |
, 'hint' => array( 'title' => $scroll_titles[1] , 'position' => 'top' ) // Hint |
| 605 |
, 'link' => $bk_admin_url .$scroll_params[1] // Direct link or skip it |
| 606 |
, 'action' => "" // Some JavaScript to execure, for example run the function |
| 607 |
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary |
| 608 |
, 'icon' => '' |
| 609 |
, 'font_icon' => 'wpbc_icn_keyboard_arrow_left' |
| 610 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 611 |
, 'style' => '' // Any CSS class here |
| 612 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 613 |
, 'attr' => array() |
| 614 |
) |
| 615 |
, array( |
| 616 |
'type' => 'dropdown' |
| 617 |
, 'id' => 'timeline_navigation_date' |
| 618 |
, 'title' => '' // Title of the button |
| 619 |
, 'hint' => array( 'title' => __('Custom' ,'booking') , 'position' => 'top' ) // Hint |
| 620 |
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary |
| 621 |
, 'icon' => '' |
| 622 |
, 'font_icon' => 'wpbc_icn_gps_fixed' |
| 623 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 624 |
, 'style' => '' // Any CSS class here |
| 625 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 626 |
, 'attr' => array() |
| 627 |
, 'options' => array( |
| 628 |
$scroll_titles[2] => "window.location.href='" |
| 629 |
. wpbc_get_params_in_url( wpbc_get_bookings_url( false ) |
| 630 |
, array('scroll_month', 'scroll_day', 'scroll_start_date') ) |
| 631 |
. $scroll_params[2] . "'" |
| 632 |
, 'divider1' => 'divider' |
| 633 |
, 'custom' => array( array( 'type' => 'group', 'class' => 'input-group text-group') |
| 634 |
, array( |
| 635 |
'type' => 'text' |
| 636 |
, 'id' => 'calendar_overview_navigation_currentdate' |
| 637 |
, 'name' => 'calendar_overview_navigation_currentdate' |
| 638 |
, 'label' => __('Start Date' ,'booking') . ':' |
| 639 |
, 'disabled' => false |
| 640 |
, 'class' => 'wpdevbk-filters-section-calendar' |
| 641 |
, 'style' => '' |
| 642 |
, 'placeholder' => gmdate('Y-m-d') |
| 643 |
, 'attr' => array() |
| 644 |
, 'value' => '' |
| 645 |
) |
| 646 |
) |
| 647 |
, 'divider2' => 'divider' |
| 648 |
, 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group' ), |
| 649 |
array( |
| 650 |
'type' => 'button' |
| 651 |
, 'title' => __('Apply' ,'booking') // Title of the button |
| 652 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 653 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 654 |
, 'action' => "jQuery('#calendar_overview_navigation_container').hide(); |
| 655 |
window.location.href='" |
| 656 |
. wpbc_get_params_in_url( wpbc_get_bookings_url( false ) |
| 657 |
, array('scroll_month', 'scroll_day', 'scroll_start_date') ) |
| 658 |
. "&scroll_start_date=' + jQuery('#calendar_overview_navigation_currentdate').val();" |
| 659 |
|
| 660 |
, 'class' => 'button-primary' // button-secondary | button-primary |
| 661 |
, 'icon' => '' |
| 662 |
, 'font_icon' => '' |
| 663 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 664 |
, 'style' => '' // Any CSS class here |
| 665 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 666 |
, 'attr' => array() |
| 667 |
|
| 668 |
) |
| 669 |
, array( |
| 670 |
'type' => 'button' |
| 671 |
, 'title' => __('Close' ,'booking') // Title of the button |
| 672 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 673 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 674 |
//, 'action' => '' // Some JavaScript to execure, for example run the function |
| 675 |
, 'class' => 'button-secondary' // button-secondary | button-primary |
| 676 |
, 'icon' => '' |
| 677 |
, 'font_icon' => '' |
| 678 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 679 |
, 'style' => '' // Any CSS class here |
| 680 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 681 |
, 'attr' => array() |
| 682 |
) |
| 683 |
) |
| 684 |
) |
| 685 |
) |
| 686 |
, array( |
| 687 |
'type' => 'button' |
| 688 |
, 'title' => '' // Title of the button |
| 689 |
, 'hint' => array( 'title' => $scroll_titles[3] , 'position' => 'top' ) // Hint |
| 690 |
, 'link' => $bk_admin_url .$scroll_params[3] // Direct link or skip it |
| 691 |
, 'action' => "" // Some JavaScript to execure, for example run the function |
| 692 |
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary |
| 693 |
, 'icon' => '' |
| 694 |
, 'font_icon' => 'wpbc_icn_keyboard_arrow_right' |
| 695 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 696 |
, 'style' => '' // Any CSS class here |
| 697 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 698 |
, 'attr' => array() |
| 699 |
) |
| 700 |
, array( |
| 701 |
'type' => 'button' |
| 702 |
, 'title' => '' // Title of the button |
| 703 |
, 'hint' => array( 'title' => $scroll_titles[4] , 'position' => 'top' ) // Hint |
| 704 |
, 'link' => $bk_admin_url .$scroll_params[4] // Direct link or skip it |
| 705 |
, 'action' => "" // Some JavaScript to execure, for example run the function |
| 706 |
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary |
| 707 |
, 'icon' => '' |
| 708 |
, 'font_icon' => 'wpbc_icn_keyboard_double_arrow_right' |
| 709 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 710 |
, 'style' => '' // Any CSS class here |
| 711 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 712 |
, 'attr' => array() |
| 713 |
) |
| 714 |
) |
| 715 |
); |
| 716 |
|
| 717 |
wpbc_bs_button_group( $params ); |
| 718 |
} |
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
// --------------------------------------------------------------------------------------------------------------------- |
| 723 |
// Toolbar Options B u t t o n s - Add New Booking ////////////////// |
| 724 |
// --------------------------------------------------------------------------------------------------------------------- |
| 725 |
|
| 726 |
/** Genereate URL based on GET parameters */ |
| 727 |
function wpbc_get_new_booking_url__base( $skip_parameters = array() ) { |
| 728 |
|
| 729 |
$link_base = wpbc_get_new_booking_url( true, false ); |
| 730 |
|
| 731 |
$link_params = array(); |
| 732 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 733 |
if ( ( isset( $_GET['booking_type'] ) ) && ( $_GET['booking_type'] > 0 ) ) $link_params['booking_type'] = sanitize_text_field( wp_unslash( $_GET['booking_type'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 734 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 735 |
if ( isset( $_GET['booking_hash'] ) ) $link_params['booking_hash'] = sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 736 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 737 |
if ( isset( $_GET['parent_res'] ) ) $link_params['parent_res'] = sanitize_text_field( wp_unslash( $_GET['parent_res'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 738 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 739 |
if ( isset( $_GET['booking_form'] ) ) $link_params['booking_form'] = sanitize_text_field( wp_unslash( $_GET['booking_form'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 740 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 741 |
if ( isset( $_GET['calendar_months_count'] ) ) $link_params['calendar_months_count'] = intval( $_GET['calendar_months_count'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 742 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 743 |
if ( isset( $_GET['calendar_months_num_in_1_row'] ) ) $link_params['calendar_months_num_in_1_row'] = intval( $_GET['calendar_months_num_in_1_row'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 744 |
|
| 745 |
|
| 746 |
foreach ( $link_params as $key => $value ) { |
| 747 |
|
| 748 |
if ( ! in_array( $key, $skip_parameters) ) { |
| 749 |
$link_base .= '&' . $key . '=' . $value; |
| 750 |
} |
| 751 |
} |
| 752 |
|
| 753 |
return $link_base; |
| 754 |
} |
| 755 |
|
| 756 |
/** Selection Number of visible months */ |
| 757 |
function wpbc_toolbar_btn__calendar_months_number_selection( $user_calendar_options = array() ) { |
| 758 |
|
| 759 |
$text_label = __('Visible months' ,'booking') .':' ; |
| 760 |
|
| 761 |
$form_options = array( 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12 ); |
| 762 |
|
| 763 |
$parameter_name = 'calendar_months_count'; |
| 764 |
|
| 765 |
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval ( $user_calendar_options[ $parameter_name ] ); |
| 766 |
else $selected_value = 1; |
| 767 |
|
| 768 |
$link_base = wpbc_get_new_booking_url__base( array( $parameter_name ) ) . '&' . $parameter_name . '=' ; |
| 769 |
|
| 770 |
$on_change = ''; //'location.href=\'' . $link_base . '\' + this.value;'; |
| 771 |
|
| 772 |
|
| 773 |
$params = array( |
| 774 |
'label_for' => $parameter_name // "For" parameter of label element |
| 775 |
, 'label' => '' // Label above the input group |
| 776 |
, 'style' => '' // CSS Style of entire div element |
| 777 |
, 'items' => array( |
| 778 |
array( |
| 779 |
'type' => 'addon' |
| 780 |
, 'element' => 'text' // text | radio | checkbox |
| 781 |
, 'text' => $text_label |
| 782 |
, 'class' => '' // Any CSS class here |
| 783 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 784 |
) |
| 785 |
, array( |
| 786 |
'type' => 'select' |
| 787 |
, 'id' => $parameter_name // HTML ID of element |
| 788 |
, 'options' => $form_options // Associated array of titles and values |
| 789 |
, 'value' => $selected_value // Some Value from optins array that selected by default |
| 790 |
, 'style' => '' // CSS of select element |
| 791 |
, 'class' => '' // CSS Class of select element |
| 792 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 793 |
, 'onchange' => $on_change |
| 794 |
) |
| 795 |
) |
| 796 |
); |
| 797 |
?><div class="control-group wpbc-no-padding" style="width:auto;"><?php |
| 798 |
wpbc_bs_input_group( $params ); |
| 799 |
?></div><?php |
| 800 |
} |
| 801 |
|
| 802 |
|
| 803 |
/** Selection Number of calendar months in one row */ |
| 804 |
function wpbc_toolbar_btn__calendar_months_num_in_1_row_selection( $user_calendar_options = array() ) { |
| 805 |
|
| 806 |
$text_label = __('Number of months in one row' ,'booking') . ':'; |
| 807 |
$form_options = array( 0 => __('All', 'booking'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12 ); |
| 808 |
|
| 809 |
$parameter_name = 'calendar_months_num_in_1_row'; |
| 810 |
|
| 811 |
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval ( $user_calendar_options[ $parameter_name ] ); |
| 812 |
else $selected_value = 0; |
| 813 |
|
| 814 |
$link_base = wpbc_get_new_booking_url__base( array( $parameter_name ) ) . '&' . $parameter_name . '=' ; |
| 815 |
|
| 816 |
$on_change = ''; // 'location.href=\'' . $link_base . '\' + this.value;'; |
| 817 |
|
| 818 |
|
| 819 |
$params = array( |
| 820 |
'label_for' => $parameter_name // "For" parameter of label element |
| 821 |
, 'label' => '' // Label above the input group |
| 822 |
, 'style' => '' // CSS Style of entire div element |
| 823 |
, 'items' => array( |
| 824 |
array( |
| 825 |
'type' => 'addon' |
| 826 |
, 'element' => 'text' // text | radio | checkbox |
| 827 |
, 'text' => $text_label |
| 828 |
, 'class' => '' // Any CSS class here |
| 829 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 830 |
) |
| 831 |
, array( |
| 832 |
'type' => 'select' |
| 833 |
, 'id' => $parameter_name // HTML ID of element |
| 834 |
, 'options' => $form_options // Associated array of titles and values |
| 835 |
, 'value' => $selected_value // Some Value from optins array that selected by default |
| 836 |
, 'style' => '' // CSS of select element |
| 837 |
, 'class' => '' // CSS Class of select element |
| 838 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 839 |
, 'onchange' => $on_change |
| 840 |
) |
| 841 |
) |
| 842 |
); |
| 843 |
?><div class="control-group wpbc-no-padding"><?php |
| 844 |
wpbc_bs_input_group( $params ); |
| 845 |
?></div><?php |
| 846 |
} |
| 847 |
|
| 848 |
|
| 849 |
function wpbc_toolbar_btn__calendar_width( $user_calendar_options = array() ){ |
| 850 |
|
| 851 |
$text_label = __('Maximum width of calendar' ,'booking') . ':'; |
| 852 |
$parameter_name = 'calendar_width'; |
| 853 |
|
| 854 |
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval( $user_calendar_options[ $parameter_name ] ); |
| 855 |
else $selected_value = ''; |
| 856 |
|
| 857 |
if ( isset( $user_calendar_options[$parameter_name . 'units'] ) ) $selected_value_units = esc_attr( $user_calendar_options[ $parameter_name . 'units' ] ); |
| 858 |
else $selected_value_units = ''; |
| 859 |
|
| 860 |
$params = array( |
| 861 |
'label_for' => $parameter_name // "For" parameter of label element |
| 862 |
, 'label' => '' // Label above the input group |
| 863 |
, 'style' => '' // CSS Style of entire div element |
| 864 |
, 'items' => array( |
| 865 |
array( |
| 866 |
'type' => 'addon' |
| 867 |
, 'element' => 'text' // text | radio | checkbox |
| 868 |
, 'text' => $text_label |
| 869 |
, 'class' => '' // Any CSS class here |
| 870 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 871 |
) |
| 872 |
, array( |
| 873 |
'type' => 'text' |
| 874 |
, 'id' => $parameter_name // HTML ID of element |
| 875 |
, 'value' => $selected_value // Some Value from optins array that selected by default |
| 876 |
, 'style' => 'width: 5em;' // CSS of select element |
| 877 |
, 'placeholder' => '100%' |
| 878 |
, 'class' => '' // CSS Class of select element |
| 879 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 880 |
) |
| 881 |
, array( |
| 882 |
'type' => 'select' |
| 883 |
, 'id' => $parameter_name . 'units' // HTML ID of element |
| 884 |
, 'options' => array( 'px' => 'px', 'percent' => '%' ) // Associated array of titles and values |
| 885 |
, 'value' => $selected_value_units // Some Value from optins array that selected by default |
| 886 |
, 'style' => 'width: 5em;' // CSS of select element |
| 887 |
, 'class' => '' // CSS Class of select element |
| 888 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 889 |
) |
| 890 |
) |
| 891 |
); |
| 892 |
?><div class="control-group wpbc-no-padding"><?php |
| 893 |
wpbc_bs_input_group( $params ); |
| 894 |
?></div><?php |
| 895 |
} |
| 896 |
|
| 897 |
function wpbc_toolbar_btn__calendar_cell_height( $user_calendar_options = array() ){ |
| 898 |
|
| 899 |
$text_label = __('Calendar cell height' ,'booking') . ':'; |
| 900 |
$parameter_name = 'calendar_cell_height'; |
| 901 |
|
| 902 |
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval( $user_calendar_options[ $parameter_name ] ); |
| 903 |
else $selected_value = ''; |
| 904 |
|
| 905 |
if ( isset( $user_calendar_options[$parameter_name . 'units'] ) ) $selected_value_units = esc_attr( $user_calendar_options[ $parameter_name . 'units' ] ); |
| 906 |
else $selected_value_units = ''; |
| 907 |
|
| 908 |
$params = array( |
| 909 |
'label_for' => $parameter_name // "For" parameter of label element |
| 910 |
, 'label' => '' // Label above the input group |
| 911 |
, 'style' => '' // CSS Style of entire div element |
| 912 |
, 'items' => array( |
| 913 |
array( |
| 914 |
'type' => 'addon' |
| 915 |
, 'element' => 'text' // text | radio | checkbox |
| 916 |
, 'text' => $text_label |
| 917 |
, 'class' => '' // Any CSS class here |
| 918 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 919 |
) |
| 920 |
, array( |
| 921 |
'type' => 'text' |
| 922 |
, 'id' => $parameter_name // HTML ID of element |
| 923 |
, 'value' => $selected_value // Some Value from optins array that selected by default |
| 924 |
, 'style' => 'width: 5em;' // CSS of select element |
| 925 |
, 'placeholder' => '48px' |
| 926 |
, 'class' => '' // CSS Class of select element |
| 927 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 928 |
) |
| 929 |
, array( |
| 930 |
'type' => 'select' |
| 931 |
, 'id' => $parameter_name . 'units' // HTML ID of element |
| 932 |
, 'options' => array( 'px' => 'px', 'percent' => '%' ) // Associated array of titles and values |
| 933 |
, 'value' => $selected_value_units // Some Value from optins array that selected by default |
| 934 |
, 'style' => 'width: 5em;' // CSS of select element |
| 935 |
, 'class' => '' // CSS Class of select element |
| 936 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 937 |
) |
| 938 |
|
| 939 |
) |
| 940 |
); |
| 941 |
?><div class="control-group wpbc-no-padding"><?php |
| 942 |
wpbc_bs_input_group( $params ); |
| 943 |
?></div><?php |
| 944 |
} |
| 945 |
|
| 946 |
|
| 947 |
/** Add New Booking Button*/ |
| 948 |
function wpbc_toolbar_btn__calendar_options_save() { |
| 949 |
|
| 950 |
?><div class="control-group wpbc-no-padding"><?php |
| 951 |
?><a id="toolbar_btn__calendar_options_save" |
| 952 |
class="button button-primary " |
| 953 |
href="javascript:void(0)" |
| 954 |
onclick="javascript:var data_params = {}; |
| 955 |
data_params.calendar_months_count = jQuery('#calendar_months_count').val(); |
| 956 |
data_params.calendar_months_num_in_1_row = jQuery('#calendar_months_num_in_1_row').val(); |
| 957 |
data_params.calendar_width = jQuery('#calendar_width').val(); |
| 958 |
data_params.calendar_widthunits = jQuery('#calendar_widthunits').val(); |
| 959 |
data_params.calendar_cell_height = jQuery('#calendar_cell_height').val(); |
| 960 |
data_params.calendar_cell_heightunits = jQuery('#calendar_cell_heightunits').val(); |
| 961 |
var ajax_data_params = jQuery.param( data_params ); |
| 962 |
wpbc_save_custom_user_data(<?php echo esc_js( wpbc_get_current_user_id() ); ?> |
| 963 |
, '<?php echo 'add_booking_calendar_options'; ?>' |
| 964 |
, ajax_data_params |
| 965 |
, 1 |
| 966 |
);" |
| 967 |
><?php esc_html_e('Save' , 'booking' ); ?></a><?php |
| 968 |
?></div><?php |
| 969 |
} |
| 970 |
|
| 971 |
|
| 972 |
/** Add New Booking Button*/ |
| 973 |
function wpbc_toolbar_btn__calendar_options_reset() { |
| 974 |
|
| 975 |
?><div class="control-group wpbc-no-padding"><?php |
| 976 |
?><a |
| 977 |
class="button button-secondary " |
| 978 |
href="javascript:void(0)" |
| 979 |
onclick="javascript:jQuery('#calendar_months_count').val('1'); |
| 980 |
jQuery('#calendar_months_num_in_1_row').val('0'); |
| 981 |
jQuery('#calendar_width').val('0'); |
| 982 |
jQuery('#calendar_widthunits').val('px'); |
| 983 |
jQuery('#calendar_cell_height').val('0'); |
| 984 |
jQuery('#calendar_cell_heightunits').val('px'); |
| 985 |
jQuery( '#toolbar_btn__calendar_options_save').trigger('click'); |
| 986 |
" |
| 987 |
><?php esc_html_e('Reset' , 'booking' ); ?></a><?php |
| 988 |
?></div><?php |
| 989 |
} |
| 990 |
|
| 991 |
|
| 992 |
/** Add New Booking Button*/ |
| 993 |
function wpbc_toolbar_btn__add_new_booking() { |
| 994 |
|
| 995 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 996 |
if ( isset( $_GET['booking_type'] ) ) { |
| 997 |
$bk_type = intval( $_GET['booking_type'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 998 |
} else { |
| 999 |
$bk_type = 1; |
| 1000 |
} |
| 1001 |
|
| 1002 |
?><a |
| 1003 |
class="button-primary button wpbc_submit_button" |
| 1004 |
href="javascript:void(0)" |
| 1005 |
onclick="mybooking_submit( |
| 1006 |
document.getElementById('booking_form<?php echo intval( $bk_type ); ?>' ) |
| 1007 |
, <?php echo intval( $bk_type ); ?> |
| 1008 |
, '<?php echo esc_js( wpbc_get_maybe_reloaded_booking_locale() ); ?>' |
| 1009 |
);" |
| 1010 |
><?php esc_html_e( 'Add booking', 'booking' ); ?></a><?php |
| 1011 |
} |
| 1012 |
|
| 1013 |
|
| 1014 |
/** Checkbox - sending emails or not - duplicated button, usually at the bottom of page*/ |
| 1015 |
function wpbc_toolbar_is_send_emails_btn_duplicated() { |
| 1016 |
|
| 1017 |
?><div class="btn-group" style="margin-top:10px;"><?php |
| 1018 |
|
| 1019 |
$el_id = 'is_send_email_for_new_booking'; |
| 1020 |
|
| 1021 |
$el_value = ( get_bk_option( 'booking_send_emails_off_addbooking' ) !== 'On' ) ? 'On' : 'Off'; |
| 1022 |
|
| 1023 |
$params_checkbox = array( |
| 1024 |
'id' => $el_id // HTML ID of element |
| 1025 |
, 'name' => $el_id |
| 1026 |
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5. |
| 1027 |
, 'style' => '' // CSS of select element |
| 1028 |
, 'class' => '' // CSS Class of select element |
| 1029 |
, 'disabled' => false |
| 1030 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1031 |
, 'legend' => '' // aria-label parameter |
| 1032 |
, 'value' => $el_value // Some Value from optins array that selected by default |
| 1033 |
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not |
| 1034 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1035 |
, 'onchange' => "document.getElementById('is_send_email_for_pending').checked = this.checked;" // JavaScript code |
| 1036 |
, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' ) |
| 1037 |
); |
| 1038 |
|
| 1039 |
wpbc_flex_toggle( $params_checkbox ); |
| 1040 |
|
| 1041 |
?></div><?php |
| 1042 |
|
| 1043 |
?> |
| 1044 |
<script type="text/javascript"> |
| 1045 |
jQuery( '#is_send_email_for_pending' ).on('change', function() { |
| 1046 |
document.getElementById( 'is_send_email_for_new_booking' ).checked = jQuery( '#is_send_email_for_pending' ).is( ':checked' ); |
| 1047 |
}); |
| 1048 |
</script> |
| 1049 |
<?php |
| 1050 |
} |
| 1051 |
|
| 1052 |
|
| 1053 |
/** |
| 1054 |
* Show Link (button) for adding booking to Google Calendar |
| 1055 |
* |
| 1056 |
* @param int $booking_id |
| 1057 |
* @param array $button_attr |
| 1058 |
* @param bool $echo |
| 1059 |
* @return string |
| 1060 |
*/ |
| 1061 |
function wpbc_btn_add_booking_to_google_calendar( $booking_data, $button_attr = array(), $echo = true ) { // FixIn: 7.1.2.5. |
| 1062 |
|
| 1063 |
//debuge($booking_data); |
| 1064 |
if ( ! $echo ) { |
| 1065 |
ob_start(); |
| 1066 |
} |
| 1067 |
|
| 1068 |
$defaults = array( |
| 1069 |
'title' => __( 'Add to Google Calendar', 'booking' ) |
| 1070 |
, 'hint' => __( 'Add to Google Calendar', 'booking' ) |
| 1071 |
, 'class' => 'button-secondary button' |
| 1072 |
, 'is_show_icon' => true |
| 1073 |
, 'is_only_url' => false |
| 1074 |
); |
| 1075 |
$button_attr = wp_parse_args( $button_attr, $defaults ); |
| 1076 |
|
| 1077 |
$params = array(); |
| 1078 |
$params['timezone'] = get_bk_option('booking_gcal_timezone'); |
| 1079 |
|
| 1080 |
$booking_gcal_events_form_fields = get_bk_option( 'booking_gcal_events_form_fields'); |
| 1081 |
if ( is_serialized( $booking_gcal_events_form_fields ) ) |
| 1082 |
$booking_gcal_events_form_fields = unserialize( $booking_gcal_events_form_fields ); |
| 1083 |
|
| 1084 |
/** |
| 1085 |
* Array |
| 1086 |
( |
| 1087 |
[title] => text^name |
| 1088 |
[description] => textarea^details |
| 1089 |
[where] => text^ |
| 1090 |
) |
| 1091 |
*/ |
| 1092 |
|
| 1093 |
|
| 1094 |
// Fields |
| 1095 |
$fields = array( 'title' => '', 'description' => '', 'where' => '' ); |
| 1096 |
|
| 1097 |
foreach ( $fields as $key_name => $field_value ) { |
| 1098 |
|
| 1099 |
if ( ! empty( $booking_gcal_events_form_fields[ $key_name ] ) ) { |
| 1100 |
|
| 1101 |
$field_name = explode( '^', $booking_gcal_events_form_fields[ $key_name ] ); |
| 1102 |
|
| 1103 |
$field_name = $field_name[ ( count( $field_name ) - 1 ) ]; // FixIn: 8.7.7.6. |
| 1104 |
|
| 1105 |
if ( (! empty($field_name)) |
| 1106 |
&& (! empty($booking_data['form_data'])) |
| 1107 |
&& (! empty($booking_data['form_data']['_all_fields_'])) |
| 1108 |
&& (! empty($booking_data['form_data']['_all_fields_'][ $field_name ])) |
| 1109 |
) { |
| 1110 |
|
| 1111 |
if ( 'description' === $key_name ) { // FixIn: 8.1.3.2. |
| 1112 |
if ( isset( $booking_data['form_show'] ) ) { // FixIn: 8.7.3.14. |
| 1113 |
// FixIn: 8.7.11.4. |
| 1114 |
$fields[ $key_name ] = $booking_data['form_show']; |
| 1115 |
$fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES ); |
| 1116 |
$fields[ $key_name ] = urlencode($fields[ $key_name ]); |
| 1117 |
$fields[ $key_name ] = htmlentities($fields[ $key_name ] ); |
| 1118 |
$fields[ $key_name ] = htmlspecialchars_decode ( $fields[ $key_name ], ENT_NOQUOTES ); |
| 1119 |
} |
| 1120 |
} else { |
| 1121 |
// FixIn: 8.7.11.4. |
| 1122 |
$fields[ $key_name ] = $booking_data['form_data']['_all_fields_'][ $field_name ]; |
| 1123 |
$fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES ); |
| 1124 |
// Convert here from usual symbols to URL symbols https://www.url-encode-decode.com/ |
| 1125 |
// $fields[ $key_name ] = str_replace( array( '%','#', '+', '&' ) |
| 1126 |
// , array( '%25','%23', '%2B', '%26') |
| 1127 |
// , $fields[ $key_name ] |
| 1128 |
// ); |
| 1129 |
$fields[ $key_name ] = urlencode($fields[ $key_name ]); |
| 1130 |
$fields[ $key_name ] = htmlentities($fields[ $key_name ] ); |
| 1131 |
$fields[ $key_name ] = htmlspecialchars_decode ( $fields[ $key_name ], ENT_NOQUOTES ); |
| 1132 |
} |
| 1133 |
} |
| 1134 |
} |
| 1135 |
} |
| 1136 |
//debuge($booking_gcal_events_form_fields, $fields,$booking_data['form_data']); |
| 1137 |
|
| 1138 |
// Dates. |
| 1139 |
|
| 1140 |
$check_in_timestamp = $check_out_timestamp = ''; |
| 1141 |
if ( ! empty( $booking_data[ 'dates_short' ] ) ) { |
| 1142 |
|
| 1143 |
|
| 1144 |
/* all day events, you can use 20161208/20161209 - note that the old google documentation gets it wrong. |
| 1145 |
* You must use the following date as the end date for a one day all day event, |
| 1146 |
* or +1 day to whatever you want the end date to be. |
| 1147 |
*/ |
| 1148 |
|
| 1149 |
$check_in_timestamp = strtotime( $booking_data[ 'dates_short' ][ 0 ], current_time( 'timestamp' ) ); |
| 1150 |
if ( trim( substr( $booking_data[ 'dates_short' ][ 0 ], 11 ) ) == '00:00:00' ) { |
| 1151 |
$check_in_timestamp = gmdate( "Ymd", $check_in_timestamp ); // All day |
| 1152 |
} else { |
| 1153 |
$check_in_timestamp = gmdate( "Ymd\THis", $check_in_timestamp ); |
| 1154 |
//$check_in_timestamp = gmdate( "Ymd\THis\Z", $check_in_timestamp ); |
| 1155 |
} |
| 1156 |
|
| 1157 |
$check_out_timestamp = strtotime( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], current_time( 'timestamp' ) ); |
| 1158 |
if ( trim( substr( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], 11 ) ) == '00:00:00' ) { |
| 1159 |
$check_out_timestamp = strtotime( '+1 day', $check_out_timestamp ); |
| 1160 |
$check_out_timestamp = gmdate( "Ymd", $check_out_timestamp ); // All day |
| 1161 |
} else { |
| 1162 |
$check_out_timestamp = gmdate( "Ymd\THis", $check_out_timestamp ); |
| 1163 |
//$check_out_timestamp = gmdate( "Ymd\THis\Z", $check_out_timestamp ); |
| 1164 |
} |
| 1165 |
|
| 1166 |
} |
| 1167 |
|
| 1168 |
//debuge($check_in_timestamp,$check_out_timestamp, $fields );die; |
| 1169 |
//Convert an ISO date/time to a UNIX timestamp |
| 1170 |
//function iso_to_ts( $iso ) { |
| 1171 |
// sscanf( $iso, "%u-%u-%uT%u:%u:%uZ", $year, $month, $day, $hour, $minute, $second ); |
| 1172 |
// return mktime( intval($hour), intval($minute), intval($second), intval($month), intval($day), intval($year) ); |
| 1173 |
// 20140127T224000Z |
| 1174 |
// gmdate("Ymd\THis\Z", time()); |
| 1175 |
|
| 1176 |
/** |
| 1177 |
action: |
| 1178 |
action=TEMPLATE |
| 1179 |
A default required parameter. |
| 1180 |
|
| 1181 |
src: |
| 1182 |
Example: src=default%40gmail.com |
| 1183 |
Format: src=text |
| 1184 |
This is not covered by Google help but is an optional parameter in order to add an event to a shared calendar rather than a user's default. |
| 1185 |
|
| 1186 |
text: |
| 1187 |
Example: text=Garden%20Waste%20Collection |
| 1188 |
Format: text=text |
| 1189 |
This is a required parameter giving the event title. |
| 1190 |
|
| 1191 |
dates: |
| 1192 |
Example: dates=20090621T063000Z/20090621T080000Z (i.e. an event on 21 June 2009 from 7.30am to 9.0am British Summer Time (=GMT+1)). |
| 1193 |
Format: dates=YYYYMMDDToHHMMSSZ/YYYYMMDDToHHMMSSZ |
| 1194 |
This required parameter gives the start and end dates and times (in Greenwich Mean Time) for the event. |
| 1195 |
|
| 1196 |
location: |
| 1197 |
Example: location=Home |
| 1198 |
Format: location=text |
| 1199 |
The obvious location field. |
| 1200 |
|
| 1201 |
trp: |
| 1202 |
Example: trp=false |
| 1203 |
Format: trp=true/false |
| 1204 |
Show event as busy (true) or available (false) |
| 1205 |
|
| 1206 |
sprop: |
| 1207 |
Example: sprop=http%3A%2F%2Fwww.me.org |
| 1208 |
Example: sprop=name:Home%20Page |
| 1209 |
Format: sprop=website and/or sprop=name:website_name |
| 1210 |
*/ |
| 1211 |
|
| 1212 |
// $link_add2gcal = 'http://www.google.com/calendar/event?action=TEMPLATE'; |
| 1213 |
// $link_add2gcal .= '&text=' . $fields['title']; |
| 1214 |
// FixIn: 8.7.3.10. |
| 1215 |
$link_add2gcal = 'https://calendar.google.com/calendar/r/eventedit?'; |
| 1216 |
$link_add2gcal .= 'text=' . $fields['title']; // FixIn: 8.7.11.4. |
| 1217 |
//$link_add2gcal .= '&dates=[start-custom format='Ymd\\THi00\\Z']/[end-custom format='Ymd\\THi00\\Z']'; |
| 1218 |
$link_add2gcal .= '&dates=' . $check_in_timestamp . '/' . $check_out_timestamp; |
| 1219 |
$link_add2gcal .= '&details=' . ( ( 'On' !== get_bk_option( 'booking_g_cal_export_no_data' ) ) ? $fields['description'] : '' ); // FixIn: 10.3.0.1. |
| 1220 |
$link_add2gcal .= '&location=' . ( ( 'On' !== get_bk_option( 'booking_g_cal_export_no_data' ) ) ? $fields['where'] : '' ); |
| 1221 |
$link_add2gcal .= '&trp=false'; |
| 1222 |
if ( ! empty( $params['timezone'] ) ) { |
| 1223 |
$link_add2gcal .= '&ctz=' . str_replace( '%', '%25', $params['timezone'] ); //FixIn: 8.7.3.10 //TimeZone |
| 1224 |
} |
| 1225 |
|
| 1226 |
|
| 1227 |
//$link_add2gcal .= '&sprop='; |
| 1228 |
//$link_add2gcal .= '&sprop=name:'; |
| 1229 |
|
| 1230 |
if ( $button_attr['is_only_url'] ) { |
| 1231 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1232 |
echo $link_add2gcal; |
| 1233 |
} else { |
| 1234 |
|
| 1235 |
?><a href="<?php echo esc_url( $link_add2gcal ); ?>" target="_blank" rel="nofollow" |
| 1236 |
class="tooltip_top <?php echo esc_attr( $button_attr['class'] ) ?>" |
| 1237 |
title="<?php echo esc_attr( $button_attr['hint'] ); ?>" |
| 1238 |
><?php |
| 1239 |
if ( $button_attr['is_show_icon'] ) { |
| 1240 |
?><i class="wpbc_icn_event"></i><?php //FixIn: 9.0.1.4 glyphicon icon-1x glyphicon-export |
| 1241 |
} else { |
| 1242 |
echo esc_js( $button_attr['title'] ); |
| 1243 |
} |
| 1244 |
?></a><?php |
| 1245 |
} |
| 1246 |
|
| 1247 |
if ( ! $echo ) { |
| 1248 |
return ob_get_clean(); |
| 1249 |
} |
| 1250 |
|
| 1251 |
} |
| 1252 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1253 |
// Toolbar Other UI elements - General |
| 1254 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1255 |
|
| 1256 |
/** |
| 1257 |
* Selection elements in toolbar UI selectbox |
| 1258 |
* |
| 1259 |
* @param array $params |
| 1260 |
* |
| 1261 |
* Exmaple: |
| 1262 |
wpbc_toolbar_btn__selection_element( array( |
| 1263 |
'name' => 'resources_count' |
| 1264 |
, 'title' => __('Resources count' ,'booking') . ':' |
| 1265 |
, 'selected' => 1 |
| 1266 |
, 'options' => array_combine( range(1, 201) ,range(1, 201) ) |
| 1267 |
) ) ; |
| 1268 |
|
| 1269 |
*/ |
| 1270 |
function wpbc_toolbar_btn__selection_element( $params ) { |
| 1271 |
|
| 1272 |
$defaults = array( |
| 1273 |
'name' => 'random_' . wp_rand( 1000, 10000 ) |
| 1274 |
, 'title' => __('Total', 'booking') . ':' |
| 1275 |
, 'on_change' => '' //'location.href=\'' . $link_base . '\' + this.value;'; //$link_base = wpbc_get_new_booking_url__base( array( $params['name'] ) ) . '&' . $params['name'] . '=' ; |
| 1276 |
, 'options' => array() |
| 1277 |
, 'selected' => 0 |
| 1278 |
); |
| 1279 |
$params = wp_parse_args( $params, $defaults ); |
| 1280 |
|
| 1281 |
|
| 1282 |
|
| 1283 |
|
| 1284 |
for ( $i = 1; $i < 201; $i++ ) { |
| 1285 |
$form_options[ $i ] = $i; |
| 1286 |
} |
| 1287 |
|
| 1288 |
$params = array( |
| 1289 |
'label_for' => $params['name'] // "For" parameter of label element |
| 1290 |
, 'label' => '' // Label above the input group |
| 1291 |
, 'style' => '' // CSS Style of entire div element |
| 1292 |
, 'items' => array( |
| 1293 |
array( |
| 1294 |
'type' => 'addon' |
| 1295 |
, 'element' => 'text' // text | radio | checkbox |
| 1296 |
, 'text' => $params['title'] |
| 1297 |
, 'class' => '' // Any CSS class here |
| 1298 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 1299 |
) |
| 1300 |
, array( |
| 1301 |
'type' => 'select' |
| 1302 |
, 'id' => $params['name'] // HTML ID of element |
| 1303 |
, 'name' => $params['name'] // HTML ID of element |
| 1304 |
, 'options' => $params['options'] // Associated array of titles and values |
| 1305 |
, 'value' => $params['selected'] // Some Value from optins array that selected by default |
| 1306 |
, 'style' => '' // CSS of select element |
| 1307 |
, 'class' => '' // CSS Class of select element |
| 1308 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1309 |
, 'onchange' => $params['on_change'] |
| 1310 |
) |
| 1311 |
) |
| 1312 |
); |
| 1313 |
?><div class="control-group wpbc-no-padding"><?php |
| 1314 |
wpbc_bs_input_group( $params ); |
| 1315 |
?></div><?php |
| 1316 |
} |
| 1317 |
|
| 1318 |
|
| 1319 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1320 |
// Toolbar S e a r c h F o r m at Top Right side of Settings page |
| 1321 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1322 |
|
| 1323 |
// FixIn: 8.0.1.12. |
| 1324 |
/** |
| 1325 |
* Add hidden input SEARCH KEY field into main form, if previosly was searching by ID or Title |
| 1326 |
* @param array $params => array( 'search_get_key' => 'wh_resource_id' ) |
| 1327 |
*/ |
| 1328 |
function wpbc_hidden_search_by_id_field_in_main_form( $params = array() ){ |
| 1329 |
|
| 1330 |
$defaults = array( |
| 1331 |
'search_get_key' => 'wh_search_id' |
| 1332 |
); |
| 1333 |
$params = wp_parse_args( $params, $defaults ); |
| 1334 |
|
| 1335 |
|
| 1336 |
$search_form_value = ''; |
| 1337 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 1338 |
if ( isset( $_REQUEST[ $params[ 'search_get_key' ] ] ) ) { |
| 1339 |
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 1340 |
$wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params['search_get_key'] ] ); // '12,0,45,9' or '10'. |
| 1341 |
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 1342 |
$wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params['search_get_key'] ] ); // Clean string. |
| 1343 |
|
| 1344 |
if ( ! empty( $wh_resource_id ) ) { |
| 1345 |
$search_form_value = $wh_resource_id; |
| 1346 |
} else { |
| 1347 |
$search_form_value = $wh_resource_title; |
| 1348 |
} |
| 1349 |
} |
| 1350 |
|
| 1351 |
if ( '' !== $search_form_value ) { |
| 1352 |
?><input name="<?php echo esc_attr( $params['search_get_key'] ); ?>" value="<?php echo esc_attr( $search_form_value ); ?>" type="hidden"><?php |
| 1353 |
} |
| 1354 |
} |
| 1355 |
|
| 1356 |
/** |
| 1357 |
* Real Search booking data by ID | Title (at top right side of page) |
| 1358 |
* |
| 1359 |
* @param array $params - array of parameters |
| 1360 |
* Exmaple: |
| 1361 |
wpbc_toolbar_search_by_id__top_form( array( |
| 1362 |
'search_form_id' => 'wpbc_seasonfilters_search_form' |
| 1363 |
, 'search_get_key' => 'wh_search_id' |
| 1364 |
, 'is_pseudo' => false |
| 1365 |
) ); |
| 1366 |
|
| 1367 |
*/ |
| 1368 |
function wpbc_toolbar_search_by_id__top_form( $params ) { |
| 1369 |
|
| 1370 |
$defaults = array( |
| 1371 |
'search_form_id' => 'wpbc_seasonfilters_search_form' |
| 1372 |
, 'search_get_key' => 'wh_search_id' |
| 1373 |
, 'is_pseudo' => false //'location.href=\'' . $link_base . '\' + this.value;'; //$link_base = wpbc_get_new_booking_url__base( array( $params['name'] ) ) . '&' . $params['name'] . '=' ; |
| 1374 |
, 'container_style' => 'position: absolute; right: 20px; top: 0px;z-index: 0;' // FixIn: 10.0.0.29. |
| 1375 |
); |
| 1376 |
$params = wp_parse_args( $params, $defaults ); |
| 1377 |
|
| 1378 |
|
| 1379 |
$exclude_params = array(); //array('page_num', 'orderby', 'order'); - if using "only_these_parameters", then this parameter does NOT require |
| 1380 |
$only_these_parameters = array( 'page', 'tab', 'subtab', $params[ 'search_get_key' ] ); //FixIn: 8.1.1.11 - added , 'subtab' - ability to search booking resources in sub tab pages in settings |
| 1381 |
$wpbc_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false, false ), $exclude_params, $only_these_parameters ); |
| 1382 |
|
| 1383 |
|
| 1384 |
$search_form_value = ''; |
| 1385 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 1386 |
if ( isset( $_REQUEST[ $params[ 'search_get_key' ] ] ) ) { |
| 1387 |
$wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params[ 'search_get_key' ] ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // '12,0,45,9' or '10' |
| 1388 |
$wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params[ 'search_get_key' ] ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // Clean string |
| 1389 |
if ( ! empty( $wh_resource_id ) ) { |
| 1390 |
$search_form_value = $wh_resource_id; |
| 1391 |
} else { |
| 1392 |
$search_form_value = $wh_resource_title; |
| 1393 |
} |
| 1394 |
} |
| 1395 |
|
| 1396 |
|
| 1397 |
wpbc_clear_div(); |
| 1398 |
|
| 1399 |
?> |
| 1400 |
<span class="wpdevelop"> |
| 1401 |
|
| 1402 |
<?php if ( ! $params['is_pseudo'] ) { ?> |
| 1403 |
<div style="<?php echo esc_attr( $params['container_style'] ); ?>"> |
| 1404 |
<form action="<?php echo esc_url( $wpbc_admin_url ); ?>" method="post" id="<?php echo esc_attr( $params[ 'search_form_id' ] ); ?>" name="<?php echo esc_attr( $params[ 'search_form_id' ] ); ?>" > |
| 1405 |
<?php |
| 1406 |
} else { |
| 1407 |
?><div style="float:right;" id="<?php echo esc_attr( $params['search_form_id'] . '_pseudo' ); ?>"><?php |
| 1408 |
} |
| 1409 |
|
| 1410 |
|
| 1411 |
if(0){ |
| 1412 |
$params_for_element = array( 'label_for' => $params[ 'search_get_key' ] . ( ( $params['is_pseudo'] ) ? '_pseudo' : '' ) |
| 1413 |
, 'label' => ''//__('Keyword:', 'booking') |
| 1414 |
, 'items' => array( |
| 1415 |
array( 'type' => 'text' |
| 1416 |
, 'id' => $params[ 'search_get_key' ] . ( ( $params['is_pseudo'] ) ? '_pseudo' : '' ) |
| 1417 |
, 'value' => $search_form_value |
| 1418 |
, 'placeholder' => __('ID or Title', 'booking') |
| 1419 |
) |
| 1420 |
, array( |
| 1421 |
'type' => 'button' |
| 1422 |
, 'title' => __('Go', 'booking') |
| 1423 |
, 'class' => 'button-secondary' |
| 1424 |
, 'font_icon' => 'wpbc_icn_search' |
| 1425 |
, 'icon_position' => 'right' |
| 1426 |
, 'action' => ( ( ! $params['is_pseudo'] ) ? "jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" |
| 1427 |
: "jQuery('#" . $params[ 'search_get_key' ] . "').val( jQuery('#" . $params[ 'search_get_key' ] . "_pseudo').val() ); jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" ) //Submit real form at the top of page. |
| 1428 |
) |
| 1429 |
) |
| 1430 |
); |
| 1431 |
|
| 1432 |
?><div class="control-group wpbc-no-padding" ><?php |
| 1433 |
wpbc_bs_input_group( $params_for_element ); |
| 1434 |
?></div><?php |
| 1435 |
} else { |
| 1436 |
?><div id="booking_resources_toolbar_container" class="wpbc_ajx_toolbar wpbc_background_transparent"><?php |
| 1437 |
|
| 1438 |
?><div class="ui_container ui_container_toolbar ui_container_small ui_container_options ui_container_options_row_1" |
| 1439 |
style=" display: flex"><?php |
| 1440 |
|
| 1441 |
?><div class="ui_group"><?php |
| 1442 |
|
| 1443 |
// Search Keyword text field |
| 1444 |
?><div class="ui_element"><?php |
| 1445 |
|
| 1446 |
$el_id = 'booking_resource_search_keyword'; |
| 1447 |
|
| 1448 |
$default_value = $search_form_value; |
| 1449 |
|
| 1450 |
$params_for_element = array( |
| 1451 |
'type' => 'text' |
| 1452 |
, 'id' => $params[ 'search_get_key' ] . ( ( $params['is_pseudo'] ) ? '_pseudo' : '' ) |
| 1453 |
, 'name' => $params[ 'search_get_key' ] . ( ( $params['is_pseudo'] ) ? '_pseudo' : '' ) |
| 1454 |
, 'label' => '' |
| 1455 |
, 'disabled' => false |
| 1456 |
, 'class' => '' |
| 1457 |
, 'style' => 'min-width:100px;' |
| 1458 |
, 'placeholder' => __('ID or Title' ,'booking') |
| 1459 |
, 'attr' => array( 'maxlength' => '200' ) |
| 1460 |
, 'value' => $default_value |
| 1461 |
, 'onfocus' => '' |
| 1462 |
); |
| 1463 |
|
| 1464 |
wpbc_flex_text( $params_for_element ); |
| 1465 |
|
| 1466 |
?></div><?php |
| 1467 |
|
| 1468 |
|
| 1469 |
// Reset keyword |
| 1470 |
$params_for_element = array( |
| 1471 |
'type' => 'button' , |
| 1472 |
'title' => '',//__( 'Reset', 'booking' ) . ' ', // Title of the button |
| 1473 |
'hint' => array( 'title' => __( 'Reset keyword text field', 'booking' ), 'position' => 'top' ), // Hint |
| 1474 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1475 |
// 'action' => "jQuery( '#booking_resource_search_keyword').val(''); |
| 1476 |
// window.location.href='" . $option_params['url'] . "';", // JavaScript |
| 1477 |
'action' => ( ( ! $params['is_pseudo'] ) ? "jQuery('#" . $params[ 'search_get_key' ] . "').val( '' ); jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" |
| 1478 |
: "jQuery('#" . $params[ 'search_get_key' ] . "').val( '' ); jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" ) , |
| 1479 |
'icon' => array( |
| 1480 |
'icon_font' => 'wpbc_icn_close', //'wpbc_icn_rotate_left', |
| 1481 |
'position' => 'left', |
| 1482 |
'icon_img' => '' |
| 1483 |
), |
| 1484 |
'class' => 'wpbc_button_as_icon', // '' | 'wpbc_ui_button_primary' |
| 1485 |
'style' => '', // Any CSS class here |
| 1486 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1487 |
'attr' => array() |
| 1488 |
); |
| 1489 |
|
| 1490 |
?><div class="ui_element" style="flex: 0 1 auto;margin-left: -50px;z-index: 1;"><?php |
| 1491 |
wpbc_flex_button( $params_for_element ); |
| 1492 |
?></div><?php |
| 1493 |
|
| 1494 |
|
| 1495 |
// Go button |
| 1496 |
?><div class="ui_element"><?php |
| 1497 |
|
| 1498 |
$booking_action = 'booking_resource_search_keyword_btn'; |
| 1499 |
|
| 1500 |
$el_id = 'ui_btn_' . $booking_action; |
| 1501 |
|
| 1502 |
// Escaped construction of search keyword. // FixIn: 9.9.0.11. |
| 1503 |
$params_for_element = array( |
| 1504 |
'type' => 'button' , |
| 1505 |
'title' => '',//__( 'Search', 'booking' ) . ' ', // Title of the button |
| 1506 |
'hint' => array( 'title' => __('Search' ,'booking'), 'position' => 'top' ), // Hint |
| 1507 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1508 |
//'link' => $option_params['url'] . '&wh_resource_id=sdfs+f', |
| 1509 |
// 'action' => "if (jQuery('#booking_resource_search_keyword' ).val() == '' ) { |
| 1510 |
// wpbc_field_highlight( '#booking_resource_search_keyword' ); |
| 1511 |
// } else { |
| 1512 |
// window.location.href='" . $option_params['url'] . "&wh_resource_id='+window.encodeURIComponent(jQuery('#booking_resource_search_keyword' ).val()); |
| 1513 |
// }" , |
| 1514 |
'action' => ( ( ! $params['is_pseudo'] ) ? "jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" |
| 1515 |
: "jQuery('#" . $params[ 'search_get_key' ] . "').val( jQuery('#" . $params[ 'search_get_key' ] . "_pseudo').val() ); jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" ) , |
| 1516 |
|
| 1517 |
'icon' => array( |
| 1518 |
'icon_font' => 'wpbc_icn_search', |
| 1519 |
'position' => 'left', |
| 1520 |
'icon_img' => '' |
| 1521 |
), |
| 1522 |
'class' => 'wpbc_ui_button _primary', // '' | 'wpbc_ui_button_primary' |
| 1523 |
'style' => '', // Any CSS class here |
| 1524 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1525 |
'attr' => array( 'id' => $el_id ) |
| 1526 |
); |
| 1527 |
|
| 1528 |
wpbc_flex_button( $params_for_element ); |
| 1529 |
|
| 1530 |
?></div><?php |
| 1531 |
|
| 1532 |
?></div><?php |
| 1533 |
|
| 1534 |
?></div><?php |
| 1535 |
|
| 1536 |
?></div><?php |
| 1537 |
|
| 1538 |
} |
| 1539 |
|
| 1540 |
|
| 1541 |
|
| 1542 |
|
| 1543 |
if ( ! $params['is_pseudo'] ) { ?> |
| 1544 |
</form> |
| 1545 |
<?php } ?> |
| 1546 |
<?php wpbc_clear_div(); ?> |
| 1547 |
|
| 1548 |
<?php |
| 1549 |
if ( $params['is_pseudo'] ) { |
| 1550 |
// Required for opening specific page NUM during saving //////// |
| 1551 |
?><input type="hidden" value="<?php |
| 1552 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1553 |
echo $search_form_value; ?>" name="<?php echo esc_attr( $params[ 'search_get_key' ] ); ?>" /><?php |
| 1554 |
?><div class="clear" style="height:20px;"></div><?php |
| 1555 |
} |
| 1556 |
?> |
| 1557 |
</div> |
| 1558 |
</span> |
| 1559 |
<?php |
| 1560 |
|
| 1561 |
if ( $params['is_pseudo'] ) { |
| 1562 |
|
| 1563 |
// Hide pseudo form, if real search form does not exist |
| 1564 |
?> |
| 1565 |
<script type="text/javascript"> |
| 1566 |
jQuery(document).ready(function(){ |
| 1567 |
if ( jQuery('#<?php echo esc_js( $params[ 'search_form_id' ] ); ?>').length == 0 ) { |
| 1568 |
jQuery('#<?php echo esc_js( $params['search_form_id'] . '_pseudo' ); ?>').hide(); |
| 1569 |
} |
| 1570 |
}); |
| 1571 |
</script> |
| 1572 |
<?php |
| 1573 |
} |
| 1574 |
} |
| 1575 |
|
| 1576 |
|
| 1577 |
// FixIn: 9.6.3.5. |
| 1578 |
|
| 1579 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1580 |
// JS & CSS |
| 1581 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1582 |
|
| 1583 |
/** |
| 1584 |
* Load support JavaScript for "Bookings" page :: JS Tooltips, Popover, Datepicker |
| 1585 |
*/ |
| 1586 |
function wpbc_js_for_bookings_page() { |
| 1587 |
|
| 1588 |
wpbc_bs_javascript_tooltips(); // JS Tooltips |
| 1589 |
wpbc_bs_javascript_popover(); // JS Popover |
| 1590 |
wpbc_datepicker_js(); // JS Datepicker |
| 1591 |
wpbc_datepicker_css(); // CSS DatePicker |
| 1592 |
} |
| 1593 |
|
| 1594 |
|
| 1595 |
/** Datepicker activation JavaScript */ |
| 1596 |
function wpbc_datepicker_js() { |
| 1597 |
|
| 1598 |
?><script type="text/javascript"> |
| 1599 |
//jQuery(document).ready( function(){ |
| 1600 |
<?php |
| 1601 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1602 |
echo wpbc_jq_ready_start(); |
| 1603 |
?> |
| 1604 |
if ( 'function' === typeof( jQuery('input.wpdevbk-filters-section-calendar').datepick ) ) { |
| 1605 |
jQuery( 'input.wpdevbk-filters-section-calendar' ).datepick( |
| 1606 |
{ |
| 1607 |
beforeShowDay : function ( date ) { |
| 1608 |
return [true, 'date_available']; |
| 1609 |
}, |
| 1610 |
showOn : 'focus', |
| 1611 |
multiSelect : 0, |
| 1612 |
numberOfMonths : 1, |
| 1613 |
stepMonths : 1, |
| 1614 |
prevText : '‹', |
| 1615 |
nextText : '›', |
| 1616 |
dateFormat : 'yy-mm-dd', |
| 1617 |
changeMonth : false, |
| 1618 |
changeYear : false, |
| 1619 |
minDate : null, |
| 1620 |
maxDate : null, //'1Y', |
| 1621 |
showStatus : false, |
| 1622 |
multiSeparator : ', ', |
| 1623 |
closeAtTop : null, //!false, |
| 1624 |
firstDay :<?php echo intval(get_bk_option( 'booking_start_day_weeek' )); ?>, |
| 1625 |
gotoCurrent : false, |
| 1626 |
hideIfNoPrevNext: true, |
| 1627 |
useThemeRoller : false, |
| 1628 |
mandatory : true |
| 1629 |
} |
| 1630 |
); |
| 1631 |
} else { |
| 1632 |
console.log( 'WPBC Error. JavaScript library "datepick" was not defined.' ); |
| 1633 |
} |
| 1634 |
<?php |
| 1635 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1636 |
echo wpbc_jq_ready_end(); ?> |
| 1637 |
//}); |
| 1638 |
</script><?php |
| 1639 |
} |
| 1640 |
|
| 1641 |
|
| 1642 |
/** Support CSS - datepick, etc... */ |
| 1643 |
function wpbc_datepicker_css(){ |
| 1644 |
|
| 1645 |
// FixIn: 9.7.3.4 |
| 1646 |
$width = 300; |
| 1647 |
$height = 40; |
| 1648 |
?> |
| 1649 |
<style type="text/css"> |
| 1650 |
#datepick-div { |
| 1651 |
max-width: <?php echo intval( $width ); ?>px !important; |
| 1652 |
width:100%; |
| 1653 |
margin-top: 2px; |
| 1654 |
background: #fff; |
| 1655 |
} |
| 1656 |
#datepick-div .datepick-days-cell { |
| 1657 |
height: <?php echo intval( $height ); ?>px !important; |
| 1658 |
} |
| 1659 |
#datepick-div .datepick-control { |
| 1660 |
display: none; |
| 1661 |
font-size: 10px; |
| 1662 |
text-align: center; |
| 1663 |
} |
| 1664 |
#datepick-div .datepick .datepick-days-cell a{ |
| 1665 |
font-size: 12px; |
| 1666 |
} |
| 1667 |
#datepick-div table.datepick tr td { |
| 1668 |
padding: 0 !important; |
| 1669 |
} |
| 1670 |
#datepick-div .datepick-one-month { |
| 1671 |
height: auto; |
| 1672 |
} |
| 1673 |
</style> |
| 1674 |
<?php |
| 1675 |
} |
| 1676 |
|
| 1677 |
|
| 1678 |
/** Sortable Table JavaScript */ |
| 1679 |
function wpbc_sortable_js() { |
| 1680 |
?> |
| 1681 |
<script type="text/javascript"> |
| 1682 |
// Activate Sortable Functionality |
| 1683 |
jQuery( document ).ready(function(){ |
| 1684 |
|
| 1685 |
jQuery('.wpbc_input_table tbody th').css('cursor','move'); |
| 1686 |
|
| 1687 |
jQuery('.wpbc_input_table tbody td.sort').css('cursor','move'); |
| 1688 |
|
| 1689 |
jQuery('.wpbc_input_table.sortable tbody').sortable({ |
| 1690 |
items:'tr', |
| 1691 |
cursor:'move', |
| 1692 |
axis:'y', |
| 1693 |
scrollSensitivity:40, |
| 1694 |
forcePlaceholderSize: true, |
| 1695 |
helper: 'clone', |
| 1696 |
opacity: 0.65, |
| 1697 |
placeholder: '.wpbc_sortable_table .sort', |
| 1698 |
start:function(event,ui){ |
| 1699 |
ui.item.css('background-color','#f6f6f6'); |
| 1700 |
}, |
| 1701 |
stop:function(event,ui){ |
| 1702 |
ui.item.removeAttr('style'); |
| 1703 |
} |
| 1704 |
}); |
| 1705 |
}); |
| 1706 |
</script> |
| 1707 |
<?php |
| 1708 |
|
| 1709 |
} |