PluginProbe
Booking Calendar / 10.11
Booking Calendar v10.11
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
booking / includes / ui_modal__shortcodes / sh_tpl_booking.php

sh_tpl_booking.php in Booking Calendar 10.11, at includes/ui_modal__shortcodes/sh_tpl_booking.php

1,470 lines 67.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package Booking Calendar Shortcodes Config
5 * @subpackage Shortcodes Content - Booking Calendar Form e.g.: [booking resource_id=1 nummonths=3 options='{calendar months_num_in_row=3 width=100% cell_height=50px}']
6 * @category Shortcodes
7 *
8 * @author wpdevelop
9 * @link https://wpbookingcalendar.com/
10 * @email info@wpbookingcalendar.com
11 *
12 * @modified 2024-01-21
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.9.0.15.
16
17 // =====================================================================================================================
18 // Left Navigation Panel
19 // =====================================================================================================================
20
21 /**
22 * Left Vertical Navigation panel
23 * @return void
24 */
25 function wpbc_shortcode_config__navigation_panel(){
26
27 $wpbm_version = wpbc_get_wpbm_version();
28 $wpbm_minimum_version = '2.1';
29
30 // If lower than 2, than show warning
31 if ( version_compare( $wpbm_version, $wpbm_minimum_version, '<') ) {
32 $is_bm_exist = false;
33 } else {
34 $is_bm_exist = true;
35 }
36
37 ?>
38 <div class="wpbc_settings_navigation_column wpbc_shortcode_config_navigation_column">
39 <div id="wpbc_shortcode_config__nav_tab__booking" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active">
40 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking', 'booking' );" href="javascript:void(0);">
41 <span><?php esc_html_e( 'Booking Form with Calendar', 'booking' ) ?></span>
42 </a>
43 </div>
44 <div id="wpbc_shortcode_config__nav_tab__bookingcalendar" class="wpbc_settings_navigation_item wpbc_navigation_sub_item">
45 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingcalendar', 'bookingcalendar' );" href="javascript:void(0);">
46 <span><?php esc_html_e( 'Availability Calendar / Days Not Selectable', 'booking' ); ?></span>
47 </a>
48 </div>
49 <div id="wpbc_shortcode_config__nav_tab__bookingselect" class="wpbc_settings_navigation_item wpbc_dismiss__booking_select <?php echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? ' wpbc_settings_navigation_item_disabled ' : ''; ?>">
50 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingselect', 'bookingselect' );" href="javascript:void(0);">
51 <span><?php esc_html_e( 'Resource Selection', 'booking' ); ?></span><?php
52 echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? '<span class="wpbc_pro_label">Pro</span>' : '';
53 ?>
54 </a>
55 </div>
56 <div id="wpbc_shortcode_config__nav_tab__bookingform" class="wpbc_settings_navigation_item wpbc_dismiss__booking_form_only <?php echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? ' wpbc_settings_navigation_item_disabled ' : ''; ?>">
57 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingform', 'bookingform' );" href="javascript:void(0);">
58 <span><?php esc_html_e( 'Only Form', 'booking' ) ?></span><?php
59 if ( ! class_exists( 'wpdev_bk_personal' ) ){
60 echo '<span class="wpbc_pro_label">Pro</span>';
61 } else{
62 echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? '<span class="wpbc_pro_label">BL</span>' : '';
63 }
64 ?>
65 </a>
66 </div>
67 <div id="wpbc_shortcode_config__nav_tab__bookingtimeline" class="wpbc_settings_navigation_item wpbc_navigation_top_border">
68 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingtimeline', 'bookingtimeline' );" href="javascript:void(0);">
69 <span><?php esc_html_e( 'TimeLine', 'booking' ); ?></span>
70 </a>
71 </div>
72 <div id="wpbc_shortcode_config__nav_tab__bookingsearch" class="wpbc_settings_navigation_item wpbc_dismiss__booking_search <?php echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? ' wpbc_settings_navigation_item_disabled ' : ''; ?>">
73 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingsearch', 'bookingsearch' );" href="javascript:void(0);">
74 <span><?php esc_html_e( 'Search Availability', 'booking' ) ?></span><?php
75 if ( ! class_exists( 'wpdev_bk_personal' ) ){
76 echo '<span class="wpbc_pro_label">Pro</span>';
77 } else{
78 echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? '<span class="wpbc_pro_label">BL</span>' : '';
79 }
80 ?>
81 </a>
82 </div>
83 <div id="wpbc_shortcode_config__nav_tab__bookingother" class="wpbc_settings_navigation_item">
84 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingother', 'bookingother' );" href="javascript:void(0);">
85 <span><?php esc_html_e( 'Other', 'booking' ); ?></span><?php
86 //echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? '<span class="wpbc_pro_label">Pro</span>' : '';
87 ?>
88 </a>
89 </div>
90 <?php if ( $is_bm_exist ) { ?>
91 <div id="wpbc_shortcode_config__nav_tab__booking_import_ics" class="wpbc_settings_navigation_item wpbc_navigation_top_border">
92 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_import_ics', 'booking_import_ics' );" href="javascript:void(0);">
93 <span><?php esc_html_e( 'Import Events (.ics feed)', 'booking' ) ?></span>
94 </a>
95 </div>
96 <div id="wpbc_shortcode_config__nav_tab__booking_listing_ics" class="wpbc_settings_navigation_item wpbc_navigation_sub_item">
97 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_listing_ics' , 'booking_listing_ics');" href="javascript:void(0);">
98 <span><?php esc_html_e( 'Show .ics Listing of Events', 'booking' ); ?></span>
99 </a>
100 </div>
101 <?php } ?>
102 </div>
103 <?php
104 }
105
106
107 // =====================================================================================================================
108 // Shortcode [booking ... ]
109 // =====================================================================================================================
110
111 /**
112 * Content of PopUp - for shortcode [booking ...]
113 *
114 * @return void
115 */
116 function wpbc_shortcode_config__content__booking() {
117
118 $shortcode_name = 'booking';
119
120 ?><div id="wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>" class="wpbc_sc_container__shortcode wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>"><?php
121
122 wpbc_shortcode_config__booking__top_tabs();
123
124 // 'General' --------------------------------------------------------------------------------------------------
125 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__general">
126 <table class="form-table"><tbody><?php
127
128 // Booking Resource
129 wpbc_shortcode_config_fields__select_resource( $shortcode_name . '_wpbc_resource_id', $shortcode_name );
130
131 // Custom form
132 wpbc_shortcode_config_fields__select_custom_form( $shortcode_name . '_wpbc_custom_form', $shortcode_name );
133
134 // Number of Months
135 wpbc_shortcode_config_fields__select_nummonths( $shortcode_name . '_wpbc_nummonths', $shortcode_name );
136
137 // Calendar Size
138 wpbc_shortcode_config_fields__calendar_size( $shortcode_name . '_wpbc_size', $shortcode_name );
139
140 ?></tbody></table>
141 </div><?php
142
143 // 'Conditional Days Selection' --------------------------------------------------------------------------------
144 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__conditions"><?php
145
146 wpbc_shortcode_config_fields__dates_conditions_toolbar(); // TOOLBAR
147
148 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__weekdays_conditions">
149 <?php
150 wpbc_shortcode_config_fields__weekdays_conditions( $shortcode_name . 'wpbc_select_day_weekday', $shortcode_name );
151 ?>
152 </div><?php
153
154 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__seasons_conditions">
155 <?php
156 wpbc_shortcode_config_fields__season_conditions( $shortcode_name . 'wpbc_select_day_season', $shortcode_name );
157 ?>
158 </div><?php
159
160 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__startseason_conditions">
161 <?php
162 wpbc_shortcode_config_fields__season_start_day_conditions( $shortcode_name . 'wpbc_start_day_season', $shortcode_name )
163 ?>
164 </div><?php
165
166 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__dates_conditions">
167 <?php
168 wpbc_shortcode_config_fields__fordate_conditions( $shortcode_name . 'wpbc_select_day_fordate', $shortcode_name );
169 ?>
170 </div><?php
171
172 ?></div><?php
173
174 // 'AGGREGATE' -------------------------------------------------------------------------------------------------
175 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__aggregate"><?php
176
177 wpbc_shortcode_config_fields__aggregate( $shortcode_name . '_wpbc_aggregate', $shortcode_name );
178
179 ?></div><?php
180
181 // 'START MONTH' -----------------------------------------------------------------------------------------------
182 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__other"><?php
183 ?><table class="form-table"><tbody><?php
184 wpbc_shortcode_config_fields__start_month( $shortcode_name . '_wpbc_startmonth', $shortcode_name );
185 ?></tbody></table><?php
186 ?></div><?php
187
188
189
190 ?>
191 <div class="wpbc_shortcode_config_content_toolbar__next_prior">
192 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button">
193 <span class="in-button-text">&lsaquo;</span>
194 </a>
195 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button">
196 <span class="in-button-text">&rsaquo;</span>
197 </a>
198 </div>
199 <?php
200
201 ?></div><?php
202
203 wpbc_clear_div();
204 }
205
206
207 /**
208 * Top Tabs for shortcode [booking ...]
209 * @return void
210 */
211 function wpbc_shortcode_config__booking__top_tabs(){
212
213 $shortcode_name = 'booking';
214
215 wpbc_bs_toolbar_tabs_html_container_start();
216
217 $js = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');"
218 . "jQuery(this).addClass('nav-tab-active');"
219 . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
220 . "jQuery('.nav-tab-active i').addClass('icon-white');"
221 . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();";
222
223 wpbc_bs_display_tab( array(
224 'title' => __('Booking Calendar Form', 'booking')
225 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
226 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__general').show();"
227 , 'font_icon' => 'wpbc-bi-calendar3-range'
228 , 'default' => true
229 ) );
230 wpbc_bs_display_tab( array(
231 'title' => __('Conditional Days Selection', 'booking')
232 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
233 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__conditions').show();"
234 , 'font_icon' => 'wpbc-bi-calendar2-week'
235 , 'default' => false
236 , 'css_classes' => 'wpbc_dismiss__conditional_days'
237 ) );
238 wpbc_bs_display_tab( array(
239 'title' => __('Aggregate', 'booking')
240 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
241 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__aggregate').show();"
242 , 'font_icon' => 'wpbc-bi-calendar2-plus'
243 , 'default' => false
244 , 'css_classes' => 'wpbc_dismiss__booking_param_aggregate'
245 ) );
246 wpbc_bs_display_tab( array(
247 'title' => __('Advanced', 'booking')
248 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
249 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__other').show();"
250 , 'font_icon' => 'wpbc_icn_tune'
251 , 'default' => false
252
253 ) );
254
255 wpbc_bs_toolbar_tabs_html_container_end();
256 }
257
258
259
260 // =====================================================================================================================
261 // Fields
262 // =====================================================================================================================
263
264 /**
265 * Shortcode Field: Select-box - "Booking Resource"
266 *
267 * @param $id
268 * @param $group_key
269 *
270 * @return void
271 */
272 function wpbc_shortcode_config_fields__select_resource( $id , $group_key ){
273
274 if ( class_exists( 'wpdev_bk_personal' ) ){
275
276 WPBC_Settings_API::field_select_row_static( $id
277 , array(
278 'type' => 'select'
279 , 'title' => __( 'Booking resource', 'booking')
280 , 'description' => __( 'Select booking resource', 'booking' )
281 , 'description_tag' => 'span'
282 , 'label' => ''
283 , 'multiple' => false
284 , 'group' => $group_key
285 , 'tr_class' => $group_key . '_standard_section'
286 , 'class' => ''
287 , 'css' => 'margin-right:10px;'
288 , 'only_field' => false
289 , 'attr' => array()
290 , 'value' => ''
291 , 'options' => wpbc_get_all_booking_resources_list()
292 ) );
293 }
294
295 }
296
297 /**
298 * Shortcode Field: Select-box - "Custom Booking Form"
299 *
300 * @param $id
301 * @param $group_key
302 *
303 * @return void
304 */
305 function wpbc_shortcode_config_fields__select_custom_form( $id , $group_key ){
306
307 if ( class_exists( 'wpdev_bk_biz_m' ) ){
308 wpbc_in_settings__form_selection( array(
309 'name' => $id
310 , 'title' => __('Booking Form', 'booking')
311 , 'description' => __('Select custom booking form' ,'booking')
312 , 'group' => $group_key
313 )
314 );
315 }
316 }
317
318 /**
319 * Shortcode Field: Select-box - "Calendar Months Number"
320 *
321 * @param $id
322 * @param $group_key
323 *
324 * @return void
325 */
326 function wpbc_shortcode_config_fields__select_nummonths( $id , $group_key ){
327
328 WPBC_Settings_API::field_select_row_static( $id
329 , array(
330 'type' => 'select'
331 , 'title' => __('Visible months', 'booking')
332 , 'description' => __('Select number of month to show for calendar.' ,'booking')
333 , 'description_tag' => 'span'
334 , 'label' => ''
335 , 'multiple' => false
336 , 'group' => $group_key
337 , 'tr_class' => $group_key . '_standard_section'
338 , 'class' => ''
339 , 'css' => 'margin-right:10px;'
340 , 'only_field' => false
341 , 'attr' => array()
342 , 'value' => get_bk_option( 'booking_client_cal_count' )
343 , 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) )
344 )
345 );
346 }
347
348 /**
349 * Shortcode Fields: OPTION - "Define Calendar Size"
350 *
351 * @param $id
352 * @param $group_key
353 *
354 * @return void
355 */
356 function wpbc_shortcode_config_fields__calendar_size( $id , $group_key ){
357
358 // ---------------------------------------------------------------------------------------------------------
359 WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled'
360 , array(
361 'type' => 'checkbox'
362 , 'title' => __('Setup Size & Structure', 'booking')
363 , 'description' => __('Configure Calendar Size and Structure', 'booking')
364 , 'description_tag' => 'span'
365 , 'label' => ''
366 , 'class' => ''
367 , 'css' => ''
368 , 'tr_class' => ''
369 , 'attr' => array()
370 , 'group' => $group_key
371 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed'
372 , 'only_field' => !true
373 , 'is_new_line' => false
374 , 'value' => false
375 )
376 );
377
378 WPBC_Settings_API::field_select_row_static( $id . '_months_num_in_row'
379 , array(
380 'type' => 'select'
381 , 'title' => __('Number of months in a row', 'booking')
382 , 'description' => __('Select the number of months to show in one row on a wide screen.' ,'booking')
383 , 'description_tag' => 'span'
384 , 'label' => ''
385 , 'multiple' => false
386 , 'group' => $group_key
387 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_calendar_size'
388 , 'class' => ''
389 , 'css' => 'margin-right:10px;'
390 , 'only_field' => false
391 , 'attr' => array()
392 , 'value' => get_bk_option( 'booking_client_cal_count' )
393 , 'options' => array_combine( range( 1, 6 ), range( 1, 6 ) )
394 )
395 );
396
397 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_sub_settings_grayed <?php echo esc_attr( $id ); ?>_wpbc_sc_calendar_size">
398 <th scope="row" style="vertical-align: middle;">
399 <label for="wpbc_booking_width" class="wpbc-form-text"><?php esc_html_e('Calendar width:', 'booking'); ?></label>
400 </th>
401 <td class=""><fieldset><?php
402
403 WPBC_Settings_API::field_text_row_static( $id . '_calendar_width'
404 , array(
405 'type' => 'text'
406 , 'placeholder' => '100'
407 , 'class' => ''
408 , 'css' => 'width:5em;'
409 , 'only_field' => true
410 , 'attr' => array()
411 , 'value' => '100'
412 )
413 );
414 WPBC_Settings_API::field_select_row_static( $id . '_calendar_width_px_pr'
415 , array(
416 'type' => 'select'
417 , 'multiple' => false
418 , 'class' => ''
419 , 'css' => 'width:4em;'
420 , 'only_field' => true
421 , 'attr' => array()
422 , 'value' => '%'
423 , 'options' => array( 'px' => 'px', '%' => '%' )
424 )
425 );
426 ?><span class="description"> <?php esc_html_e('Set width of calendar' ,'booking'); ?></span></fieldset></td>
427 </tr><?php
428
429 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_sub_settings_grayed <?php echo esc_attr( $id ); ?>_wpbc_sc_calendar_size">
430 <th scope="row" style="vertical-align: middle;"><label for="wpbc_booking_cell_height" class="wpbc-form-text"><?php esc_html_e('Calendar cell height:', 'booking'); ?></label></th>
431 <td class="">
432 <fieldset><?php
433
434 WPBC_Settings_API::field_text_row_static( $id . '_calendar_cell_height'
435 , array(
436 'type' => 'text'
437 , 'placeholder' => '50'
438 , 'class' => ''
439 , 'css' => 'width:5em;'
440 , 'only_field' => true
441 , 'attr' => array()
442 , 'value' => '50'
443 )
444 );
445 WPBC_Settings_API::field_select_row_static( $id . '_calendar_cell_height_px_pr'
446 , array(
447 'type' => 'select'
448 , 'multiple' => false
449 , 'class' => ''
450 , 'css' => 'width:4em;'
451 , 'only_field' => true
452 , 'attr' => array()
453 , 'value' => '%'
454 , 'options' => array( 'px' => 'px' )
455 )
456 );
457 ?><span class="description"> <?php esc_html_e('Set cell height for calendar' ,'booking'); ?></span>
458 </fieldset>
459 </td>
460 </tr><?php
461
462 }
463
464 /**
465 * Shortcode Fields: Start Month
466 *
467 * @param $id
468 * @param $group_key
469 *
470 * @return void
471 */
472 function wpbc_shortcode_config_fields__start_month( $id , $group_key ){
473
474 ////////////////////////////////////////////////////////////////////
475 // Start Month
476 ////////////////////////////////////////////////////////////////////
477 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>">
478 <th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php esc_html_e('Start month:', 'booking'); ?></label></th>
479 <td class=""><fieldset><?php
480
481 WPBC_Settings_API::field_checkbox_row_static( $id . '_active'
482 , array(
483 'type' => 'checkbox'
484 , 'title' => ''
485 , 'description' => ''
486 , 'description_tag' => 'span'
487 , 'label' => ''
488 , 'class' => ''
489 , 'css' => ''
490 , 'tr_class' => ''
491 , 'attr' => array()
492 , 'group' => $group_key
493 , 'only_field' => true
494 , 'is_new_line' => false
495 , 'value' => false
496 )
497 );
498
499 WPBC_Settings_API::field_select_row_static( $id . '_year'
500 , array(
501 'type' => 'select'
502 , 'title' => ''
503 , 'description' => ''
504 , 'description_tag' => 'span'
505 , 'label' => ''
506 , 'multiple' => false
507 , 'group' => $group_key
508 , 'class' => ''
509 , 'css' => 'width:5em;'
510 , 'only_field' => true
511 , 'attr' => array()
512 , 'value' => gmdate( 'Y' )
513 , 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) )
514 )
515 );
516 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
517
518 WPBC_Settings_API::field_select_row_static( $id . '_month'
519 , array(
520 'type' => 'select'
521 , 'title' => ''
522 , 'description' => ''
523 , 'description_tag' => 'span'
524 , 'label' => ''
525 , 'multiple' => false
526 , 'group' => $group_key
527 , 'class' => ''
528 , 'css' => 'width:4em;'
529 , 'only_field' => true
530 , 'attr' => array()
531 , 'value' => gmdate('n')
532 , 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) )
533 )
534 );
535
536 ?><span class="description"> <?php esc_html_e('Select start month of calendar' ,'booking'); ?></span></fieldset></td>
537 </tr><?php
538
539 }
540
541 /**
542 * Shortcode Fields: AGGREGATE
543 *
544 * @param $id
545 * @param $group_key
546 *
547 * @return void
548 */
549 function wpbc_shortcode_config_fields__aggregate( $id , $group_key ){
550
551 //--------------------------------------------------------------------------------------------------------------
552 // 'Upgrade to Pro' widget
553 //--------------------------------------------------------------------------------------------------------------
554 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
555 'id' => 'widget_wpbc_dismiss__booking_param_aggregate',
556 'dismiss_css_class' => '.wpbc_dismiss__booking_param_aggregate',
557 'blured_in_versions' => array( 'free' ),
558 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#booking-resources' ),
559 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
560 'versions' => 'paid versions',
561 'css' => 'transform: translate(0) translateY(180px);'
562 ) );
563 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
564 echo $upgrade_content_arr['content'];
565
566 //--------------------------------------------------------------------------------------------------------------
567 // Real Content
568 //--------------------------------------------------------------------------------------------------------------
569
570 $resources_list = array();
571 if ( class_exists( 'wpdev_bk_personal' ) ){
572 $resources_list_orig = wpbc_get_all_booking_resources_list();
573
574 $resources_list[0] = array( 'title' => __('None', 'booking' ), 'attr' => array ( 'class' => 'wpbc_single_resource', 'style' => 'border-bottom:1px dashed #ddd;') );
575 foreach ($resources_list_orig as $res_id => $res_val) {
576 $resources_list[$res_id] = $res_val;
577 }
578 }
579
580 ?>
581 <div class="clear"></div>
582 <div class="wpbc-settings-notice0 notice-info notice-header" style="font-size: 15px;font-weight: 600;margin: 15px 0 15px 15px;">
583 <label for="<?php echo esc_attr($id); ?>"><?php esc_html_e( 'Aggregate booking dates from other resources', 'booking' ); ?></label>
584 </div>
585
586 <div class="wpbc_shortcode_config__rules_container wpbc_dismiss__booking_param_aggregate <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
587 <div class="wpbc_shortcode_config__rules__params_section wpbc_aggregate">
588
589 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
590 <div class="ui_container ui_container_mini">
591 <div class="ui_group">
592 <div class="ui_element wpdevelop"><?php
593
594 WPBC_Settings_API::field_select_row_static( $id //. '__aggregate'
595 , array(
596 'type' => 'select'
597 , 'title' => __('Aggregate booking dates from other resources', 'booking')
598 , 'description' => ''//__( 'Select booking resources, for getting booking dates from them and set such dates as unavailable in destination calendar.', 'booking' )
599 , 'description_tag' => 'span'
600 , 'label' => ''
601 , 'multiple' => true
602 , 'group' => $group_key
603 , 'tr_class' => ''//$group_key . '_advanced_section'
604 , 'class' => 'wpbc_ui_control wpbc_ui_select'
605 , 'css' => 'margin-right:10px;height:20em;min-width:15em;'
606 , 'only_field' => true
607 , 'attr' => array()
608 , 'value' => '0'
609 , 'options' => $resources_list
610 )
611 );
612
613
614
615 ?></div>
616 </div>
617 </div>
618 </div>
619 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
620 <div class="ui_container ui_container_mini ui_container_weekdays">
621 <div class="ui_group ui_group_weekdays_checkboxes">
622 <div class="ui_element"><?php
623
624 WPBC_Settings_API::field_checkbox_row_static( $id . '__bookings_only'
625 , array(
626 'type' => 'checkbox'
627 , 'title' => ''
628 , 'description' => ''
629 , 'description_tag' => 'span'
630 , 'label' => __( 'Aggregate only bookings', 'booking' )
631 , 'class' => ''
632 , 'css' => ''
633 , 'tr_class' => ''
634 , 'attr' => array()
635 , 'group' => $group_key
636 , 'only_field' => true
637 , 'is_new_line' => false
638 , 'value' => false //// FixIn: 10.0.0.6.
639 )
640 );
641 ?></div>
642 </div>
643 </div>
644 </div>
645 </div>
646 <div class="wpbc_shortcode_config__rules__help_section" style="margin-top: 8px;">
647 <div class="wpbc-settings-notice notice-info notice-list">
648 <ol>
649 <li>
650 <?php esc_html_e( "Show dates as booked in the current calendar if such dates are unavailable in one of the selected resources.", 'booking' ); ?>
651 </li>
652 <li>
653 <?php
654 echo esc_html__( 'To set this up, select one or multiple booking resources in the multi-select box.', 'booking' )
655 . '<br>'
656 . esc_html__( 'Hold down the Ctrl button to make multiple selections.', 'booking' );
657
658 echo ' <strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
659 . '<code>[booking resource_id=1 aggregate=\'3;5;9\']</code>';
660 ?>
661
662 </li>
663
664 <li>
665 <?php
666 /* translators: 1: ... */
667 echo wp_kses_post( sprintf( __( 'Enable %1$sAggregate only bookings%2$s option to aggregate only bookings without including unavailable dates from the %3$s page.', 'booking' )
668 , '<strong>', '</strong>'
669 , '<strong>Booking > Availability > Days Availability</strong>'
670 ) );
671 ?>
672
673 <?php
674 echo ' <strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
675 , '<code>[booking resource_id=1 aggregate=\'3;5;9\' options=\'{aggregate type=bookings_only}\']</code>';
676
677 ?>
678 </li>
679 <li>
680 <?php
681 /* translators: 1: ... */
682 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
683 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
684 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-start-day-condition" target="_blank">', '</a></strong>' ) );
685 ?>
686 </li>
687 </ol>
688 </div>
689 </div>
690 </div><?php
691
692
693 }
694
695
696
697 // -----------------------------------------------------------------------------------------------------------------
698
699
700 function wpbc_shortcode_config_fields__dates_conditions_toolbar(){
701
702 ?><div class="clear"></div><?php
703 ?><div class="wpdevelop wpdvlp-nav-tabs-container wpbc_shortcode_config_fields__dates_conditions_toolbar"><?php
704
705 $js = "jQuery(this).parents( '.wpbc_shortcode_config_fields__dates_conditions_toolbar' ).find( '.nav-tab' ).removeClass('wpdevelop-submenu-tab-selected');
706 jQuery(this).addClass('wpdevelop-submenu-tab-selected');
707 jQuery('.nav-tab i.icon-white').removeClass('icon-white');
708 jQuery('.nav-tab-active i').addClass('icon-white');
709 jQuery(this).parents('.wpbc_sc_container__shortcode_section').find('.wpbc_sc_container__shortcode_subsection').hide();
710 jQuery(this).parents('.wpbc_sc_container__shortcode_section')";
711
712 wpbc_bs_toolbar_sub_html_container_start();
713
714 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpdevelop-submenu-tab-selected wpbc_dismiss__conditional_days"
715 onclick="javascript:<?php
716 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
717 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__weekdays_conditions').show();" href="javascript:void(0)"
718 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-week"></i>&nbsp;&nbsp;<?php
719 esc_html_e( 'Weekdays Conditions', 'booking' );
720 ?></span></a><?php
721
722 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
723 onclick="javascript:<?php
724 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
725 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__seasons_conditions').show();" href="javascript:void(0)"
726 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-month"></i>&nbsp;&nbsp;<?php
727 esc_html_e( 'Seasons Conditions', 'booking' );
728 ?></span></a><?php
729
730 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
731 onclick="javascript:<?php
732 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
733 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__startseason_conditions').show();" href="javascript:void(0)"
734 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-day"></i>&nbsp;&nbsp;<?php
735 esc_html_e( 'Start selection at Seasons', 'booking' );
736 ?></span></a><?php
737
738 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
739 onclick="javascript:<?php
740 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
741 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__dates_conditions').show();" href="javascript:void(0)"
742 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-date"></i>&nbsp;&nbsp;<?php
743 esc_html_e( 'Dates selection Conditions', 'booking' );
744 ?></span></a><?php
745
746 wpbc_bs_toolbar_sub_html_container_end();
747
748 ?>
749 </div><?php
750 }
751
752
753 /**
754 * Week Days - Condition fields for 'option' parameter.
755 *
756 * @param $id
757 * @param $group_key
758 *
759 * @return void
760 */
761 function wpbc_shortcode_config_fields__weekdays_conditions( $id , $group_key ){
762
763 //--------------------------------------------------------------------------------------------------------------
764 // 'Upgrade to Pro' widget
765 //--------------------------------------------------------------------------------------------------------------
766 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
767 'id' => $id . '_' . 'conditional_days_weekdays',
768 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
769 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
770 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
771 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
772 'versions' => 'Business Medium / Large, MultiUser versions',
773 'css' => 'transform: translate(0) translateY(120px);'
774 ) );
775 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
776 echo $upgrade_content_arr['content'];
777
778 //--------------------------------------------------------------------------------------------------------------
779 // Conditions for Weekdays selection
780 //--------------------------------------------------------------------------------------------------------------
781 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
782
783 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_day_weekday">
784
785 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
786 <div class="ui_container ui_container_mini ui_container_weekdays">
787 <?php
788
789 $week_days_arr = array(
790 1 => __( 'Mo', 'booking' )
791 , 2 => __( 'Tu', 'booking' )
792 , 3 => __( 'We', 'booking' )
793 , 4 => __( 'Th', 'booking' )
794 , 5 => __( 'Fr', 'booking' )
795 , 6 => __( 'Sa', 'booking' )
796 , 0 => __( 'Su', 'booking' )
797 );
798 foreach ( $week_days_arr as $weekday_key => $weekday_title ) {
799
800 ?><div class="ui_group ui_group_weekdays_checkboxes"><?php
801
802 ?><div class="ui_element"><?php
803
804 WPBC_Settings_API::field_checkbox_row_static( $id . '__weekday_' . $weekday_key
805 , array(
806 'type' => 'checkbox'
807 , 'title' => ''
808 , 'description' => ''
809 , 'description_tag' => 'span'
810 , 'label' => $weekday_title
811 , 'class' => ''
812 , 'css' => ''
813 , 'tr_class' => ''
814 , 'attr' => array()
815 , 'group' => $group_key
816 , 'only_field' => true
817 , 'is_new_line' => false
818 , 'value' => false
819 )
820 );
821
822 ?></div>
823 <div class="ui_element"><?php
824
825 $placeholder = '';
826 switch ( $weekday_key ) {
827 case 0: $placeholder = '1-7'; break;
828 case 1: $placeholder = '5,7'; break;
829 case 2: $placeholder = '3,4'; break;
830 case 3: $placeholder = '5'; break;
831 case 4: $placeholder = '4'; break;
832 case 5: $placeholder = '3'; break;
833 case 6: $placeholder = '2-7'; break;
834 }
835
836 WPBC_Settings_API::field_text_row_static( $id . '__days_number_' . $weekday_key
837 , array(
838 'type' => 'text'
839 , 'placeholder' => $placeholder
840 , 'class' => 'wpbc_dates_conditions_value_weekday'
841 , 'css' => ''
842 , 'only_field' => true
843 , 'attr' => array()
844 , 'value' => ''
845 )
846 );
847
848 ?></div>
849 <div class="ui_element"><?php
850 ?><div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days to select' ,'booking'); ?></div><?php
851 ?></div><?php
852
853 ?></div><?php
854 }
855
856 ?>
857 </div>
858 </div>
859
860 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
861 <div class="ui_container ui_container_mini">
862 <div class="ui_group"><?php
863
864 ?><div class="ui_element">
865 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_weekday__add('<?php echo esc_attr( $id ); ?>');" class="button button-primary"><?php esc_html_e( 'Set Rule', 'booking' ); ?></a>
866 </div><?php
867 ?><div class="ui_element">
868 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_weekday__reset('<?php echo esc_attr( $id ); ?>');"
869 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
870 </div><?php
871
872 ?>
873 </div>
874 </div>
875 </div>
876
877 </div>
878
879 <div class="wpbc_shortcode_config__rules__help_section">
880 <div class="wpbc-settings-notice notice-info notice-header">
881 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection on a specific weekday.', 'booking' ); ?></span>
882 </div>
883 <div class="wpbc-settings-notice notice-info notice-list">
884 <ol>
885 <li>
886 <?php esc_html_e( "For example, a visitor can choose to book only 5 or 7 days starting on Monday, or any number from 2 to 7 days starting on Saturday, and so forth. To configure this, check the 'Monday' box and set the number of days to select as '5,7'. Then, check the 'Saturday' box and set the number of days to select as '2-7'. Finally, click the 'Set Rule' button.", 'booking' ); ?>
887 </li>
888 <li>
889 <?php
890 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
891 . '<code>{select-day condition="weekday" for="1" value="5,7"},{select-day condition="weekday" for="6" value="2-7"}</code>';
892 ?>
893 </li>
894 <li>
895 <?php
896 /* translators: 1: ... */
897 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
898 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
899 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-condition" target="_blank">', '</a></strong>' ) );
900 ?>
901 </li>
902 <li>
903 <?php
904 /* translators: 1: ... */
905 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
906 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
907 ?>
908 </li>
909 </ol>
910 </div>
911 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin-top:15px;"></textarea>
912 </div>
913 </div><?php
914
915 }
916
917
918 /**
919 * Season Days Selection - Condition fields for 'option' parameter.
920 *
921 * @param $id
922 * @param $group_key
923 *
924 * @return void
925 */
926 function wpbc_shortcode_config_fields__season_conditions( $id, $group_key ) {
927
928 //--------------------------------------------------------------------------------------------------------------
929 // 'Upgrade to Pro' widget
930 //--------------------------------------------------------------------------------------------------------------
931 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
932 'id' => $id . '_' . 'conditional_days_seasons',
933 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
934 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
935 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
936 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
937 'versions' => 'Business Medium / Large, MultiUser versions',
938 'css' => 'transform: translate(0) translateY(120px);'
939 ) );
940 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
941 echo $upgrade_content_arr['content'];
942
943 //--------------------------------------------------------------------------------------------------------------
944 // Conditions for Seasons days selection
945 //--------------------------------------------------------------------------------------------------------------
946
947 $options = wpbc_shortcode_config_fields__get_options_for_seasons();
948
949 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
950 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_day_season">
951
952 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
953 <div class="ui_container ui_container_mini">
954 <div class="ui_group">
955
956 <div class="ui_element">
957 <div class="wpbc_ui_control" style="line-height: 2;">
958 <span><?php esc_html_e('In season' ,'booking'); ?></span>
959 </div>
960 </div>
961
962 <div class="ui_element wpdevelop"><?php
963 WPBC_Settings_API::field_select_row_static( $id . '__season_filter_name'
964 , array(
965 'type' => 'select'
966 , 'title' => ''
967 , 'label' => ''
968 , 'disabled' => false
969 , 'disabled_options' => array()
970 , 'multiple' => false
971 , 'description' => ''
972 , 'description_tag' => 'span'
973 , 'group' => $group_key
974 , 'tr_class' => ''
975 , 'class' => 'wpbc_ui_control wpbc_ui_select'
976 , 'css' => 'max-width: Min(14em, 100%);flex: 0 1 auto;width: 14em;border-radius:3px 0 0 3px;'
977 , 'only_field' => true
978 , 'attr' => array()
979 , 'value' => '0'
980 , 'options' => $options
981 )
982 );
983 ?><a href="<?php echo esc_url( wpbc_get_availability_url() . '' ); ?>"
984 title="<?php echo esc_attr( __( 'Add new season', 'booking' ) ); ?>"
985 class="wpbc_ui_control wpbc_ui_button tooltip_top" ><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a><?php
986 ?></div>
987
988 </div>
989 </div>
990
991 <div class="ui_container ui_container_mini">
992 <div class="ui_group">
993
994 <div class="ui_element">
995 <div class="wpbc_ui_control " style="line-height: 2;"><?php esc_html_e('allow to select' ,'booking'); ?></div>
996 </div>
997
998 <div class="ui_element"><?php
999 WPBC_Settings_API::field_text_row_static( $id . '__days_number'
1000 , array(
1001 'type' => 'text'
1002 , 'placeholder' => '5 ' . __( 'or', 'booking' ) . ' 1-7 ' . __( 'or', 'booking' ) . ' 1,5,7'
1003 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1004 , 'css' => 'width:9em;border-radius:3px;'
1005 , 'only_field' => true
1006 , 'attr' => array()
1007 , 'value' => ''
1008 )
1009 );
1010 ?></div>
1011
1012 <div class="ui_element">
1013 <div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days' ,'booking'); ?></div>
1014 </div>
1015 </div>
1016 </div>
1017
1018 <div class="ui_container ui_container_mini">
1019 <div class="ui_group">
1020
1021 <div class="ui_element">
1022 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_season__add('<?php echo esc_attr( $id ); ?>');"
1023 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1024 </div>
1025 <div class="ui_element">
1026 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_season__reset('<?php echo esc_attr( $id ); ?>');"
1027 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1028 </div>
1029 </div>
1030 </div>
1031
1032 </div>
1033 </div>
1034 <div class="wpbc_shortcode_config__rules__help_section">
1035 <div class="wpbc-settings-notice notice-info notice-header">
1036 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection in a specific season.', 'booking' ); ?></span>
1037 </div>
1038 <div class="wpbc-settings-notice notice-info notice-list">
1039 <ol>
1040 <li>
1041 <?php esc_html_e( "For example, a visitor can choose to book any number from 7 to 14 days or 21 days starting on 'High season', or any number from 2 to 5 days starting on 'Low season', and so forth. To configure this, select the 'High season' option in the dropdown menu and set the number of days to select as '7-14,21'. Click the 'Add Rule' button. Next, select the 'Low season' option in the dropdown menu and set the number of days to select as '2-5'. Click the 'Add Rule' button again.", 'booking' ); ?>
1042 </li>
1043 <li>
1044 <?php
1045 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1046 . '<code>{select-day condition="season" for="High season" value="7-14,21"},{select-day condition="season" for="Low season" value="2-5"}</code>';
1047 ?>
1048 </li>
1049 <li>
1050 <?php
1051 /* translators: 1: ... */
1052 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1053 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1054 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-condition-seasons" target="_blank">', '</a></strong>' ) );
1055 ?>
1056 </li>
1057 <li>
1058 <?php
1059 /* translators: 1: ... */
1060 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1061 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1062 ?>
1063 </li>
1064 </ol>
1065 </div>
1066 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1067 </div>
1068 </div><?php
1069
1070 }
1071
1072
1073 /**
1074 * Get Season Filters options - for selectbox in PopUp shortcode config
1075 *
1076 * @return array|array[]
1077 */
1078 function wpbc_shortcode_config_fields__get_options_for_seasons(){
1079
1080 if (function_exists('wpbc_sf_cache')) {
1081 // -----------------------------------------------------------------------------------------------------------------
1082 // Get Season Filters data:
1083 // -----------------------------------------------------------------------------------------------------------------
1084 $wpbc_sf_cache = wpbc_sf_cache();
1085 /**
1086 * $wpbc_sf_cache->get_data() = [
1087 * 1 => [
1088 * booking_filter_id = "1"
1089 * title = "Weekend"
1090 * filter = "a:4:{s:8:"weekdays";a:7..."
1091 * users = "1"
1092 * id = "1"
1093 */
1094 $season_filter_arr = $wpbc_sf_cache->get_data();
1095 } else {
1096 $season_filter_arr = array();
1097 }
1098 // $wpbc_br_cache = wpbc_br_cache();
1099 /*
1100 $wpbc_br_cache->get_resources() = [
1101 1 = [
1102 booking_type_id = "1"
1103 title = "Standard"
1104 users = "1"
1105 import = null
1106 export = "/ics/wpbm.ics"
1107 cost = "25"
1108 default_form = "standard"
1109 prioritet = "1"
1110 parent = "0"
1111 visitors = "2"
1112 id = "1"
1113 count = {int} 5
1114 7 = [...
1115 */
1116 $current_user_id = wpbc_get_current_user_id();
1117
1118 $options = array(
1119 0 => array(
1120 'title' => ' - ' . __( 'Please Select', 'booking' ) . ' - ',
1121 'attr' => array( 'style' => 'color:#999;font-weight: 400;' )
1122 )
1123 );
1124 foreach ( $season_filter_arr as $filter_id => $filter_arr ) {
1125
1126 $options[ $filter_arr['id'] ] = $filter_arr;
1127
1128 // MultiUser functionality for regular users showing season filters.
1129 if ( ( class_exists( 'wpdev_bk_multiuser' ) ) && ( ! empty( $filter_arr['users'] ) ) ) {
1130
1131 // Is current user suer booking admin and if this user was simulated log in
1132 $season_user_id = intval( $filter_arr['users'] );
1133 $is_user_super_admin = apply_bk_filter( 'is_user_super_admin', $season_user_id );
1134
1135 if ( ( ! $is_user_super_admin ) && ( $current_user_id != $season_user_id ) ) {
1136 $options[ $filter_arr['id'] ]['attr'] = array( 'style' => 'color:#a43232;font-weight: 400;font-style: italic;' );
1137 $user_name = get_userdata( $season_user_id );
1138 $user_name = $user_name->display_name;
1139 $options[ $filter_arr['id'] ]['title'] .= ' &nbsp; (' . __( 'Regular User', 'booking' ) . ': ' . $user_name . ')';
1140 }
1141 }
1142 }
1143
1144 return $options;
1145
1146 }
1147
1148
1149 /**
1150 * Season Days Start Day - Condition fields for 'option' parameter.
1151 *
1152 * @param $id
1153 * @param $group_key
1154 *
1155 * @return void
1156 */
1157 function wpbc_shortcode_config_fields__season_start_day_conditions( $id, $group_key ) {
1158
1159 //--------------------------------------------------------------------------------------------------------------
1160 // 'Upgrade to Pro' widget
1161 //--------------------------------------------------------------------------------------------------------------
1162 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1163 'id' => $id . '_' . 'conditional_days_startday',
1164 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1165 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1166 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1167 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1168 'versions' => 'Business Medium / Large, MultiUser versions',
1169 'css' => 'transform: translate(0) translateY(120px);'
1170 ) );
1171 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1172 echo $upgrade_content_arr['content'];
1173
1174 //--------------------------------------------------------------------------------------------------------------
1175 // Conditions for Seasons days START selection
1176 //--------------------------------------------------------------------------------------------------------------
1177
1178 $options = wpbc_shortcode_config_fields__get_options_for_seasons();
1179
1180 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1181 <div class="wpbc_shortcode_config__rules__params_section wpbc_start_day_season">
1182
1183 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1184 <div class="ui_container ui_container_mini">
1185 <div class="ui_group">
1186 <div class="ui_element">
1187 <div class="wpbc_ui_control" style="line-height: 2;">
1188 <span><?php esc_html_e('In season' ,'booking'); ?></span>
1189 </div>
1190 </div>
1191 <div class="ui_element wpdevelop"><?php
1192
1193 WPBC_Settings_API::field_select_row_static( $id . '__season_filter_name'
1194 , array(
1195 'type' => 'select'
1196 , 'title' => ''
1197 , 'label' => ''
1198 , 'disabled' => false
1199 , 'disabled_options' => array()
1200 , 'multiple' => false
1201 , 'description' => ''
1202 , 'description_tag' => 'span'
1203 , 'group' => $group_key
1204 , 'tr_class' => ''
1205 , 'class' => 'wpbc_ui_control wpbc_ui_select'
1206 , 'css' => 'max-width: Min(14em, 100%);flex: 0 1 auto;width: 14em;border-radius:3px 0 0 3px;'
1207 , 'only_field' => true
1208 , 'attr' => array()
1209 , 'value' => '0'
1210 , 'options' => $options
1211 )
1212 );
1213
1214 ?><a href="<?php echo esc_url( wpbc_get_availability_url() . '' ); ?>"
1215 title="<?php echo esc_attr( __( 'Add new season', 'booking' ) ); ?>"
1216 class="wpbc_ui_control wpbc_ui_button tooltip_top" ><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a><?php
1217
1218 ?></div>
1219 </div>
1220 </div>
1221 </div>
1222 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1223 <div class="ui_container ui_container_mini ui_container_weekdays">
1224 <div class="ui_group">
1225 <div class="ui_element">
1226 <div class="wpbc_ui_control " style="line-height: 2;"><?php
1227 esc_html_e('allow to start days selection only for these weekdays' ,'booking');
1228 ?></div>
1229 </div>
1230 </div>
1231 <div class="ui_group ui_group_weekdays_checkboxes"><?php
1232
1233 $week_days_arr = array(
1234 1 => __( 'Mo', 'booking' )
1235 , 2 => __( 'Tu', 'booking' )
1236 , 3 => __( 'We', 'booking' )
1237 , 4 => __( 'Th', 'booking' )
1238 , 5 => __( 'Fr', 'booking' )
1239 , 6 => __( 'Sa', 'booking' )
1240 , 0 => __( 'Su', 'booking' )
1241 );
1242 foreach ( $week_days_arr as $weekday_key => $weekday_title ) {
1243
1244 ?><div class="ui_element"><?php
1245
1246 WPBC_Settings_API::field_checkbox_row_static( $id . '__weekday_' . $weekday_key
1247 , array(
1248 'type' => 'checkbox'
1249 , 'title' => ''
1250 , 'description' => ''
1251 , 'description_tag' => 'span'
1252 , 'label' => $weekday_title
1253 , 'class' => ''
1254 , 'css' => ''
1255 , 'tr_class' => ''
1256 , 'attr' => array()
1257 , 'group' => $group_key
1258 , 'only_field' => true
1259 , 'is_new_line' => false
1260 , 'value' => false
1261 )
1262 );
1263 ?></div><?php
1264
1265 }
1266
1267 ?></div>
1268 </div>
1269 </div>
1270 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1271 <div class="ui_container ui_container_mini">
1272 <div class="ui_group"><?php
1273
1274 ?><div class="ui_element">
1275 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__start_day_season__add('<?php echo esc_attr( $id ); ?>');"
1276 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1277 </div><?php
1278 ?><div class="ui_element">
1279 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__start_day_season__reset('<?php echo esc_attr( $id ); ?>');"
1280 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1281 </div><?php
1282
1283 ?>
1284 </div>
1285 </div>
1286 </div>
1287 </div>
1288 <div class="wpbc_shortcode_config__rules__help_section">
1289 <div class="wpbc-settings-notice notice-info notice-header">
1290 <span><?php esc_html_e( 'Specify the weekdays as start days for selection when starting the selection in a specific season.', 'booking' ); ?></span>
1291 </div>
1292 <div class="wpbc-settings-notice notice-info notice-list">
1293 <ol>
1294 <li>
1295 <?php esc_html_e( "For example, a visitor can starting days selection only on 'Sunday' or 'Friday' if select days on 'Low season'. To configure this, select the 'Low season' option in the dropdown menu and enable 'Sunday' and 'Friday' boxes. Click the 'Add Rule' button.", 'booking' ); ?>
1296 </li>
1297 <li>
1298 <?php
1299 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1300 . '<code>{start-day condition="season" for="Low season" value="0,5"}</code>';
1301 ?>
1302 </li>
1303 <li>
1304 <?php
1305 /* translators: 1: ... */
1306 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1307 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1308 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-start-day-condition" target="_blank">', '</a></strong>' ) );
1309 ?>
1310 </li>
1311 <li>
1312 <?php
1313 /* translators: 1: ... */
1314 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1315 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1316 ?>
1317 </li>
1318 </ol>
1319 </div>
1320 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1321 </div>
1322 </div><?php
1323
1324 }
1325
1326
1327
1328 /**
1329 * Dates Condition - Set Number of Days to Select, if start selection on specific date '2024-02-14'
1330 *
1331 * Config dialog for Booking Calendar shortcode
1332 *
1333 * @param $id
1334 * @param $group_key
1335 *
1336 * @return void
1337 */
1338 function wpbc_shortcode_config_fields__fordate_conditions( $id, $group_key ) {
1339
1340 //--------------------------------------------------------------------------------------------------------------
1341 // 'Upgrade to Pro' widget
1342 //--------------------------------------------------------------------------------------------------------------
1343 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1344 'id' => $id . '_' . 'conditional_days_fordate',
1345 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1346 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1347 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1348 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1349 'versions' => 'Business Medium / Large, MultiUser versions',
1350 'css' => 'transform: translate(0) translateY(120px);'
1351 ) );
1352 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1353 echo $upgrade_content_arr['content'];
1354
1355 //--------------------------------------------------------------------------------------------------------------
1356 // Conditions for DATE selection
1357 //--------------------------------------------------------------------------------------------------------------
1358
1359 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1360 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_fordate">
1361
1362 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1363 <div class="ui_container ui_container_mini">
1364 <div class="ui_group">
1365
1366 <div class="ui_element">
1367 <div class="wpbc_ui_control" style="line-height: 2;">
1368 <span><?php esc_html_e('For date' ,'booking'); ?></span>
1369 </div>
1370 </div>
1371
1372 <div class="ui_element wpdevelop"><?php
1373 WPBC_Settings_API::field_text_row_static( $id . '__date'
1374 , array(
1375 'type' => 'text'
1376 , 'placeholder' => '2024-02-14'
1377 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1378 , 'css' => 'width:9em;border-radius:3px;'
1379 , 'only_field' => true
1380 , 'attr' => array()
1381 , 'value' => ''
1382 )
1383 );
1384 ?></div>
1385
1386 </div>
1387 </div>
1388
1389 <div class="ui_container ui_container_mini">
1390 <div class="ui_group">
1391
1392 <div class="ui_element">
1393 <div class="wpbc_ui_control " style="line-height: 2;"><?php esc_html_e('allow to select' ,'booking'); ?></div>
1394 </div>
1395
1396 <div class="ui_element"><?php
1397 WPBC_Settings_API::field_text_row_static( $id . '__days_number'
1398 , array(
1399 'type' => 'text'
1400 , 'placeholder' => '5 ' . __( 'or', 'booking' ) . ' 1-7 ' . __( 'or', 'booking' ) . ' 1,5,7'
1401 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1402 , 'css' => 'width:9em;border-radius:3px;'
1403 , 'only_field' => true
1404 , 'attr' => array()
1405 , 'value' => ''
1406 )
1407 );
1408 ?></div>
1409
1410 <div class="ui_element">
1411 <div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days' ,'booking'); ?></div>
1412 </div>
1413 </div>
1414 </div>
1415
1416 <div class="ui_container ui_container_mini">
1417 <div class="ui_group">
1418
1419 <div class="ui_element">
1420 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_fordate__add('<?php echo esc_attr( $id ); ?>');"
1421 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1422 </div>
1423 <div class="ui_element">
1424 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_fordate__reset('<?php echo esc_attr( $id ); ?>');"
1425 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1426 </div>
1427 </div>
1428 </div>
1429
1430 </div>
1431 </div>
1432 <div class="wpbc_shortcode_config__rules__help_section">
1433 <div class="wpbc-settings-notice notice-info notice-header">
1434 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection on a specific date.', 'booking' ); ?></span>
1435 </div>
1436 <div class="wpbc-settings-notice notice-info notice-list">
1437 <ol>
1438 <li>
1439 <?php esc_html_e( "For example, a visitor can choose to book 7 or 14 days or 21 days starting on '2027-02-15'. To configure this, enter date in format 'YYYY-MM-DD' such as '2027-02-15' and set the number of days to select as '7,14,21'. Click the 'Add Rule' button.", 'booking' ); ?>
1440 </li>
1441 <li>
1442 <?php
1443 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1444 . '<code>{select-day condition="date" for="2027-02-15" value="7,14,21"}</code>';
1445 ?>
1446 </li>
1447 <li>
1448 <?php
1449 /* translators: 1: ... */
1450 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1451 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1452 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#aggregate" target="_blank">', '</a></strong>' ) );
1453 ?>
1454 </li>
1455 <li>
1456 <?php
1457 /* translators: 1: ... */
1458 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1459 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1460 ?>
1461 </li>
1462 </ol>
1463 </div>
1464 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1465 </div>
1466 </div><?php
1467
1468 }
1469
1470