| 1 |
<?php |
| 2 |
/** |
| 3 |
* @version 1.0 |
| 4 |
* @package Booking Calendar Shortcodes Config |
| 5 |
* @subpackage Shortcodes Content |
| 6 |
* @category Shortcodes |
| 7 |
* |
| 8 |
* @author wpdevelop |
| 9 |
* @link https://wpbookingcalendar.com/ |
| 10 |
* @email info@wpbookingcalendar.com |
| 11 |
* |
| 12 |
* @modified 2024-02-17 |
| 13 |
*/ |
| 14 |
|
| 15 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.9.0.15. |
| 16 |
|
| 17 |
// ===================================================================================================================== |
| 18 |
// Shortcode [bookingselect ... ] |
| 19 |
// ===================================================================================================================== |
| 20 |
|
| 21 |
/** |
| 22 |
* Content of PopUp - for shortcode [booking ...] |
| 23 |
* |
| 24 |
* @return void |
| 25 |
*/ |
| 26 |
function wpbc_shortcode_config__content__bookingselect() { |
| 27 |
|
| 28 |
$shortcode_name = 'bookingselect'; |
| 29 |
|
| 30 |
?><div id="wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>" class="wpbc_sc_container__shortcode wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>"><?php |
| 31 |
|
| 32 |
//-------------------------------------------------------------------------------------------------------------- |
| 33 |
// 'Upgrade to Pro' widget |
| 34 |
//-------------------------------------------------------------------------------------------------------------- |
| 35 |
$upgrade_content_arr = wpbc_get_upgrade_widget( array( |
| 36 |
'id' => 'widget_wpbc_dismiss__booking_select', |
| 37 |
'dismiss_css_class' => '.wpbc_dismiss__booking_select', |
| 38 |
'blured_in_versions' => array( 'free' ), |
| 39 |
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#booking-resources' ), |
| 40 |
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ), |
| 41 |
'versions' => 'paid versions', |
| 42 |
'css' => 'transform: translate(0) translateY(190px);' |
| 43 |
) ); |
| 44 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 45 |
echo $upgrade_content_arr['content']; |
| 46 |
|
| 47 |
//-------------------------------------------------------------------------------------------------------------- |
| 48 |
// Real Content |
| 49 |
//-------------------------------------------------------------------------------------------------------------- |
| 50 |
|
| 51 |
?><div class="wpbc_dismiss__booking_select <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>"><?php |
| 52 |
|
| 53 |
|
| 54 |
wpbc_shortcode_config__bookingselect__top_tabs(); |
| 55 |
|
| 56 |
// 'General' -------------------------------------------------------------------------------------------------- |
| 57 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__general"><?php |
| 58 |
|
| 59 |
// Select 'Multiple' -- 'Booking Resource' |
| 60 |
wpbc_shortcode_config_fields__select_multiple_resources( $shortcode_name . '_wpbc_multiple_resources', $shortcode_name ); |
| 61 |
|
| 62 |
?> |
| 63 |
<table class="form-table"><tbody><?php |
| 64 |
|
| 65 |
// Select 'SELECTED' by default 'Booking Resource' |
| 66 |
wpbc_shortcode_config_fields__select_selected_resource( $shortcode_name . '_wpbc_selected_resource', $shortcode_name ); |
| 67 |
|
| 68 |
// Label |
| 69 |
wpbc_shortcode_config_fields__text_label( $shortcode_name . '_wpbc_text_label', $shortcode_name ); |
| 70 |
|
| 71 |
// Title |
| 72 |
wpbc_shortcode_config_fields__text_first_option_title( $shortcode_name . '_wpbc_first_option_title', $shortcode_name ); |
| 73 |
|
| 74 |
?></tbody></table> |
| 75 |
</div><?php |
| 76 |
|
| 77 |
|
| 78 |
// 'Options' -------------------------------------------------------------------------------------------------- |
| 79 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__options"> |
| 80 |
<table class="form-table"><tbody><?php |
| 81 |
|
| 82 |
// Custom form |
| 83 |
wpbc_shortcode_config_fields__select_custom_form( $shortcode_name . '_wpbc_custom_form', $shortcode_name ); |
| 84 |
|
| 85 |
if ( class_exists( 'wpdev_bk_biz_m' ) ){ |
| 86 |
?> |
| 87 |
<tr><td></td><td> |
| 88 |
<div class="wpbc-settings-notice notice-warning"> |
| 89 |
<span><?php |
| 90 |
/* translators: 1: ... */ |
| 91 |
echo wp_kses_post( sprintf( __( 'If you choose the %s form, the system will load either the standard form or the default custom booking form (configured on the Resources page). Alternatively, selecting a specific custom booking form here will ensure that all booking resources use only the form you have chosen.', 'booking' ), |
| 92 |
'<strong>\'Standard\'</strong>' ) ); ?></span> |
| 93 |
</div> |
| 94 |
</td></tr> |
| 95 |
<?php |
| 96 |
} |
| 97 |
|
| 98 |
// Number of Months |
| 99 |
wpbc_shortcode_config_fields__select_nummonths( $shortcode_name . '_wpbc_nummonths', $shortcode_name ); |
| 100 |
|
| 101 |
// Calendar Size |
| 102 |
wpbc_shortcode_config_fields__calendar_size( $shortcode_name . '_wpbc_size', $shortcode_name ); |
| 103 |
|
| 104 |
?></tbody></table> |
| 105 |
</div><?php |
| 106 |
|
| 107 |
// 'Conditional Days Selection' -------------------------------------------------------------------------------- |
| 108 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__conditions"><?php |
| 109 |
|
| 110 |
wpbc_shortcode_config_fields__dates_conditions_toolbar(); // TOOLBAR |
| 111 |
|
| 112 |
?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__weekdays_conditions"> |
| 113 |
<?php |
| 114 |
wpbc_shortcode_config_fields__weekdays_conditions( $shortcode_name . 'wpbc_select_day_weekday', $shortcode_name ); |
| 115 |
?> |
| 116 |
</div><?php |
| 117 |
|
| 118 |
?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__seasons_conditions"> |
| 119 |
<?php |
| 120 |
wpbc_shortcode_config_fields__season_conditions( $shortcode_name . 'wpbc_select_day_season', $shortcode_name ); |
| 121 |
?> |
| 122 |
</div><?php |
| 123 |
|
| 124 |
?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__startseason_conditions"> |
| 125 |
<?php |
| 126 |
wpbc_shortcode_config_fields__season_start_day_conditions( $shortcode_name . 'wpbc_start_day_season', $shortcode_name ) |
| 127 |
?> |
| 128 |
</div><?php |
| 129 |
|
| 130 |
?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__dates_conditions"> |
| 131 |
<?php |
| 132 |
wpbc_shortcode_config_fields__fordate_conditions( $shortcode_name . 'wpbc_select_day_fordate', $shortcode_name ); |
| 133 |
?> |
| 134 |
</div><?php |
| 135 |
|
| 136 |
?></div><?php |
| 137 |
|
| 138 |
// 'AGGREGATE' ------------------------------------------------------------------------------------------------- |
| 139 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__aggregate"><?php |
| 140 |
|
| 141 |
wpbc_shortcode_config_fields__aggregate( $shortcode_name . '_wpbc_aggregate', $shortcode_name ); |
| 142 |
|
| 143 |
?></div><?php |
| 144 |
|
| 145 |
// 'START MONTH' ----------------------------------------------------------------------------------------------- |
| 146 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__other"><?php |
| 147 |
?><table class="form-table"><tbody><?php |
| 148 |
|
| 149 |
// wpbc_shortcode_config_fields__calendar_dates_start( $shortcode_name . '_wpbc_calendar_dates_start', $shortcode_name ); |
| 150 |
// |
| 151 |
// wpbc_shortcode_config_fields__calendar_dates_end( $shortcode_name . '_wpbc_calendar_dates_end', $shortcode_name ); |
| 152 |
|
| 153 |
wpbc_shortcode_config_fields__start_month( $shortcode_name . '_wpbc_startmonth', $shortcode_name ); |
| 154 |
?></tbody></table><?php |
| 155 |
?></div><?php |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
?> |
| 160 |
<div class="wpbc_shortcode_config_content_toolbar__next_prior"> |
| 161 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button"> |
| 162 |
<span class="in-button-text">‹</span> |
| 163 |
</a> |
| 164 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button"> |
| 165 |
<span class="in-button-text">›</span> |
| 166 |
</a> |
| 167 |
</div> |
| 168 |
<?php |
| 169 |
|
| 170 |
?></div><?php |
| 171 |
?></div><?php |
| 172 |
|
| 173 |
wpbc_clear_div(); |
| 174 |
} |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
/** |
| 179 |
* Top Tabs for shortcode [booking ...] |
| 180 |
* @return void |
| 181 |
*/ |
| 182 |
function wpbc_shortcode_config__bookingselect__top_tabs(){ |
| 183 |
|
| 184 |
$shortcode_name = 'bookingselect'; |
| 185 |
|
| 186 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 187 |
|
| 188 |
$js = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');" |
| 189 |
. "jQuery(this).addClass('nav-tab-active');" |
| 190 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 191 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 192 |
. "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();"; |
| 193 |
|
| 194 |
wpbc_bs_display_tab( array( |
| 195 |
'title' => __('Resource Selection', 'booking') |
| 196 |
, 'text_css' => 'line-height: 18px;vertical-align: text-top;' |
| 197 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 198 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__general').show();" |
| 199 |
, 'font_icon' => 'wpbc-bi-border-width NOwpbc-bi-card-checklist' |
| 200 |
, 'default' => true |
| 201 |
) ); |
| 202 |
wpbc_bs_display_tab( array( |
| 203 |
'title' => __('View Options', 'booking') |
| 204 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 205 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__options').show();" |
| 206 |
, 'font_icon' => 'wpbc_icn_adjust' |
| 207 |
, 'default' => false |
| 208 |
) ); |
| 209 |
wpbc_bs_display_tab( array( |
| 210 |
'title' => __('Conditional Days Selection', 'booking') |
| 211 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 212 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__conditions').show();" |
| 213 |
, 'font_icon' => 'wpbc-bi-calendar2-week' |
| 214 |
, 'default' => false |
| 215 |
, 'css_classes' => 'wpbc_dismiss__conditional_days' |
| 216 |
|
| 217 |
) ); |
| 218 |
wpbc_bs_display_tab( array( |
| 219 |
'title' => __('Aggregate', 'booking') |
| 220 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 221 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__aggregate').show();" |
| 222 |
, 'font_icon' => 'wpbc-bi-calendar2-plus' |
| 223 |
, 'default' => false |
| 224 |
, 'css_classes' => 'wpbc_dismiss__booking_param_aggregate' |
| 225 |
) ); |
| 226 |
wpbc_bs_display_tab( array( |
| 227 |
'title' => __('Advanced', 'booking') |
| 228 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 229 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__other').show();" |
| 230 |
, 'font_icon' => 'wpbc_icn_tune' |
| 231 |
, 'default' => false |
| 232 |
|
| 233 |
) ); |
| 234 |
|
| 235 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 236 |
} |
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
/** |
| 241 |
* Shortcode Field: Select-box - "Booking Resource" |
| 242 |
* |
| 243 |
* @param $id |
| 244 |
* @param $group_key |
| 245 |
* |
| 246 |
* @return void |
| 247 |
*/ |
| 248 |
function wpbc_shortcode_config_fields__select_selected_resource( $id , $group_key ){ |
| 249 |
|
| 250 |
$resources_list = array(); |
| 251 |
|
| 252 |
if ( class_exists( 'wpdev_bk_personal' ) ){ |
| 253 |
|
| 254 |
$resources_list_orig = wpbc_get_all_booking_resources_list(); |
| 255 |
|
| 256 |
$resources_list[0] = array( 'title' => ' - '.__('None', 'booking' ).' - ', 'attr' => array ( 'class' => 'wpbc_single_resource', 'style' => 'border-bottom:1px dashed #ddd;') ); |
| 257 |
foreach ($resources_list_orig as $res_id => $res_val) { |
| 258 |
$resources_list[$res_id] = $res_val; |
| 259 |
} |
| 260 |
|
| 261 |
} |
| 262 |
WPBC_Settings_API::field_select_row_static( $id |
| 263 |
, array( |
| 264 |
'type' => 'select' |
| 265 |
, 'title' => __( 'Preselected resource', 'booking') |
| 266 |
, 'description' => __( 'Choose the initially selected booking resource.', 'booking' ) |
| 267 |
, 'description_tag' => 'span' |
| 268 |
, 'label' => '' |
| 269 |
, 'multiple' => false |
| 270 |
, 'group' => $group_key |
| 271 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed' |
| 272 |
, 'class' => '' |
| 273 |
, 'css' => 'margin-right:10px;min-width:15em;' |
| 274 |
, 'only_field' => false |
| 275 |
, 'attr' => array() |
| 276 |
, 'value' => '' |
| 277 |
, 'options' => $resources_list |
| 278 |
) ); |
| 279 |
|
| 280 |
} |
| 281 |
|
| 282 |
/** |
| 283 |
* Shortcode Fields: AGGREGATE |
| 284 |
* |
| 285 |
* @param $id |
| 286 |
* @param $group_key |
| 287 |
* |
| 288 |
* @return void |
| 289 |
*/ |
| 290 |
function wpbc_shortcode_config_fields__select_multiple_resources( $id , $group_key ){ |
| 291 |
|
| 292 |
if ( class_exists( 'wpdev_bk_personal' ) ){ |
| 293 |
$resources_list_orig = wpbc_get_all_booking_resources_list(); |
| 294 |
$resources_list = array(); |
| 295 |
$resources_list[0] = array( 'title' => __('All', 'booking' ), 'attr' => array ( 'class' => 'wpbc_single_resource', 'style' => 'border-bottom:1px dashed #ddd;') ); |
| 296 |
foreach ($resources_list_orig as $res_id => $res_val) { |
| 297 |
$resources_list[$res_id] = $res_val; |
| 298 |
} |
| 299 |
|
| 300 |
?> |
| 301 |
<div class="clear"></div> |
| 302 |
<div class="wpbc-settings-notice0 notice-info notice-header" style="font-size: 15px;font-weight: 600;margin: 15px 0 15px 15px;"> |
| 303 |
<label for="<?php echo esc_attr($id); ?>"><?php esc_html_e( 'Set Up Booking Resource(s)', 'booking' ); ?></label> |
| 304 |
</div> |
| 305 |
|
| 306 |
<div class="wpbc_shortcode_config__rules_container"> |
| 307 |
<div class="wpbc_shortcode_config__rules__params_section wpbc_aggregate"> |
| 308 |
|
| 309 |
<div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row"> |
| 310 |
<div class="ui_container ui_container_mini"> |
| 311 |
<div class="ui_group"> |
| 312 |
<div class="ui_element wpdevelop"><?php |
| 313 |
|
| 314 |
WPBC_Settings_API::field_select_row_static( $id //. '__aggregate' |
| 315 |
, array( |
| 316 |
'type' => 'select' |
| 317 |
, 'title' => ''//__('Aggregate booking dates from other resources', 'booking') |
| 318 |
, 'description' => ''//__( 'Select booking resources, for getting booking dates from them and set such dates as unavailable in destination calendar.', 'booking' ) |
| 319 |
, 'description_tag' => 'span' |
| 320 |
, 'label' => '' |
| 321 |
, 'multiple' => true |
| 322 |
, 'group' => $group_key |
| 323 |
, 'tr_class' => ''//$group_key . '_advanced_section' |
| 324 |
, 'class' => 'wpbc_ui_control wpbc_ui_select' |
| 325 |
, 'css' => 'margin-right:10px;height:12em;' |
| 326 |
, 'only_field' => true |
| 327 |
, 'attr' => array() |
| 328 |
, 'value' => '0' |
| 329 |
, 'options' => $resources_list |
| 330 |
) |
| 331 |
); |
| 332 |
?></div> |
| 333 |
</div> |
| 334 |
</div> |
| 335 |
</div> |
| 336 |
</div> |
| 337 |
<div class="wpbc_shortcode_config__rules__help_section" style="margin-top: 8px;"> |
| 338 |
<div class="wpbc-settings-notice notice-info notice-list"> |
| 339 |
<ol> |
| 340 |
<li> <?php esc_html_e( 'Configure the shortcode to show Timeline.', 'booking' ); ?> |
| 341 |
</li> |
| 342 |
<li> |
| 343 |
<?php echo esc_html__( 'To set this up, choose all or multiple booking resources in the multi-select box.', 'booking' ) |
| 344 |
. '<br>' |
| 345 |
. esc_html__( 'Hold down the Ctrl button to make multiple selections.', 'booking' ); |
| 346 |
?> |
| 347 |
</li> |
| 348 |
<li> |
| 349 |
<?php |
| 350 |
/* translators: 1: ... */ |
| 351 |
echo wp_kses_post( sprintf( __( 'Refer to the FAQ for detailed information on %1$sshortcode configuration%2$s.', 'booking' ) |
| 352 |
, '<a href="https://wpbookingcalendar.com/faq/shortcode-timeline/" target="_blank">', '</a>' |
| 353 |
) ); |
| 354 |
?> |
| 355 |
</li> |
| 356 |
</ol> |
| 357 |
</div> |
| 358 |
</div> |
| 359 |
</div><?php |
| 360 |
|
| 361 |
} |
| 362 |
} |
| 363 |
|
| 364 |
/** |
| 365 |
* Shortcode Field: Label - text of label for the select box. |
| 366 |
* |
| 367 |
* @param $id |
| 368 |
* @param $group_key |
| 369 |
* |
| 370 |
* @return void |
| 371 |
*/ |
| 372 |
function wpbc_shortcode_config_fields__text_label($id , $group_key ){ |
| 373 |
|
| 374 |
WPBC_Settings_API::field_text_row_static( $id |
| 375 |
, array( |
| 376 |
'type' => 'text' |
| 377 |
, 'placeholder' => __( 'Example', 'booking' ). ': ' .__( 'Please select the resource:', 'booking' ) |
| 378 |
, 'title' => __('Label', 'booking') |
| 379 |
, 'description' => __('The title displayed next to your select box.', 'booking') |
| 380 |
, 'description_tag' => 'span' |
| 381 |
, 'label' => '' |
| 382 |
, 'class' => '' |
| 383 |
, 'css' => 'width0:5em;' |
| 384 |
, 'tr_class' => '' |
| 385 |
|
| 386 |
, 'group' => $group_key |
| 387 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed' |
| 388 |
, 'only_field' => false |
| 389 |
, 'attr' => array() |
| 390 |
, 'value' => '' |
| 391 |
) |
| 392 |
); |
| 393 |
|
| 394 |
} |
| 395 |
|
| 396 |
|
| 397 |
/** |
| 398 |
* Shortcode Field: Label - text of label for the select box. |
| 399 |
* |
| 400 |
* @param $id |
| 401 |
* @param $group_key |
| 402 |
* |
| 403 |
* @return void |
| 404 |
*/ |
| 405 |
function wpbc_shortcode_config_fields__text_first_option_title($id , $group_key ){ |
| 406 |
|
| 407 |
WPBC_Settings_API::field_text_row_static( $id |
| 408 |
, array( |
| 409 |
'type' => 'text' |
| 410 |
, 'placeholder' => __( 'Example', 'booking' ). ': ' . __( 'Please select', 'booking' ) |
| 411 |
, 'title' => __('Title for first option', 'booking') |
| 412 |
, 'description' => __('The first option in the dropdown list.' ,'booking') . ' <span>' . esc_html__('Please leave it empty if you want to skip it.' ,'booking') . '</span>' |
| 413 |
|
| 414 |
, 'description_tag' => 'span' |
| 415 |
, 'label' => '' |
| 416 |
, 'class' => '' |
| 417 |
, 'css' => 'width0:5em;' |
| 418 |
, 'tr_class' => '' |
| 419 |
|
| 420 |
, 'group' => $group_key |
| 421 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed' |
| 422 |
, 'only_field' => false |
| 423 |
, 'attr' => array() |
| 424 |
, 'value' => '' |
| 425 |
) |
| 426 |
); |
| 427 |
|
| 428 |
} |