PluginProbe
Booking Calendar / 11.8.3
Booking Calendar v11.8.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
← All changes | includes/page-availability/availability__page.php +69 -34 10.1011.8.3 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /*
3 3 * @package: AJX_Bookings Page
4 4 * @category: o Email Reminders
@@ -20,40 +20,42 @@
20 20 */
21 21 class WPBC_Page_AJX_Availability extends WPBC_Page_Structure {
22 22
23 23
24 - public function __construct() {
24 + public function __construct() {
25 25
26 - parent::__construct();
26 + parent::__construct();
27 27
28 28 add_action( 'wpbc_toolbar_top_tabs_insert', array( $this, 'wpbc_toolbar_toolbar_tabs' ) );
29 - }
29 + }
30 30
31 31
32 - public function in_page() {
33 - return 'wpbc-availability';
34 - }
32 + public function in_page() {
33 + return 'wpbc-availability';
34 + }
35 35
36 36
37 37 public function tabs() {
38 -
39 - $tabs = array();
40 - $tabs[ 'availability' ] = array(
41 - 'title' => __( 'Days Availability', 'booking' ) // Title of TAB //FixIn: 9.8.15.2.2
42 - , 'hint' => __( 'Define available and unavailable days for calendar(s)', 'booking' ) // Hint
43 - , 'page_title' => __( 'Calendar Availability', 'booking' ) // Title of Page
44 - , 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link
45 - , 'position' => '' // 'left' || 'right' || ''
46 - , 'css_classes' => '' // CSS class(es)
47 - , 'icon' => '' // Icon - link to the real PNG img
48 - , 'font_icon' => 'wpbc-bi-calendar2-check'//'wpbc_icn_free_cancellation' // CSS definition of forn Icon
49 - , 'default' => true // Is this tab activated by default or not: true || false.
50 - , 'disabled' => false // Is this tab disbaled: true || false.
51 - , 'hided' => false // Is this tab hided: true || false.
52 - , 'subtabs' => array()
53 - );
54 - // $subtabs = array();
55 - // $tabs[ 'items' ][ 'subtabs' ] = $subtabs;
38 + $tabs = array();
39 + $tabs['availability'] = array(
40 + 'is_show_top_path' => true, // true | false. By default value is: true.
41 + 'left_navigation__default_view_mode' => '', // FixIn:11.7.1.1: 'compact', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''.
42 + 'title' => __( 'Block Dates', 'booking' ), // Title of TAB //FixIn: 9.8.15.2.2.
43 + 'hint' => __( 'Define available and unavailable days for your calendar(s).', 'booking' ), // Hint.
44 + 'page_title' => __( 'Block Dates', 'booking' ), // Title of Page.
45 + 'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link.
46 + 'position' => '', // 'left' / 'right' / ''.
47 + 'css_classes' => '', // CSS c l a s s(es).
48 + 'icon' => '', // Icon - link to the real PNG img.
49 + 'font_icon' => 'wpbc-bi-calendar2-check', // 'wpbc_icn_free_cancellation' // CSS definition of forn Icon.
50 + 'font_icon_right' => 'wpbc-bi-question-circle',
51 + 'default' => true, // Is this tab activated by default or not: true || false.
52 + 'disabled' => false, // Is this tab disbaled: true || false.
53 + 'hided' => false, // Is this tab hided: true || false.
54 + 'subtabs' => array(),
55 + 'folder_style' => 'order:91;',
56 + 'is_show_top_navigation' => true,
57 + );
56 58 return $tabs;
57 59 }
58 60
59 61
@@ -163,9 +165,18 @@
163 165 $request_prefix = false;
164 166 $escaped_request_params_arr = $user_request->get_sanitized__in_request__value_or_default( $request_prefix ); // Direct: $_REQUEST['resource_id']
165 167 }
166 168
169 + // Direct links from other admin tools can intentionally open availability for a specific resource.
170 + // In that case this URL value must override previously saved user toolbar state.
171 + if ( false !== wpbc_get_direct_value_in_request( 'resource_id', false ) ) {
172 + $direct_request_params_arr = $user_request->get_sanitized__in_request__value_or_default( false );
173 + if ( ! empty( $direct_request_params_arr['resource_id'] ) ) {
174 + $escaped_request_params_arr['resource_id'] = $direct_request_params_arr['resource_id'];
175 + }
176 + }
167 177
178 +
168 179 //MU
169 180 if ( class_exists( 'wpdev_bk_multiuser' ) ) {
170 181
171 182 // Check if this MU user activated or superadmin, otherwise show warning
@@ -211,8 +222,9 @@
211 222 ?><span class="wpdevelop"><?php // BS UI CSS Class
212 223
213 224 wpbc_js_for_bookings_page(); // JavaScript functions
214 225
226 + $this->wpbc_toolbar_toolbar_tabs( $this->in_page() );
215 227 wpbc_ajx_availability__toolbar( $escaped_request_params_arr );
216 228
217 229 ?></span><?php
218 230
@@ -248,9 +260,9 @@
248 260 private function ajx_availability_container__show( $escaped_request_params_arr ) {
249 261
250 262 ?>
251 263 <div id="ajx_nonce_calendar_section"></div>
252 - <div class="wpbc_listing_container wpbc_selectable_table wpbc_ajx_availability_container wpdevelop" wpbc_loaded="first_time">
264 + <div class="wpbc_ajx_availability_container wpbc_selectable_table wpdevelop" wpbc_loaded="first_time">
253 265 <style type="text/css">
254 266 .wpbc_calendar_loading .wpbc_icn_autorenew::before{
255 267 font-size: 1.2em;
256 268 }
@@ -281,12 +293,13 @@
281 293 } );
282 294 </script>
283 295 <?php
284 296 // FixIn: 10.0.0.5.
297 +/*
285 298 if ( 0 ) {
286 299 $resource_id = 220;
287 - // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
288 - ?><style type="text/css" rel="stylesheet"> .hasDatepick .datepick-inline .datepick-title-row th, .hasDatepick .datepick-inline .datepick-days-cell { height: 50px; } </style><?php
300 + // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet // FixIn: 10.12.4.2.
301 + ?><style type="text/css" rel="stylesheet"> .hasDatepick .datepick-inline .datepick-title-row th, .hasDatepick .datepick-inline .datepick-days-cell { max-height: 50px; } </style><?php
289 302
290 303 ?>
291 304 <div class="wpbc_calendar_wraper wpbc_change_over_triangle">
292 305 <div class="bk_calendar_frame months_num_in_row_4 cal_month_num_4" style="width:100%;max-width:100%;">
@@ -327,11 +340,11 @@
327 340 _wpbc.calendar__set_param_value( 220, 'dynamic__days_specific', [] );
328 341 _wpbc.calendar__set_param_value( 220, 'dynamic__week_days__start', [-1] );
329 342 _wpbc.calendar__set_param_value( 220, 'booking_date_format', 'j M Y' );
330 343 _wpbc.calendar__set_param_value( 220, 'booking_time_format', 'g:i A' );
331 - _wpbc.set_message( 'message_dates_times_unavailable', 'These dates and times in this calendar are already booked or unavailable.' );
332 - _wpbc.set_message( 'message_choose_alternative_dates', 'Please choose alternative date(s), times, or adjust the number of slots booked.' );
333 - _wpbc.set_message( 'message_cannot_save_in_one_resource', 'It is not possible to store this sequence of the dates into the one same resource.' );
344 + _wpbc.set_message( 'message_dates_times_unavailable', <?php echo wp_json_encode( wpbc_frontend_messages__get( 'message_dates_times_unavailable' ) ); ?> );
345 + _wpbc.set_message( 'message_choose_alternative_dates', <?php echo wp_json_encode( wpbc_frontend_messages__get( 'message_choose_alternative_dates' ) ); ?> );
346 + _wpbc.set_message( 'message_cannot_save_in_one_resource', <?php echo wp_json_encode( wpbc_frontend_messages__get( 'message_cannot_save_in_one_resource' ) ); ?> );
334 347 _wpbc.calendar__set_param_value( 220, 'is_parent_resource', 0 );
335 348 _wpbc.calendar__set_param_value( 220, 'booking_capacity_field', 'visitors' );
336 349 _wpbc.calendar__set_param_value( 220, 'booking_is_dissbale_booking_for_different_sub_resources', 'Off' );
337 350 _wpbc.calendar__set_param_value( 220, 'booking_recurrent_time', 'Off' );
@@ -361,10 +374,10 @@
361 374 </script>
362 375 <?php
363 376 }
364 377 }
378 +*/
365 379
366 -
367 380 }
368 381
369 382 /**
370 383 * Hide first "Availability tab", because we have only one tab hhere, and need to show only tabs for toolbar
@@ -394,8 +407,12 @@
394 407
395 408
396 409 public function in_page() {
397 410
411 + if ( class_exists( 'WPBC_Page_Availability_General_Dedicated' ) ) {
412 + return (string) wp_rand( 100000, 1000000 );
413 + }
414 +
398 415 if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { // If this User not "super admin", then do not load this page at all
399 416 return (string) wp_rand( 100000, 1000000 ); // If this User not "super admin", then do not load this page at all
400 417 }
401 418
@@ -405,22 +422,40 @@
405 422
406 423
407 424 public function tabs() {
408 425
426 +
427 + $separator_i = 0;
428 + $subtab_default = array(
429 + 'type' => 'subtab', // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'.
430 + 'title' => '', // Example: __( 'Dashboard' // Title of TAB.
431 + 'page_title' => '', // __( 'Search Availability' // Title of Page.
432 + 'hint' => '', // __( 'Configure the layout and functionality of both the search form and search results.' // Hint.
433 + 'link' => '', // wpbc_get_settings_url() . '&scroll_to_section=wpbc_general_settings_dashboard_tab', // Link.
434 + 'css_classes' => '', // cls CSS .
435 + 'font_icon' => 'wpbc_icn_dashboard',
436 + 'font_icon_right' => 'wpbc-bi-question-circle', // 'wpbc-bi-question-circle' .
437 + 'default' => false, // Is this sub tab activated by default or not: true || false.
438 + );
439 +
409 440 $tabs = array();
441 + // FixIn: 10.12.4.7. $tabs[ 'general_availability' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:200;' ) );
410 442 $tabs[ 'general_availability' ] = array(
411 - 'title' => __( 'General Availability', 'booking' ) // Title of TAB //FixIn: 9.8.15.2.2
443 + 'title' => __( 'Schedule & Rules', 'booking' ) // Title of TAB //FixIn: 9.8.15.2.2
412 444 , 'hint' => __( 'Define unavailable weekdays for all calendar(s) and unavailable dates depend from today date', 'booking' ) // Hint
413 - , 'page_title' => __( 'General Availability', 'booking' ) // Title of Page
414 - , 'link' => wpbc_get_settings_url( true, false ) . '&scroll_to_section=wpbc_general_settings_availability_tab' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link
445 + , 'page_title' => __( 'Schedule & Rules', 'booking' ) // Title of Page
446 + , 'link' => function_exists( 'wpbc_get_general_availability_url' ) ? wpbc_get_general_availability_url( true, false ) : admin_url( 'admin.php?page=wpbc-availability&tab=general_availability' ) // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link
415 447 , 'position' => '' // 'left' || 'right' || ''
416 448 , 'css_classes' => 'wpbc_top_tab__general_availability' // CSS class(es)
417 449 , 'icon' => '' // Icon - link to the real PNG img
418 450 , 'font_icon' => 'wpbc-bi-calendar2-day 0wpbc-bi-calendar2-check'//'wpbc_icn_free_cancellation' // CSS definition of forn Icon
451 + , 'font_icon_right' => 'wpbc-bi-question-circle'
419 452 , 'default' => false // Is this tab activated by default or not: true || false.
420 453 , 'disabled' => false // Is this tab disbaled: true || false.
421 454 , 'hided' => false // Is this tab hided: true || false.
422 455 , 'subtabs' => array()
456 + // , 'folder_style' => 'order:200;',
457 + , 'folder_style' => 'order:93;',
423 458 );
424 459 // $subtabs = array();
425 460 // $tabs[ 'items' ][ 'subtabs' ] = $subtabs;
426 461 return $tabs;