PluginProbe
Booking Calendar / 10.1.3
Booking Calendar v10.1.3
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 10.11.2 All 203 releases
booking / core / admin / wpbc-toolbars.php

wpbc-toolbars.php in Booking Calendar 10.1.3, at core/admin/wpbc-toolbars.php

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