false, // true | false. By default value is: false. 'left_navigation__default_view_mode' => 'compact', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. 'title' => __( 'Days Availability', 'booking' ), // Title of TAB //FixIn: 9.8.15.2.2. 'hint' => __( 'Define available and unavailable days for your calendar(s).', 'booking' ), // Hint. 'page_title' => __( 'Days Availability', 'booking' ), // Title of Page. 'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link. 'position' => '', // 'left' / 'right' / ''. 'css_classes' => '', // CSS c l a s s(es). 'icon' => '', // Icon - link to the real PNG img. 'font_icon' => 'wpbc-bi-calendar2-check', // 'wpbc_icn_free_cancellation' // CSS definition of forn Icon. 'font_icon_right' => 'wpbc-bi-question-circle', 'default' => true, // Is this tab activated by default or not: true || false. 'disabled' => false, // Is this tab disbaled: true || false. 'hided' => false, // Is this tab hided: true || false. 'subtabs' => array(), 'folder_style' => 'order:91;', ); return $tabs; } /** * Show custom tabs for Toolbar at . - . R i g h t . s i d e. * * @param string $menu_in_page_tag - active page */ public function wpbc_toolbar_toolbar_tabs( $menu_in_page_tag ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( ( $this->in_page() === $menu_in_page_tag ) && ( ( empty( $_GET['tab'] ) ) || ( 'availability' === $_GET['tab'] ) ) ) { // FixIn: 9.8.15.2.2. wpbc_bs_toolbar_tabs_html_container_start(); $escaped_search_request_params = $this->get_cleaned_params__saved_requestvalue_default(); // Check if by some reason, user was saved request without this parameter, then get default value. if ( ! empty( $escaped_search_request_params['ui_usr__availability_selected_toolbar'] ) ) { $selected_tab = $escaped_search_request_params['ui_usr__availability_selected_toolbar']; } else { $default_search_request_params = WPBC_AJX__Availability::request_rules_structure(); $selected_tab = $default_search_request_params ['ui_usr__availability_selected_toolbar']['default']; } wpbc_bs_display_tab( array( 'title' => __( 'Set Availability', 'booking' ) , 'hint' => array( 'title' => __('Availability' ,'booking') , 'position' => 'top' ) , 'onclick' => "jQuery('.ui_container_toolbar').hide();" . "jQuery('.ui_container_info').show();" . "jQuery('.wpbc_availability_support_tabs').removeClass('nav-tab-active');" . "jQuery(this).addClass('nav-tab-active');" . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" . "jQuery('.nav-tab-active i').addClass('icon-white');" /** * It will save such changes, and if we have selected bookings, then deselect them */ // . "wpbc_ajx_booking_send_search_request_with_params( { 'ui_usr__availability_selected_toolbar': 'filters' });" /** * It will save changes with NEXT search request, but not immediately * it is handy, in case if we have selected bookings, * we will not lose selection. */ . "wpbc_ajx_availability.search_set_param( 'ui_usr__availability_selected_toolbar', 'info' );" , 'font_icon' => 'wpbc-bi-calendar2-check' //'wpbc_icn_info_outline' , 'default' => ( 'info' == $selected_tab ) ? true : false //, 'position' => 'right' , 'css_classes' => 'wpbc_availability_support_tabs' ) ); wpbc_bs_display_tab( array( 'title' => __('Options', 'booking') , 'hint' => array( 'title' => __('User Options' ,'booking') , 'position' => 'top' ) , 'onclick' => "jQuery('.ui_container_toolbar').hide();" . "jQuery('.ui_container_options').show();" . "jQuery('.wpbc_availability_support_tabs').removeClass('nav-tab-active');" . "jQuery(this).addClass('nav-tab-active');" . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" . "jQuery('.nav-tab-active i').addClass('icon-white');" /** * It will save such changes, and if we have selected bookings, then deselect them */ // . "wpbc_ajx_booking_send_search_request_with_params( { 'ui_usr__availability_selected_toolbar': 'options' });" /** * It will save changes with NEXT search request, but not immediately * it is handy, in case if we have selected bookings, * we will not lose selection. */ . "wpbc_ajx_availability.search_set_param( 'ui_usr__availability_selected_toolbar', 'calendar_settings' );" , 'font_icon' => 'wpbc_icn_tune' , 'default' => ( 'calendar_settings' == $selected_tab ) ? true : false //, 'position' => 'right' , 'css_classes' => 'wpbc_availability_support_tabs' ) ); wpbc_bs_toolbar_tabs_html_container_end(); } } /** * Get sanitised request parameters. :: Firstly check if user saved it. :: Otherwise, check $_REQUEST. :: Otherwise get default. * * @return array|false */ public function get_cleaned_params__saved_requestvalue_default(){ $user_request = new WPBC_AJX__REQUEST( array( 'db_option_name' => 'booking_availability_request_params', 'user_id' => wpbc_get_current_user_id(), 'request_rules_structure' => WPBC_AJX__Availability::request_rules_structure() ) ); $escaped_request_params_arr = $user_request->get_sanitized__saved__user_request_params(); // Get Saved //Fix Calendar cell heights in versions older than // FixIn: 9.7.3.2. if ( ( false !== $escaped_request_params_arr ) && ( '' === $escaped_request_params_arr['calendar__view__cell_height'] ) ) { $user_request->user_request_params__db_delete(); // Delete from DB. } if ( false === $escaped_request_params_arr ) { // This request was not saved before, then get sanitized direct parameters, like: $_REQUEST['resource_id'] $request_prefix = false; $escaped_request_params_arr = $user_request->get_sanitized__in_request__value_or_default( $request_prefix ); // Direct: $_REQUEST['resource_id'] } // Direct links from other admin tools can intentionally open availability for a specific resource. // In that case this URL value must override previously saved user toolbar state. if ( false !== wpbc_get_direct_value_in_request( 'resource_id', false ) ) { $direct_request_params_arr = $user_request->get_sanitized__in_request__value_or_default( false ); if ( ! empty( $direct_request_params_arr['resource_id'] ) ) { $escaped_request_params_arr['resource_id'] = $direct_request_params_arr['resource_id']; } } //MU if ( class_exists( 'wpdev_bk_multiuser' ) ) { // Check if this MU user activated or superadmin, otherwise show warning if ( ! wpbc_is_mu_user_can_be_here('activated_user') ) return false; // Check if this MU user owner of this resource or superadmin, otherwise show warning if ( ! wpbc_is_mu_user_can_be_here( 'resource_owner', $escaped_request_params_arr['resource_id'] ) ) { $default_values = $user_request->get_request_rules__default(); $escaped_request_params_arr['resource_id'] = $default_values['resource_id']; } } return $escaped_request_params_arr; } public function content() { $this->css_fix(); do_action( 'wpbc_hook_settings_page_header', 'page_booking_availability'); // Define Notices Section and show some static messages, if needed. if ( ! wpbc_is_mu_user_can_be_here( 'activated_user' ) ) { return false; } // Check if MU user activated, otherwise show Warning message. // if ( ! wpbc_set_default_resource_to__get() ) return false; // Define default booking resources for $_GET and check if booking resource belong to user. // Get and escape request parameters //////////////////////////////////////////////////////////////////////// $escaped_request_params_arr = $this->get_cleaned_params__saved_requestvalue_default(); // During initial load of the page, we need to reset 'dates_selection' value in our saved parameter $escaped_request_params_arr['dates_selection'] = ''; $escaped_request_params_arr['calendar__start_week_day'] = intval(get_bk_option( 'booking_start_day_weeek' )); // Submit ///////////////////////////////////////////////////////////// $submit_form_name = 'wpbc_ajx_availability_form'; // Define form name ?>wpbc_toolbar_toolbar_tabs( $this->in_page() ); wpbc_ajx_availability__toolbar( $escaped_request_params_arr ); ?>
ajx_availability_container__show( $escaped_request_params_arr ); wpbc_clear_div(); ?>
  ...
