| 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 [bookingtimeline ... ] |
| 19 |
// ===================================================================================================================== |
| 20 |
|
| 21 |
/** |
| 22 |
* Content of PopUp - for shortcode [booking ...] |
| 23 |
* |
| 24 |
* @return void |
| 25 |
*/ |
| 26 |
function wpbc_shortcode_config__content__bookingtimeline() { |
| 27 |
|
| 28 |
$shortcode_name = 'bookingtimeline'; |
| 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 |
wpbc_shortcode_config__bookingtimeline__top_tabs(); |
| 33 |
|
| 34 |
// 'General' -------------------------------------------------------------------------------------------------- |
| 35 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__general"><?php |
| 36 |
|
| 37 |
// Select 'Multiple' -- 'Booking Resource' |
| 38 |
wpbc_shortcode_config_fields__select_multiple_resources( $shortcode_name . '_wpbc_multiple_resources', $shortcode_name ); |
| 39 |
|
| 40 |
?> |
| 41 |
<table class="form-table"><tbody><?php |
| 42 |
|
| 43 |
// Select 'View Mode' for Timeline |
| 44 |
wpbc_shortcode_config_fields__view_mode_timeline( $shortcode_name . '_wpbc_view_mode_timeline', $shortcode_name ); |
| 45 |
|
| 46 |
|
| 47 |
?></tbody></table> |
| 48 |
</div><?php |
| 49 |
|
| 50 |
|
| 51 |
// 'Options' -------------------------------------------------------------------------------------------------- |
| 52 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__other"> |
| 53 |
<table class="form-table"><tbody><?php |
| 54 |
|
| 55 |
// Label |
| 56 |
wpbc_shortcode_config_fields__text_label_timeline( $shortcode_name . '_wpbc_text_label_timeline', $shortcode_name ); |
| 57 |
|
| 58 |
// Number of months / days to scroll |
| 59 |
wpbc_shortcode_config_fields__select_days_months_to_scroll( $shortcode_name . '_wpbc_scroll_timeline', $shortcode_name ); |
| 60 |
|
| 61 |
// Select start date |
| 62 |
wpbc_shortcode_config_fields__start_date_timeline( $shortcode_name . '_wpbc_start_date_timeline', $shortcode_name ); |
| 63 |
|
| 64 |
// Start/end time |
| 65 |
wpbc_shortcode_config_fields__start_end_time_timeline( $shortcode_name . '_wpbc_start_end_time_timeline', $shortcode_name ); |
| 66 |
|
| 67 |
?></tbody></table> |
| 68 |
</div><?php |
| 69 |
|
| 70 |
?> |
| 71 |
<div class="wpbc_shortcode_config_content_toolbar__next_prior"> |
| 72 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button"> |
| 73 |
<span class="in-button-text">‹</span> |
| 74 |
</a> |
| 75 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button"> |
| 76 |
<span class="in-button-text">›</span> |
| 77 |
</a> |
| 78 |
</div> |
| 79 |
<?php |
| 80 |
|
| 81 |
?></div><?php |
| 82 |
|
| 83 |
wpbc_clear_div(); |
| 84 |
} |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
/** |
| 89 |
* Top Tabs for shortcode [booking ...] |
| 90 |
* @return void |
| 91 |
*/ |
| 92 |
function wpbc_shortcode_config__bookingtimeline__top_tabs(){ |
| 93 |
|
| 94 |
$shortcode_name = 'bookingtimeline'; |
| 95 |
|
| 96 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 97 |
|
| 98 |
$js = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');" |
| 99 |
. "jQuery(this).addClass('nav-tab-active');" |
| 100 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 101 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 102 |
. "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();"; |
| 103 |
|
| 104 |
wpbc_bs_display_tab( array( |
| 105 |
'title' => __('TimeLine', 'booking') |
| 106 |
, 'text_css' => 'line-height: 18px;vertical-align: text-top;' |
| 107 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 108 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__general').show();" |
| 109 |
, 'font_icon' => 'menu_icon icon-1x wpbc_icn_rotate_90 wpbc_icn_align_vertical_bottom NOwpbc-bi-bar-chart-steps0 NOwpbc-bi-diagram-3' |
| 110 |
, 'default' => true |
| 111 |
) ); |
| 112 |
// wpbc_bs_display_tab( array( |
| 113 |
// 'title' => __('View Options', 'booking') |
| 114 |
// // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 115 |
// , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__options').show();" |
| 116 |
// , 'font_icon' => 'wpbc_icn_adjust' |
| 117 |
// , 'default' => false |
| 118 |
// ) ); |
| 119 |
wpbc_bs_display_tab( array( |
| 120 |
'title' => __('Advanced', 'booking') |
| 121 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 122 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__other').show();" |
| 123 |
, 'font_icon' => 'wpbc_icn_tune' |
| 124 |
, 'default' => false |
| 125 |
|
| 126 |
) ); |
| 127 |
|
| 128 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
/** |
| 134 |
* Shortcode Fields: View Mode: |
| 135 |
* |
| 136 |
* @param $id |
| 137 |
* @param $group_key |
| 138 |
* |
| 139 |
* @return void |
| 140 |
*/ |
| 141 |
function wpbc_shortcode_config_fields__view_mode_timeline( $id , $group_key ){ |
| 142 |
|
| 143 |
$view_days_optiopns = array(); |
| 144 |
if ( class_exists( 'wpdev_bk_personal' ) ) { |
| 145 |
$view_days_optiopns[ 1 ] = array( 'title' => __('Day', 'booking' ), 'attr' => array( 'class' => 'wpbc_bookingtimeline_matrix' ) ); |
| 146 |
$view_days_optiopns[ 7 ] = array( 'title' => __( 'Week', 'booking' ), 'attr' => array( 'class' => 'wpbc_bookingtimeline_matrix' ) ); |
| 147 |
} |
| 148 |
$view_days_optiopns[ 30 ] = array( 'title' => __( 'Month', 'booking' ), 'attr' => array( 'class' => 'wpbc_bookingtimeline_single wpbc_bookingtimeline_matrix' ) ); |
| 149 |
if ( class_exists( 'wpdev_bk_personal' ) ) { |
| 150 |
$view_days_optiopns[ 60 ] = array( 'title' => __( '2 Months', 'booking' ), 'attr' => array( 'class' => 'wpbc_bookingtimeline_matrix' ) ); |
| 151 |
} |
| 152 |
$view_days_optiopns[ 90 ] = array( 'title' => __( '3 Months', 'booking' ), 'attr' => array( 'class' => 'wpbc_bookingtimeline_single' ) ); |
| 153 |
$view_days_optiopns[ 365 ] = array( 'title' => __( 'Year', 'booking' ), 'attr' => array( 'class' => 'wpbc_bookingtimeline_single' ) ); |
| 154 |
|
| 155 |
WPBC_Settings_API::field_radio_row_static( $id . '_months_num_in_row' |
| 156 |
, array( |
| 157 |
'type' => 'radio' |
| 158 |
, 'title' => __('View mode', 'booking') |
| 159 |
, 'description' => __('Select type of view format.' ,'booking') |
| 160 |
, 'description_tag' => 'span' |
| 161 |
, 'label' => '' |
| 162 |
, 'multiple' => false |
| 163 |
, 'group' => $group_key |
| 164 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed0 ' . $id . '_wpbc_sc_view_mode' |
| 165 |
, 'class' => '' |
| 166 |
, 'css' => 'margin-right:10px;' |
| 167 |
, 'only_field' => false |
| 168 |
, 'attr' => array() |
| 169 |
, 'value' => 30 |
| 170 |
, 'options' => $view_days_optiopns |
| 171 |
) |
| 172 |
); |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
/** |
| 177 |
* Shortcode Field: Label - text of label for the select box. |
| 178 |
* |
| 179 |
* @param $id |
| 180 |
* @param $group_key |
| 181 |
* |
| 182 |
* @return void |
| 183 |
*/ |
| 184 |
function wpbc_shortcode_config_fields__text_label_timeline($id , $group_key ){ |
| 185 |
|
| 186 |
WPBC_Settings_API::field_text_row_static( $id |
| 187 |
, array( |
| 188 |
'type' => 'text' |
| 189 |
, 'placeholder' => __( 'Example', 'booking' ). ': ' .__( 'All Bookings', 'booking' ) |
| 190 |
, 'title' => __( 'Label', 'booking' ) |
| 191 |
, 'description' => __( 'Title', 'booking' ) . ' (' . __( 'optional', 'booking' ) . ').' |
| 192 |
, 'description_tag' => 'span' |
| 193 |
, 'label' => '' |
| 194 |
, 'class' => '' |
| 195 |
, 'css' => 'width0:5em;' |
| 196 |
, 'tr_class' => '' |
| 197 |
|
| 198 |
, 'group' => $group_key |
| 199 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed0' |
| 200 |
, 'only_field' => false |
| 201 |
, 'attr' => array() |
| 202 |
, 'value' => '' |
| 203 |
) |
| 204 |
); |
| 205 |
|
| 206 |
} |
| 207 |
|
| 208 |
/** |
| 209 |
* Shortcode Field: Select-box - "Number of days to scroll" |
| 210 |
* |
| 211 |
* @param $id |
| 212 |
* @param $group_key |
| 213 |
* |
| 214 |
* @return void |
| 215 |
*/ |
| 216 |
function wpbc_shortcode_config_fields__select_days_months_to_scroll( $id , $group_key ){ |
| 217 |
|
| 218 |
WPBC_Settings_API::field_select_row_static( $id. '_scroll_days' |
| 219 |
, array( |
| 220 |
'type' => 'select' |
| 221 |
, 'title' => __('Number of days to scroll', 'booking') |
| 222 |
, 'description' => __(' Select number of days to scroll after loading' ,'booking') |
| 223 |
, 'description_tag' => 'span' |
| 224 |
, 'label' => '' |
| 225 |
, 'multiple' => false |
| 226 |
, 'group' => $group_key |
| 227 |
, 'tr_class' => $group_key . '_standard_section wpbc_bookingtimeline_scroll_day wpbc_sub_settings_grayed0' |
| 228 |
, 'class' => '' |
| 229 |
, 'css' => 'margin-right:10px;' |
| 230 |
, 'only_field' => false |
| 231 |
, 'attr' => array() |
| 232 |
, 'value' => 0 |
| 233 |
, 'options' => array_combine( range( -90, 90 ), range( -90, 90 ) ) |
| 234 |
) |
| 235 |
); |
| 236 |
|
| 237 |
WPBC_Settings_API::field_select_row_static( $id . '_scroll_month' |
| 238 |
, array( |
| 239 |
'type' => 'select' |
| 240 |
, 'title' => __('Number of months to scroll', 'booking') |
| 241 |
, 'description' => __('Select number of months to scroll after loading' ,'booking') |
| 242 |
, 'description_tag' => 'span' |
| 243 |
, 'label' => '' |
| 244 |
, 'multiple' => false |
| 245 |
, 'group' => $group_key |
| 246 |
, 'tr_class' => $group_key . '_standard_section wpbc_bookingtimeline_scroll_month wpbc_sub_settings_grayed0' |
| 247 |
, 'class' => '' |
| 248 |
, 'css' => 'margin-right:10px;' |
| 249 |
, 'only_field' => false |
| 250 |
, 'attr' => array() |
| 251 |
, 'value' => 0 |
| 252 |
, 'options' => array_combine( range( -12, 12 ), range( -12, 12 ) ) |
| 253 |
) |
| 254 |
); |
| 255 |
|
| 256 |
} |
| 257 |
|
| 258 |
|
| 259 |
/** |
| 260 |
* Shortcode Fields: Start Date: 2024-02-21 |
| 261 |
* |
| 262 |
* @param $id |
| 263 |
* @param $group_key |
| 264 |
* |
| 265 |
* @return void |
| 266 |
*/ |
| 267 |
function wpbc_shortcode_config_fields__start_date_timeline( $id , $group_key ){ |
| 268 |
|
| 269 |
//////////////////////////////////////////////////////////////////// |
| 270 |
// Start Month |
| 271 |
//////////////////////////////////////////////////////////////////// |
| 272 |
?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_sub_settings_grayed0"> |
| 273 |
<th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php esc_html_e('Start date:', 'booking'); ?></label></th> |
| 274 |
<td class=""><fieldset><?php |
| 275 |
|
| 276 |
WPBC_Settings_API::field_checkbox_row_static( $id . '_active' |
| 277 |
, array( |
| 278 |
'type' => 'checkbox' |
| 279 |
, 'title' => '' |
| 280 |
, 'description' => '' |
| 281 |
, 'description_tag' => 'span' |
| 282 |
, 'label' => '' |
| 283 |
, 'class' => '' |
| 284 |
, 'css' => '' |
| 285 |
, 'tr_class' => '' |
| 286 |
, 'attr' => array() |
| 287 |
, 'group' => $group_key |
| 288 |
, 'only_field' => true |
| 289 |
, 'is_new_line' => false |
| 290 |
, 'value' => false |
| 291 |
) |
| 292 |
); |
| 293 |
|
| 294 |
WPBC_Settings_API::field_select_row_static( $id . '_year' |
| 295 |
, array( |
| 296 |
'type' => 'select' |
| 297 |
, 'title' => '' |
| 298 |
, 'description' => '' |
| 299 |
, 'description_tag' => 'span' |
| 300 |
, 'label' => '' |
| 301 |
, 'multiple' => false |
| 302 |
, 'group' => $group_key |
| 303 |
, 'class' => '' |
| 304 |
, 'css' => 'width:5em;' |
| 305 |
, 'only_field' => true |
| 306 |
, 'attr' => array() |
| 307 |
, 'value' => gmdate( 'Y' ) |
| 308 |
, 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) ) |
| 309 |
) |
| 310 |
); |
| 311 |
|
| 312 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php |
| 313 |
|
| 314 |
WPBC_Settings_API::field_select_row_static( $id . '_month' |
| 315 |
, array( |
| 316 |
'type' => 'select' |
| 317 |
, 'title' => '' |
| 318 |
, 'description' => '' |
| 319 |
, 'description_tag' => 'span' |
| 320 |
, 'label' => '' |
| 321 |
, 'multiple' => false |
| 322 |
, 'group' => $group_key |
| 323 |
, 'class' => '' |
| 324 |
, 'css' => 'width:4em;' |
| 325 |
, 'only_field' => true |
| 326 |
, 'attr' => array() |
| 327 |
, 'value' => gmdate('n') |
| 328 |
, 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) ) |
| 329 |
) |
| 330 |
); |
| 331 |
|
| 332 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php |
| 333 |
|
| 334 |
WPBC_Settings_API::field_select_row_static( $id . '_day' |
| 335 |
, array( |
| 336 |
'type' => 'select' |
| 337 |
, 'title' => '' |
| 338 |
, 'description' => '' |
| 339 |
, 'description_tag' => 'span' |
| 340 |
, 'label' => '' |
| 341 |
, 'multiple' => false |
| 342 |
, 'group' => $group_key |
| 343 |
, 'class' => '' |
| 344 |
, 'css' => 'width:4em;' |
| 345 |
, 'only_field' => true |
| 346 |
, 'attr' => array() |
| 347 |
, 'value' => gmdate('j') |
| 348 |
, 'options' => array_combine( range( 1, 31 ), range( 1, 31 ) ) |
| 349 |
) |
| 350 |
); |
| 351 |
|
| 352 |
?><span class="description"> <?php esc_html_e('Select start date' ,'booking'); ?></span></fieldset></td> |
| 353 |
</tr><?php |
| 354 |
|
| 355 |
} |
| 356 |
|
| 357 |
|
| 358 |
/** |
| 359 |
* Shortcode Fields: show times 0 - 23 |
| 360 |
* |
| 361 |
* @param $id |
| 362 |
* @param $group_key |
| 363 |
* |
| 364 |
* @return void |
| 365 |
*/ |
| 366 |
function wpbc_shortcode_config_fields__start_end_time_timeline( $id , $group_key ){ |
| 367 |
|
| 368 |
//////////////////////////////////////////////////////////////////// |
| 369 |
// Start Month |
| 370 |
//////////////////////////////////////////////////////////////////// |
| 371 |
?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_sub_settings_grayed0 bookingtimeline_view_times"> |
| 372 |
<th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php esc_html_e('Show:', 'booking'); ?></label></th> |
| 373 |
<td class=""><fieldset><?php |
| 374 |
|
| 375 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> <?php esc_html_e('from', 'booking' ); ?> </span><?php |
| 376 |
|
| 377 |
WPBC_Settings_API::field_select_row_static( $id . '_starttime' |
| 378 |
, array( |
| 379 |
'type' => 'select' |
| 380 |
, 'title' => '' |
| 381 |
, 'description' => '' |
| 382 |
, 'description_tag' => 'span' |
| 383 |
, 'label' => '' |
| 384 |
, 'multiple' => false |
| 385 |
, 'group' => $group_key |
| 386 |
, 'class' => '' |
| 387 |
, 'css' => 'width:4em;' |
| 388 |
, 'only_field' => true |
| 389 |
, 'attr' => array() |
| 390 |
, 'value' => 0 |
| 391 |
, 'options' => array_combine( range( 0, 23 ), range( 0, 23 ) ) |
| 392 |
) |
| 393 |
); |
| 394 |
|
| 395 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> <?php esc_html_e('to', 'booking' ); ?> </span><?php |
| 396 |
|
| 397 |
WPBC_Settings_API::field_select_row_static( $id . '_endtime' |
| 398 |
, array( |
| 399 |
'type' => 'select' |
| 400 |
, 'title' => '' |
| 401 |
, 'description' => '' |
| 402 |
, 'description_tag' => 'span' |
| 403 |
, 'label' => '' |
| 404 |
, 'multiple' => false |
| 405 |
, 'group' => $group_key |
| 406 |
, 'class' => '' |
| 407 |
, 'css' => 'width:4em;' |
| 408 |
, 'only_field' => true |
| 409 |
, 'attr' => array() |
| 410 |
, 'value' => 24 |
| 411 |
, 'options' => array_combine( range( 1, 24 ), range( 1, 24 ) ) |
| 412 |
) |
| 413 |
); |
| 414 |
|
| 415 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> <?php esc_html_e('hours', 'booking' ); ?> </span><?php |
| 416 |
|
| 417 |
?></fieldset></td> |
| 418 |
</tr><?php |
| 419 |
|
| 420 |
} |
| 421 |
|