| 1 |
<?php |
| 2 |
/* |
| 3 |
* @package: AJX_Bookings Page |
| 4 |
* @category: o Email Reminders |
| 5 |
* @description: Define AJX_Bookings in admin settings page. - Sending friendly email reminders based on custom ajx_booking. |
| 6 |
* Plugin URI: https://oplugins.com/plugins/email-reminders/#premium |
| 7 |
* Author URI: https://oplugins.com |
| 8 |
* Author: wpdevelop, oplugins |
| 9 |
* Version: 0.0.1 |
| 10 |
* @modified 2020-05-11 |
| 11 |
*/ |
| 12 |
//FixIn: 9.2.1 |
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 14 |
|
| 15 |
|
| 16 |
/** Show Content |
| 17 |
* Update Content |
| 18 |
* Define Slug |
| 19 |
* Define where to show |
| 20 |
*/ |
| 21 |
class WPBC_Page_AJX_Availability extends WPBC_Page_Structure { |
| 22 |
|
| 23 |
|
| 24 |
public function __construct() { |
| 25 |
|
| 26 |
parent::__construct(); |
| 27 |
|
| 28 |
add_action( 'wpbc_toolbar_top_tabs_insert', array( $this, 'wpbc_toolbar_toolbar_tabs' ) ); |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
public function in_page() { |
| 33 |
return 'wpbc-availability'; |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
public function tabs() { |
| 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' => 'compact', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 42 |
'title' => __( 'Days Availability', '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' => __( 'Days Availability', '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 |
); |
| 58 |
return $tabs; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
/** |
| 63 |
* Show custom tabs for Toolbar at . - . R i g h t . s i d e. |
| 64 |
* |
| 65 |
* @param string $menu_in_page_tag - active page |
| 66 |
*/ |
| 67 |
public function wpbc_toolbar_toolbar_tabs( $menu_in_page_tag ) { |
| 68 |
|
| 69 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 70 |
if ( ( $this->in_page() === $menu_in_page_tag ) && ( ( empty( $_GET['tab'] ) ) || ( 'availability' === $_GET['tab'] ) ) ) { // FixIn: 9.8.15.2.2. |
| 71 |
|
| 72 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 73 |
|
| 74 |
$escaped_search_request_params = $this->get_cleaned_params__saved_requestvalue_default(); |
| 75 |
|
| 76 |
// Check if by some reason, user was saved request without this parameter, then get default value. |
| 77 |
if ( ! empty( $escaped_search_request_params['ui_usr__availability_selected_toolbar'] ) ) { |
| 78 |
$selected_tab = $escaped_search_request_params['ui_usr__availability_selected_toolbar']; |
| 79 |
} else { |
| 80 |
$default_search_request_params = WPBC_AJX__Availability::request_rules_structure(); |
| 81 |
$selected_tab = $default_search_request_params ['ui_usr__availability_selected_toolbar']['default']; |
| 82 |
} |
| 83 |
|
| 84 |
wpbc_bs_display_tab( array( |
| 85 |
'title' => __( 'Set Availability', 'booking' ) |
| 86 |
, 'hint' => array( 'title' => __('Availability' ,'booking') , 'position' => 'top' ) |
| 87 |
, 'onclick' => "jQuery('.ui_container_toolbar').hide();" |
| 88 |
. "jQuery('.ui_container_info').show();" |
| 89 |
. "jQuery('.wpbc_availability_support_tabs').removeClass('nav-tab-active');" |
| 90 |
. "jQuery(this).addClass('nav-tab-active');" |
| 91 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 92 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 93 |
/** |
| 94 |
* It will save such changes, and if we have selected bookings, then deselect them |
| 95 |
*/ |
| 96 |
// . "wpbc_ajx_booking_send_search_request_with_params( { 'ui_usr__availability_selected_toolbar': 'filters' });" |
| 97 |
/** |
| 98 |
* It will save changes with NEXT search request, but not immediately |
| 99 |
* it is handy, in case if we have selected bookings, |
| 100 |
* we will not lose selection. |
| 101 |
*/ |
| 102 |
. "wpbc_ajx_availability.search_set_param( 'ui_usr__availability_selected_toolbar', 'info' );" |
| 103 |
, 'font_icon' => 'wpbc-bi-calendar2-check' //'wpbc_icn_info_outline' |
| 104 |
, 'default' => ( 'info' == $selected_tab ) ? true : false |
| 105 |
//, 'position' => 'right' |
| 106 |
, 'css_classes' => 'wpbc_availability_support_tabs' |
| 107 |
) ); |
| 108 |
|
| 109 |
wpbc_bs_display_tab( array( |
| 110 |
'title' => __('Options', 'booking') |
| 111 |
, 'hint' => array( 'title' => __('User Options' ,'booking') , 'position' => 'top' ) |
| 112 |
, 'onclick' => "jQuery('.ui_container_toolbar').hide();" |
| 113 |
. "jQuery('.ui_container_options').show();" |
| 114 |
. "jQuery('.wpbc_availability_support_tabs').removeClass('nav-tab-active');" |
| 115 |
. "jQuery(this).addClass('nav-tab-active');" |
| 116 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 117 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 118 |
/** |
| 119 |
* It will save such changes, and if we have selected bookings, then deselect them |
| 120 |
*/ |
| 121 |
// . "wpbc_ajx_booking_send_search_request_with_params( { 'ui_usr__availability_selected_toolbar': 'options' });" |
| 122 |
/** |
| 123 |
* It will save changes with NEXT search request, but not immediately |
| 124 |
* it is handy, in case if we have selected bookings, |
| 125 |
* we will not lose selection. |
| 126 |
*/ |
| 127 |
. "wpbc_ajx_availability.search_set_param( 'ui_usr__availability_selected_toolbar', 'calendar_settings' );" |
| 128 |
, 'font_icon' => 'wpbc_icn_tune' |
| 129 |
, 'default' => ( 'calendar_settings' == $selected_tab ) ? true : false |
| 130 |
//, 'position' => 'right' |
| 131 |
, 'css_classes' => 'wpbc_availability_support_tabs' |
| 132 |
|
| 133 |
) ); |
| 134 |
|
| 135 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 136 |
|
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
|
| 141 |
/** |
| 142 |
* Get sanitised request parameters. :: Firstly check if user saved it. :: Otherwise, check $_REQUEST. :: Otherwise get default. |
| 143 |
* |
| 144 |
* @return array|false |
| 145 |
*/ |
| 146 |
public function get_cleaned_params__saved_requestvalue_default(){ |
| 147 |
|
| 148 |
$user_request = new WPBC_AJX__REQUEST( array( |
| 149 |
'db_option_name' => 'booking_availability_request_params', |
| 150 |
'user_id' => wpbc_get_current_user_id(), |
| 151 |
'request_rules_structure' => WPBC_AJX__Availability::request_rules_structure() |
| 152 |
) |
| 153 |
); |
| 154 |
$escaped_request_params_arr = $user_request->get_sanitized__saved__user_request_params(); // Get Saved |
| 155 |
|
| 156 |
//Fix Calendar cell heights in versions older than // FixIn: 9.7.3.2. |
| 157 |
if ( ( false !== $escaped_request_params_arr ) |
| 158 |
&& ( '' === $escaped_request_params_arr['calendar__view__cell_height'] ) |
| 159 |
) { |
| 160 |
$user_request->user_request_params__db_delete(); // Delete from DB. |
| 161 |
} |
| 162 |
|
| 163 |
if ( false === $escaped_request_params_arr ) { // This request was not saved before, then get sanitized direct parameters, like: $_REQUEST['resource_id'] |
| 164 |
|
| 165 |
$request_prefix = false; |
| 166 |
$escaped_request_params_arr = $user_request->get_sanitized__in_request__value_or_default( $request_prefix ); // Direct: $_REQUEST['resource_id'] |
| 167 |
} |
| 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 |
} |
| 177 |
|
| 178 |
|
| 179 |
//MU |
| 180 |
if ( class_exists( 'wpdev_bk_multiuser' ) ) { |
| 181 |
|
| 182 |
// Check if this MU user activated or superadmin, otherwise show warning |
| 183 |
if ( ! wpbc_is_mu_user_can_be_here('activated_user') ) |
| 184 |
return false; |
| 185 |
|
| 186 |
// Check if this MU user owner of this resource or superadmin, otherwise show warning |
| 187 |
if ( ! wpbc_is_mu_user_can_be_here( 'resource_owner', $escaped_request_params_arr['resource_id'] ) ) { |
| 188 |
$default_values = $user_request->get_request_rules__default(); |
| 189 |
$escaped_request_params_arr['resource_id'] = $default_values['resource_id']; |
| 190 |
} |
| 191 |
|
| 192 |
} |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
return $escaped_request_params_arr; |
| 197 |
} |
| 198 |
|
| 199 |
|
| 200 |
public function content() { |
| 201 |
|
| 202 |
$this->css_fix(); |
| 203 |
|
| 204 |
do_action( 'wpbc_hook_settings_page_header', 'page_booking_availability'); // Define Notices Section and show some static messages, if needed. |
| 205 |
|
| 206 |
if ( ! wpbc_is_mu_user_can_be_here( 'activated_user' ) ) { return false; } // Check if MU user activated, otherwise show Warning message. |
| 207 |
|
| 208 |
// if ( ! wpbc_set_default_resource_to__get() ) return false; // Define default booking resources for $_GET and check if booking resource belong to user. |
| 209 |
|
| 210 |
|
| 211 |
// Get and escape request parameters //////////////////////////////////////////////////////////////////////// |
| 212 |
$escaped_request_params_arr = $this->get_cleaned_params__saved_requestvalue_default(); |
| 213 |
|
| 214 |
// During initial load of the page, we need to reset 'dates_selection' value in our saved parameter |
| 215 |
$escaped_request_params_arr['dates_selection'] = ''; |
| 216 |
$escaped_request_params_arr['calendar__start_week_day'] = intval(get_bk_option( 'booking_start_day_weeek' )); |
| 217 |
|
| 218 |
|
| 219 |
// Submit ///////////////////////////////////////////////////////////// |
| 220 |
$submit_form_name = 'wpbc_ajx_availability_form'; // Define form name |
| 221 |
|
| 222 |
?><span class="wpdevelop"><?php // BS UI CSS Class |
| 223 |
|
| 224 |
wpbc_js_for_bookings_page(); // JavaScript functions |
| 225 |
|
| 226 |
$this->wpbc_toolbar_toolbar_tabs( $this->in_page() ); |
| 227 |
wpbc_ajx_availability__toolbar( $escaped_request_params_arr ); |
| 228 |
|
| 229 |
?></span><?php |
| 230 |
|
| 231 |
?><div id="wpbc_log_screen" class="wpbc_log_screen"></div><?php |
| 232 |
|
| 233 |
// Content //////////////////////////////////////////////////////////// |
| 234 |
?> |
| 235 |
<div class="clear" style="margin-bottom:10px;"></div> |
| 236 |
<span class="metabox-holder"> |
| 237 |
<form name="<?php echo esc_attr( $submit_form_name ); ?>" id="<?php echo esc_attr( $submit_form_name ); ?>" action="" method="post" > |
| 238 |
<?php |
| 239 |
// N o n c e field, and key for checking S u b m i t |
| 240 |
wp_nonce_field( 'wpbc_settings_page_' . $submit_form_name ); |
| 241 |
?><input type="hidden" name="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" id="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" value="1" /><?php |
| 242 |
|
| 243 |
//wpbc_ajx_booking_modify_container_show(); // Container for showing Edit ajx_booking and define Edit and Delete ajx_booking JavaScript vars. |
| 244 |
|
| 245 |
wpbc_clear_div(); |
| 246 |
|
| 247 |
$this->ajx_availability_container__show( $escaped_request_params_arr ); |
| 248 |
|
| 249 |
wpbc_clear_div(); |
| 250 |
|
| 251 |
?></form> |
| 252 |
</span> |
| 253 |
<?php |
| 254 |
|
| 255 |
//wpbc_show_wpbc_footer(); // Rating |
| 256 |
|
| 257 |
do_action( 'wpbc_hook_settings_page_footer', 'wpbc-ajx_booking_availability' ); |
| 258 |
} |
| 259 |
|
| 260 |
private function ajx_availability_container__show( $escaped_request_params_arr ) { |
| 261 |
|
| 262 |
?> |
| 263 |
<div id="ajx_nonce_calendar_section"></div> |
| 264 |
<div class="wpbc_ajx_availability_container wpbc_selectable_table wpdevelop" wpbc_loaded="first_time"> |
| 265 |
<style type="text/css"> |
| 266 |
.wpbc_calendar_loading .wpbc_icn_autorenew::before{ |
| 267 |
font-size: 1.2em; |
| 268 |
} |
| 269 |
.wpbc_calendar_loading { |
| 270 |
width:95%; |
| 271 |
text-align: center; |
| 272 |
margin:2em 0; |
| 273 |
font-size: 1.2em; |
| 274 |
font-weight: 600; |
| 275 |
} |
| 276 |
</style> |
| 277 |
<div class="wpbc_calendar_loading"><span class="wpbc_icn_autorenew wpbc_spin"></span> <span><?php esc_html_e( 'Loading', 'booking' ); ?>...</span> |
| 278 |
</div> |
| 279 |
</div> |
| 280 |
<script type="text/javascript"> |
| 281 |
jQuery( document ).ready( function (){ |
| 282 |
|
| 283 |
// Set Security - Nonce for Ajax - Listing |
| 284 |
wpbc_ajx_availability.set_secure_param( 'nonce', '<?php echo esc_js( wp_create_nonce( 'wpbc_ajx_availability_ajx' . '_wpbcnonce' ) ); ?>' ); |
| 285 |
wpbc_ajx_availability.set_secure_param( 'user_id', '<?php echo esc_js( wpbc_get_current_user_id() ); ?>' ); |
| 286 |
wpbc_ajx_availability.set_secure_param( 'locale', '<?php echo esc_js( get_user_locale() ); ?>' ); |
| 287 |
|
| 288 |
// Set other parameters |
| 289 |
wpbc_ajx_availability.set_other_param( 'listing_container', '.wpbc_ajx_availability_container' ); |
| 290 |
|
| 291 |
// Send Ajax request and show listing after this. |
| 292 |
wpbc_ajx_availability__send_request_with_params( <?php echo wp_json_encode( $escaped_request_params_arr ); ?> ); |
| 293 |
} ); |
| 294 |
</script> |
| 295 |
<?php |
| 296 |
// FixIn: 10.0.0.5. |
| 297 |
/* |
| 298 |
if ( 0 ) { |
| 299 |
$resource_id = 220; |
| 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 |
| 302 |
|
| 303 |
?> |
| 304 |
<div class="wpbc_calendar_wraper wpbc_change_over_triangle"> |
| 305 |
<div class="bk_calendar_frame months_num_in_row_4 cal_month_num_4" style="width:100%;max-width:100%;"> |
| 306 |
<div id="calendar_booking<?php echo esc_attr( $resource_id ); ?>"><?php esc_html_e('Calendar is loading...', 'booking'); ?></div> |
| 307 |
</div> |
| 308 |
</div><?php |
| 309 |
|
| 310 |
$selected_dates_if_no_calendar = ''; |
| 311 |
echo '<textarea rows="3" cols="50" id="date_booking' . esc_attr( $resource_id ) . '" name="date_booking' . esc_attr( $resource_id ) . '" autocomplete="off" style="display:none;">' . |
| 312 |
esc_textarea( $selected_dates_if_no_calendar ) . '</textarea>'; |
| 313 |
if(1){ |
| 314 |
$start_script_code = wpbc__calendar__load( array( |
| 315 |
|
| 316 |
'resource_id' => $resource_id, |
| 317 |
'aggregate_resource_id_arr' => array(), // It is array of booking resources from aggregate parameter() |
| 318 |
'selected_dates_without_calendar' => $selected_dates_if_no_calendar, // $selected_dates_if_no_calendar |
| 319 |
'calendar_number_of_months' => 12, // $my_boook_count |
| 320 |
'start_month_calendar' => false, // $start_month_calendar |
| 321 |
'shortcode_options' => '', // options from the Booking Calendar shortcode. Usually it's conditional dates selection parameters |
| 322 |
'custom_form' => 'standard' |
| 323 |
|
| 324 |
)); |
| 325 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 326 |
echo $start_script_code; |
| 327 |
} else { |
| 328 |
?> |
| 329 |
<script type='text/javascript'> jQuery( document ).ready( function (){ |
| 330 |
_wpbc.balancer__set_max_threads( 1 ); |
| 331 |
_wpbc.calendar__set_param_value( 220, 'calendar_scroll_to', false ); |
| 332 |
_wpbc.calendar__set_param_value( 220, 'booking_max_monthes_in_calendar', '2y' ); |
| 333 |
_wpbc.calendar__set_param_value( 220, 'booking_start_day_weeek', '1' ); |
| 334 |
_wpbc.calendar__set_param_value( 220, 'calendar_number_of_months', '12' ); |
| 335 |
_wpbc.calendar__set_param_value( 220, 'days_select_mode', 'dynamic' ); |
| 336 |
_wpbc.calendar__set_param_value( 220, 'fixed__days_num', 7 ); |
| 337 |
_wpbc.calendar__set_param_value( 220, 'fixed__week_days__start', [-1] ); |
| 338 |
_wpbc.calendar__set_param_value( 220, 'dynamic__days_min', 1 ); |
| 339 |
_wpbc.calendar__set_param_value( 220, 'dynamic__days_max', 30 ); |
| 340 |
_wpbc.calendar__set_param_value( 220, 'dynamic__days_specific', [] ); |
| 341 |
_wpbc.calendar__set_param_value( 220, 'dynamic__week_days__start', [-1] ); |
| 342 |
_wpbc.calendar__set_param_value( 220, 'booking_date_format', 'j M Y' ); |
| 343 |
_wpbc.calendar__set_param_value( 220, 'booking_time_format', 'g:i A' ); |
| 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' ) ); ?> ); |
| 347 |
_wpbc.calendar__set_param_value( 220, 'is_parent_resource', 0 ); |
| 348 |
_wpbc.calendar__set_param_value( 220, 'booking_capacity_field', 'visitors' ); |
| 349 |
_wpbc.calendar__set_param_value( 220, 'booking_is_dissbale_booking_for_different_sub_resources', 'Off' ); |
| 350 |
_wpbc.calendar__set_param_value( 220, 'booking_recurrent_time', 'Off' ); |
| 351 |
if ( 'function' === typeof (wpbc__conditions__SAVE_INITIAL__days_selection_params__bm) ){ wpbc__conditions__SAVE_INITIAL__days_selection_params__bm( 220 ); } |
| 352 |
_wpbc.calendar__set_param_value( 220, 'conditions', { |
| 353 |
"select-day": { |
| 354 |
"weekday": [{ |
| 355 |
"for" : "0", |
| 356 |
"value": "7,14" |
| 357 |
}] |
| 358 |
} |
| 359 |
} ); |
| 360 |
_wpbc.seasons__set( 220, [] ); |
| 361 |
wpbc_calendar_show( '220' ); |
| 362 |
_wpbc.set_secure_param( 'nonce', '<?php echo esc_attr( wp_create_nonce( 'wpbc_calendar_load_ajx' . '_wpbcnonce' ) ); ?>' ); |
| 363 |
_wpbc.set_secure_param( 'user_id','<?php echo esc_attr( wpbc_get_current_user_id() ); ?>' ); |
| 364 |
_wpbc.set_secure_param( 'locale', '<?php echo esc_attr( get_user_locale() ); ?>' ); |
| 365 |
wpbc_calendar__load_data__ajx( { |
| 366 |
"resource_id" : 220, |
| 367 |
"booking_hash" : "", |
| 368 |
"request_uri" : "\/2024-03-221132\/", |
| 369 |
"custom_form" : "standard", |
| 370 |
"aggregate_resource_id_str": "", |
| 371 |
"aggregate_type" : "all" |
| 372 |
} ); |
| 373 |
} ); |
| 374 |
</script> |
| 375 |
<?php |
| 376 |
} |
| 377 |
} |
| 378 |
*/ |
| 379 |
|
| 380 |
} |
| 381 |
|
| 382 |
/** |
| 383 |
* Hide first "Availability tab", because we have only one tab hhere, and need to show only tabs for toolbar |
| 384 |
* @return void |
| 385 |
*/ |
| 386 |
private function css_fix(){ |
| 387 |
// FixIn: 9.8.15.2. |
| 388 |
/* |
| 389 |
|
| 390 |
?><style type="text/css"> |
| 391 |
.nav-tabs .nav-tab:first-child{ |
| 392 |
display:none; |
| 393 |
} |
| 394 |
</style><?php |
| 395 |
*/ |
| 396 |
} |
| 397 |
|
| 398 |
} |
| 399 |
add_action('wpbc_menu_created', array( new WPBC_Page_AJX_Availability() , '__construct') ); // Executed after creation of Menu |
| 400 |
|
| 401 |
|
| 402 |
/** |
| 403 |
* Duplicated Genal Availability Tab - Redirect to Booking > Settings General page in "Availability" section |
| 404 |
* |
| 405 |
*/ |
| 406 |
class WPBC_Page_Availability_General extends WPBC_Page_Structure { |
| 407 |
|
| 408 |
|
| 409 |
public function in_page() { |
| 410 |
|
| 411 |
if ( class_exists( 'WPBC_Page_Availability_General_Dedicated' ) ) { |
| 412 |
return (string) wp_rand( 100000, 1000000 ); |
| 413 |
} |
| 414 |
|
| 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 |
| 416 |
return (string) wp_rand( 100000, 1000000 ); // If this User not "super admin", then do not load this page at all |
| 417 |
} |
| 418 |
|
| 419 |
return 'wpbc-availability'; |
| 420 |
} |
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
public function tabs() { |
| 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 |
|
| 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;' ) ); |
| 442 |
$tabs[ 'general_availability' ] = array( |
| 443 |
'title' => __( 'General Availability', 'booking' ) // Title of TAB //FixIn: 9.8.15.2.2 |
| 444 |
, 'hint' => __( 'Define unavailable weekdays for all calendar(s) and unavailable dates depend from today date', 'booking' ) // Hint |
| 445 |
, 'page_title' => __( 'General Availability', '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 |
| 447 |
, 'position' => '' // 'left' || 'right' || '' |
| 448 |
, 'css_classes' => 'wpbc_top_tab__general_availability' // CSS class(es) |
| 449 |
, 'icon' => '' // Icon - link to the real PNG img |
| 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' |
| 452 |
, 'default' => false // Is this tab activated by default or not: true || false. |
| 453 |
, 'disabled' => false // Is this tab disbaled: true || false. |
| 454 |
, 'hided' => false // Is this tab hided: true || false. |
| 455 |
, 'subtabs' => array() |
| 456 |
// , 'folder_style' => 'order:200;', |
| 457 |
, 'folder_style' => 'order:93;', |
| 458 |
); |
| 459 |
// $subtabs = array(); |
| 460 |
// $tabs[ 'items' ][ 'subtabs' ] = $subtabs; |
| 461 |
return $tabs; |
| 462 |
} |
| 463 |
|
| 464 |
public function content() { |
| 465 |
|
| 466 |
} |
| 467 |
} |
| 468 |
add_action('wpbc_menu_created', array( new WPBC_Page_Availability_General() , '__construct') ); // Executed after creation of Menu |
| 469 |
|