' . esc_textarea( $selected_dates_if_no_calendar ) . ''; if(1){ $start_script_code = wpbc__calendar__load( array( 'resource_id' => $resource_id, 'aggregate_resource_id_arr' => array(), // It is array of booking resources from aggregate parameter() 'selected_dates_without_calendar' => $selected_dates_if_no_calendar, // $selected_dates_if_no_calendar 'calendar_number_of_months' => 12, // $my_boook_count 'start_month_calendar' => false, // $start_month_calendar 'shortcode_options' => '', // options from the Booking Calendar shortcode. Usually it's conditional dates selection parameters 'custom_form' => 'standard' )); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $start_script_code; } else { ?> Settings General page in "Availability" section * */ class WPBC_Page_Availability_General extends WPBC_Page_Structure { public function in_page() { if ( class_exists( 'WPBC_Page_Availability_General_Dedicated' ) ) { return (string) wp_rand( 100000, 1000000 ); } 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 return (string) wp_rand( 100000, 1000000 ); // If this User not "super admin", then do not load this page at all } return 'wpbc-availability'; } public function tabs() { $separator_i = 0; $subtab_default = array( 'type' => 'subtab', // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'. 'title' => '', // Example: __( 'Dashboard' // Title of TAB. 'page_title' => '', // __( 'Search Availability' // Title of Page. 'hint' => '', // __( 'Configure the layout and functionality of both the search form and search results.' // Hint. 'link' => '', // wpbc_get_settings_url() . '&scroll_to_section=wpbc_general_settings_dashboard_tab', // Link. 'css_classes' => '', // cls CSS . 'font_icon' => 'wpbc_icn_dashboard', 'font_icon_right' => 'wpbc-bi-question-circle', // 'wpbc-bi-question-circle' . 'default' => false, // Is this sub tab activated by default or not: true || false. ); $tabs = array(); // FixIn: 10.12.4.7. $tabs[ 'general_availability' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:200;' ) ); $tabs[ 'general_availability' ] = array( 'title' => __( 'General Availability', 'booking' ) // Title of TAB //FixIn: 9.8.15.2.2 , 'hint' => __( 'Define unavailable weekdays for all calendar(s) and unavailable dates depend from today date', 'booking' ) // Hint , 'page_title' => __( 'General Availability', 'booking' ) // Title of Page , '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 , 'position' => '' // 'left' || 'right' || '' , 'css_classes' => 'wpbc_top_tab__general_availability' // CSS class(es) , 'icon' => '' // Icon - link to the real PNG img , 'font_icon' => 'wpbc-bi-calendar2-day 0wpbc-bi-calendar2-check'//'wpbc_icn_free_cancellation' // CSS definition of forn Icon , 'font_icon_right' => 'wpbc-bi-question-circle' , 'default' => false // Is this tab activated by default or not: true || false. , 'disabled' => false // Is this tab disbaled: true || false. , 'hided' => false // Is this tab hided: true || false. , 'subtabs' => array() // , 'folder_style' => 'order:200;', , 'folder_style' => 'order:93;', ); // $subtabs = array(); // $tabs[ 'items' ][ 'subtabs' ] = $subtabs; return $tabs; } public function content() { } } add_action('wpbc_menu_created', array( new WPBC_Page_Availability_General() , '__construct') ); // Executed after creation of Menu