| 1 |
<?php /** |
| 2 |
* @version 1.0 |
| 3 |
* @package Booking Calendar |
| 4 |
* @category Toolbar. Data for UI Elements at Booking Calendar admin pages |
| 5 |
* @author wpdevelop |
| 6 |
* |
| 7 |
* @web-site https://wpbookingcalendar.com/ |
| 8 |
* @email info@wpbookingcalendar.com |
| 9 |
* |
| 10 |
* @modified 2015-11-16 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit, if accessed directly |
| 14 |
|
| 15 |
|
| 16 |
// --------------------------------------------------------------------------------------------------------------------- |
| 17 |
// == T o o l b a r s == |
| 18 |
// --------------------------------------------------------------------------------------------------------------------- |
| 19 |
|
| 20 |
|
| 21 |
/** T o o l b a r C o n t a i n e r f o r Add New Booking */ |
| 22 |
function wpbc_add_new_booking_toolbar( $args = array() ) { |
| 23 |
|
| 24 |
$defaults = array( |
| 25 |
'resource_id' => null, |
| 26 |
'booking_form' => null, |
| 27 |
); |
| 28 |
$args = wp_parse_args( $args, $defaults ); |
| 29 |
|
| 30 |
wpbc_clear_div(); |
| 31 |
|
| 32 |
// Toolbar //////////////////////////////////////////////////////////////// |
| 33 |
|
| 34 |
?><div id="toolbar_booking_listing" style="position:relative;"><?php |
| 35 |
|
| 36 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 37 |
|
| 38 |
// <editor-fold defaultstate="collapsed" desc=" T O P T A B s " > |
| 39 |
|
| 40 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 41 |
if ( ! isset( $_REQUEST['toolbar'] ) ) $_REQUEST['toolbar'] = 'filter'; |
| 42 |
$selected_tab = sanitize_text_field( wp_unslash( $_REQUEST['toolbar'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 43 |
|
| 44 |
wpbc_bs_display_tab( array( |
| 45 |
'title' => __('Options', 'booking') |
| 46 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 47 |
, 'onclick' => "jQuery('.visibility_container').hide();" |
| 48 |
. "jQuery('#filter_toolbar_container').show();" |
| 49 |
. "jQuery('#toolbar_booking_listing .nav-tab').removeClass('nav-tab-active');" // FixIn: 9.8.15.2. |
| 50 |
. "jQuery(this).addClass('nav-tab-active');" |
| 51 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 52 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 53 |
, 'font_icon' => 'wpbc_icn_adjust' |
| 54 |
, 'default' => ( $selected_tab == 'filter' ) ? true : false |
| 55 |
|
| 56 |
) ); |
| 57 |
|
| 58 |
wpbc_bs_display_tab( array( |
| 59 |
'title' => __('Calendar View', 'booking') |
| 60 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 61 |
, 'onclick' => "jQuery('.visibility_container').hide();" |
| 62 |
. "jQuery('#calendar_size_toolbar_container').show();" |
| 63 |
. "jQuery('#toolbar_booking_listing .nav-tab').removeClass('nav-tab-active');" // FixIn: 9.8.15.2. |
| 64 |
. "jQuery(this).addClass('nav-tab-active');" |
| 65 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 66 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 67 |
, 'font_icon' => 'wpbc-bi-calendar2' |
| 68 |
, 'default' => ( $selected_tab == 'calendar' ) ? true : false |
| 69 |
|
| 70 |
) ); |
| 71 |
|
| 72 |
|
| 73 |
wpbc_bs_dropdown_menu_help(); |
| 74 |
|
| 75 |
// </editor-fold> |
| 76 |
|
| 77 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 78 |
|
| 79 |
//////////////////////////////////////////////////////////////////////// |
| 80 |
|
| 81 |
wpbc_bs_toolbar_sub_html_container_start(); |
| 82 |
|
| 83 |
// T o o l b a r |
| 84 |
?><div id="filter_toolbar_container" class="visibility_container clearfix-height" style="display:<?php echo ( $selected_tab == 'filter' ) ? 'block' : 'none' ?>;margin-top:-5px;"><?php |
| 85 |
|
| 86 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 87 |
if ( ( function_exists( 'wpbc_toolbar_btn__resource_selection' ) ) && ( empty( $_GET['booking_hash'] ) ) ) { |
| 88 |
// Do not show resource seleciton if editing booking. // FixIn: 7.1.2.10. |
| 89 |
|
| 90 |
wpbc_toolbar_btn__resource_selection(); |
| 91 |
} |
| 92 |
|
| 93 |
WPBC_FE_Custom_Form_Helper::wpbc_bfb__custom_booking_forms_list__selectbox_html(); |
| 94 |
|
| 95 |
//////////////////////////////////////////////////////////////////// |
| 96 |
?><div class="clear-for-mobile"></div><?php |
| 97 |
|
| 98 |
?><div class="control-group wpbc-no-padding" style="float:right;margin-right: 0;margin-left: 15px;"><?php |
| 99 |
|
| 100 |
wpbc_toolbar_btn__add_past_booking( $args ); |
| 101 |
|
| 102 |
if ( function_exists( 'wpbc_toolbar_btn__auto_fill' ) ) { |
| 103 |
wpbc_toolbar_btn__auto_fill(); |
| 104 |
} |
| 105 |
|
| 106 |
wpbc_toolbar_btn__add_new_booking( $args ); |
| 107 |
|
| 108 |
?></div><?php |
| 109 |
//////////////////////////////////////////////////////////////////// |
| 110 |
|
| 111 |
?></div><?php |
| 112 |
?><div id="calendar_size_toolbar_container" class="visibility_container clearfix-height" style="display:<?php echo ( $selected_tab == 'calendar_size' ) ? 'block' : 'none' ?>;margin-top:-5px;"><?php |
| 113 |
/* |
| 114 |
?><span class="advanced_booking_filter" style="display:none;"><div class="clear" style="width:100%;border-bottom:1px solid #ccc;height:10px;"></div><?php |
| 115 |
*/ |
| 116 |
// Get possible saved previous "Custom User Calendar data" |
| 117 |
$user_calendar_options = get_user_option( 'booking_custom_' . 'add_booking_calendar_options', wpbc_get_current_user_id() ); |
| 118 |
|
| 119 |
if ( $user_calendar_options === false ) { // Default, if no saved previously. |
| 120 |
$user_calendar_options = array(); |
| 121 |
$user_calendar_options['calendar_months_count'] = 1; |
| 122 |
$user_calendar_options['calendar_months_num_in_1_row'] = 0 ; |
| 123 |
$user_calendar_options['calendar_width'] = ''; |
| 124 |
$user_calendar_options['calendar_widthunits'] = 'px'; |
| 125 |
$user_calendar_options['calendar_cell_height'] = ''; |
| 126 |
$user_calendar_options['calendar_cell_heightunits'] = 'px'; |
| 127 |
} else { |
| 128 |
$user_calendar_options = maybe_unserialize( $user_calendar_options ); |
| 129 |
} |
| 130 |
|
| 131 |
wpbc_toolbar_btn__calendar_months_number_selection( $user_calendar_options ); |
| 132 |
|
| 133 |
wpbc_toolbar_btn__calendar_months_num_in_1_row_selection( $user_calendar_options ); |
| 134 |
|
| 135 |
wpbc_toolbar_btn__calendar_width( $user_calendar_options ); |
| 136 |
|
| 137 |
wpbc_toolbar_btn__calendar_cell_height( $user_calendar_options ); |
| 138 |
|
| 139 |
wpbc_toolbar_btn__calendar_options_save(); |
| 140 |
|
| 141 |
wpbc_toolbar_btn__calendar_options_reset(); |
| 142 |
/* |
| 143 |
?><div class="clear"></div></span><?php |
| 144 |
|
| 145 |
|
| 146 |
wpbc_clear_div(); |
| 147 |
|
| 148 |
wpbc_toolbar_expand_collapse_btn( 'advanced_booking_filter' ); |
| 149 |
*/ |
| 150 |
?></div><?php |
| 151 |
|
| 152 |
|
| 153 |
wpbc_bs_toolbar_sub_html_container_end(); |
| 154 |
|
| 155 |
wpbc_toolbar_is_send_emails_btn(); |
| 156 |
|
| 157 |
?></div><?php |
| 158 |
|
| 159 |
wpbc_clear_div(); |
| 160 |
|
| 161 |
} |
| 162 |
|
| 163 |
|
| 164 |
// --------------------------------------------------------------------------------------------------------------------- |
| 165 |
// HTML elements for Toolbar |
| 166 |
// --------------------------------------------------------------------------------------------------------------------- |
| 167 |
|
| 168 |
/** |
| 169 |
* Expand or Collapse Advanced Filter set |
| 170 |
* |
| 171 |
* @param string $css_class_of_expand_element - CSS Class of element section to show or hide |
| 172 |
*/ |
| 173 |
function wpbc_toolbar_expand_collapse_btn( $css_class_of_expand_element ) { |
| 174 |
|
| 175 |
?><span id="show_link_advanced_booking_filter" class="tab-bottom tooltip_right advanced_booking_filter" |
| 176 |
title="<?php esc_attr_e('Expand Advanced Toolbar' ,'booking'); ?>" |
| 177 |
><a href="javascript:void(0)" |
| 178 |
onclick="javascript:jQuery('.<?php echo esc_js( $css_class_of_expand_element ); ?>').show(); |
| 179 |
jQuery('#show_link_advanced_booking_filter').hide(); |
| 180 |
jQuery('#hide_link_advanced_booking_filter').show();"><i |
| 181 |
class="wpbc_icn_expand_more"></i></a></span> |
| 182 |
<span id="hide_link_advanced_booking_filter" class="tab-bottom tooltip_right advanced_booking_filter" style="display:none;" |
| 183 |
title="<?php esc_attr_e('Collapse Advanced Toolbar' ,'booking'); ?>" |
| 184 |
><a href="javascript:void(0)" |
| 185 |
onclick="javascript:jQuery('.<?php echo esc_js( $css_class_of_expand_element ); ?>').hide(); |
| 186 |
jQuery('#hide_link_advanced_booking_filter').hide(); |
| 187 |
jQuery('#show_link_advanced_booking_filter').show();"><i |
| 188 |
class="wpbc_icn_expand_less"></i></a></span><?php |
| 189 |
|
| 190 |
} |
| 191 |
|
| 192 |
|
| 193 |
/** |
| 194 |
* Checkbox - sending emails or not |
| 195 |
* |
| 196 |
* @param $style Styles of this element group |
| 197 |
* |
| 198 |
* @return void |
| 199 |
*/ |
| 200 |
function wpbc_toolbar_is_send_emails_btn( $style = 'position:absolute;right:0px;margin-top:10px;' ) { |
| 201 |
|
| 202 |
?><div class="btn-group" style="<?php echo esc_attr( $style ); ?>"><?php |
| 203 |
|
| 204 |
$el_id = 'is_send_email_for_pending'; |
| 205 |
|
| 206 |
$el_value = ( get_bk_option( 'booking_send_emails_off_addbooking' ) !== 'On' ) ? 'On' : 'Off'; |
| 207 |
|
| 208 |
$params_checkbox = array( |
| 209 |
'id' => $el_id // HTML ID of element |
| 210 |
, 'name' => $el_id |
| 211 |
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5. |
| 212 |
, 'style' => '' // CSS of select element |
| 213 |
, 'class' => '' // CSS Class of select element |
| 214 |
, 'disabled' => false |
| 215 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 216 |
, 'legend' => '' // aria-label parameter |
| 217 |
, 'value' => $el_value // Some Value from optins array that selected by default |
| 218 |
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not |
| 219 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 220 |
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code |
| 221 |
, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' ) |
| 222 |
); |
| 223 |
|
| 224 |
wpbc_flex_toggle( $params_checkbox ); |
| 225 |
|
| 226 |
?></div><?php |
| 227 |
} |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
// --------------------------------------------------------------------------------------------------------------------- |
| 232 |
// U I E l e m e n t s |
| 233 |
// --------------------------------------------------------------------------------------------------------------------- |
| 234 |
|
| 235 |
/** Help - Drop Down Menu - T a b */ |
| 236 |
function wpbc_bs_dropdown_menu_help() { |
| 237 |
|
| 238 |
wpbc_bs_dropdown_menu( array( |
| 239 |
'title' => __( 'Help', 'booking' ) |
| 240 |
, 'font_icon' => 'wpbc_icn_support' //FixIn: 9.0.1.4 'glyphicon glyphicon-question-sign' |
| 241 |
, 'position' => 'right' |
| 242 |
, 'items' => array( |
| 243 |
array( 'type' => 'link', 'title' => __('FAQ', 'booking'), 'url' => 'https://wpbookingcalendar.com/faq/' ) |
| 244 |
, array( 'type' => 'link', 'title' => __('Support Forum', 'booking'), 'url' => 'https://wpbookingcalendar.com/support/' ) |
| 245 |
, array( 'type' => 'divider' ) |
| 246 |
, array( 'type' => 'link', 'title' => __('Contact Support', 'booking'), 'url' => 'mailto:support@wpbookingcalendar.com' |
| 247 |
, 'attr' => array( 'style' => 'font-weight: 600;' ) ) |
| 248 |
, array( 'type' => 'divider' ) |
| 249 |
, array( 'type' => 'link', 'title' => "What's New"/*__('Get Started')*/, 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) ) ) |
| 250 |
, array( 'type' => 'link', 'title' => __('About', 'booking') |
| 251 |
// , 'url' => wpbc_up_link() |
| 252 |
, 'url' => 'https://wpbookingcalendar.com/' //esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about-premium' ), 'index.php' ) ) ) |
| 253 |
, 'attr' => array( |
| 254 |
// 'target' => '_blank' |
| 255 |
// 'style' => 'font-weight: 600;' |
| 256 |
) |
| 257 |
) |
| 258 |
) |
| 259 |
) ); |
| 260 |
} |
| 261 |
|
| 262 |
|
| 263 |
// --------------------------------------------------------------------------------------------------------------------- |
| 264 |
// Toolbar Actions B u t t o n s - T i m e l i n e ////////////////// |
| 265 |
// --------------------------------------------------------------------------------------------------------------------- |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
/** Navigation Timeline - B u t t o n s */ |
| 271 |
function wpbc_toolbar_btn__timeline_navigation() { |
| 272 |
|
| 273 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 274 |
if ((isset($_REQUEST['wh_booking_type'])) && ( strpos($_REQUEST['wh_booking_type'], ',') !== false ) ) |
| 275 |
$is_show_resources_matrix = true; |
| 276 |
else $is_show_resources_matrix = false; |
| 277 |
|
| 278 |
|
| 279 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 280 |
if ( isset( $_REQUEST['view_days_num'] ) ) |
| 281 |
$view_days_num = intval( $_REQUEST['view_days_num'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 282 |
else $view_days_num = get_bk_option( 'booking_view_days_num'); |
| 283 |
|
| 284 |
|
| 285 |
$bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ), array('scroll_month', 'scroll_day') ); |
| 286 |
//debuge($_REQUEST, $bk_admin_url); |
| 287 |
|
| 288 |
// Get Data For buttons |
| 289 |
if (! $is_show_resources_matrix) { |
| 290 |
|
| 291 |
switch ($view_days_num) { |
| 292 |
case '90': |
| 293 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 294 |
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 295 |
else $scroll_day = 0; |
| 296 |
$scroll_params = array( '&scroll_day='.intval($scroll_day-4*7), |
| 297 |
'&scroll_day='.intval($scroll_day-7), |
| 298 |
'&scroll_day=0', |
| 299 |
'&scroll_day='.intval($scroll_day+7 ), |
| 300 |
'&scroll_day='.intval($scroll_day+4*7) ); |
| 301 |
$scroll_titles = array( __('Previous 4 weeks' ,'booking'), |
| 302 |
__('Previous week' ,'booking'), |
| 303 |
__('Current week' ,'booking'), |
| 304 |
__('Next week' ,'booking'), |
| 305 |
__('Next 4 weeks' ,'booking') ); |
| 306 |
break; |
| 307 |
case '30': |
| 308 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 309 |
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 310 |
else $scroll_day = 0; |
| 311 |
|
| 312 |
// FixIn: 8.9.4.3. |
| 313 |
// Here we need to define number of days to scroll depends from selected number of days to show. |
| 314 |
$days_num_to_scroll = intval( get_bk_option( 'booking_calendar_overview__day_mode__days_number_show' ) );; |
| 315 |
if ( empty( $days_num_to_scroll ) ) { |
| 316 |
$days_num_to_scroll = 7; |
| 317 |
} |
| 318 |
|
| 319 |
$scroll_params = array( '&scroll_day='.intval( $scroll_day - $days_num_to_scroll * 2 ), |
| 320 |
'&scroll_day='.intval( $scroll_day - $days_num_to_scroll ), |
| 321 |
'&scroll_day=0', |
| 322 |
'&scroll_day='.intval( $scroll_day + $days_num_to_scroll ), |
| 323 |
'&scroll_day='.intval( $scroll_day + $days_num_to_scroll *2 ) ); |
| 324 |
$scroll_titles = array( __( 'Previous', 'booking' ) . ' ' . ( 2 * $days_num_to_scroll ) . ' ' . __( 'days', 'booking' ), |
| 325 |
__( 'Previous', 'booking' ) . ' ' . $days_num_to_scroll . ' ' . __( 'days', 'booking' ), |
| 326 |
__('Current week' ,'booking'), |
| 327 |
__( 'Next', 'booking' ) . ' ' . $days_num_to_scroll . ' ' . __( 'days', 'booking' ), |
| 328 |
__( 'Next', 'booking' ) . ' ' . ( 2 * $days_num_to_scroll ) . ' ' . __( 'days', 'booking' ) ); |
| 329 |
break; |
| 330 |
default: // 365 |
| 331 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 332 |
if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0; |
| 333 |
$scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 334 |
$scroll_params = array( '&scroll_month='.intval($scroll_month-3), |
| 335 |
'&scroll_month='.intval($scroll_month-1), |
| 336 |
'&scroll_month=0', |
| 337 |
'&scroll_month='.intval($scroll_month+1 ), |
| 338 |
'&scroll_month='.intval($scroll_month+3) ); |
| 339 |
$scroll_titles = array( __('Previous 3 months' ,'booking'), |
| 340 |
__('Previous month' ,'booking'), |
| 341 |
__('Current month' ,'booking'), |
| 342 |
__('Next month' ,'booking'), |
| 343 |
__('Next 3 months' ,'booking') ); |
| 344 |
break; |
| 345 |
} |
| 346 |
} else { // Matrix |
| 347 |
|
| 348 |
switch ($view_days_num) { |
| 349 |
case '1': //Day |
| 350 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 351 |
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 352 |
else $scroll_day = 0; |
| 353 |
$scroll_params = array( '&scroll_day='.intval($scroll_day-7), |
| 354 |
'&scroll_day='.intval($scroll_day-1), |
| 355 |
'&scroll_day=0', |
| 356 |
'&scroll_day='.intval($scroll_day+1 ), |
| 357 |
'&scroll_day='.intval($scroll_day+7) ); |
| 358 |
$scroll_titles = array( __('Previous 7 days' ,'booking'), |
| 359 |
__('Previous day' ,'booking'), |
| 360 |
__('Current day' ,'booking'), |
| 361 |
__('Next day' ,'booking'), |
| 362 |
__('Next 7 days' ,'booking') ); |
| 363 |
break; |
| 364 |
|
| 365 |
case '7': //Week |
| 366 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 367 |
if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 368 |
else $scroll_day = 0; |
| 369 |
$scroll_params = array( '&scroll_day='.intval($scroll_day-4*7), |
| 370 |
'&scroll_day='.intval($scroll_day-7), |
| 371 |
'&scroll_day=0', |
| 372 |
'&scroll_day='.intval($scroll_day+7 ), |
| 373 |
'&scroll_day='.intval($scroll_day+4*7) ); |
| 374 |
$scroll_titles = array( __('Previous 4 weeks' ,'booking'), |
| 375 |
__('Previous week' ,'booking'), |
| 376 |
__('Current week' ,'booking'), |
| 377 |
__('Next week' ,'booking'), |
| 378 |
__('Next 4 weeks' ,'booking') ); |
| 379 |
break; |
| 380 |
|
| 381 |
case '30': |
| 382 |
case '60': |
| 383 |
case '90': //3 months |
| 384 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 385 |
if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0; |
| 386 |
$scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 387 |
$scroll_params = array( '&scroll_month='.intval($scroll_month-3), |
| 388 |
'&scroll_month='.intval($scroll_month-1), |
| 389 |
'&scroll_month=0', |
| 390 |
'&scroll_month='.intval($scroll_month+1 ), |
| 391 |
'&scroll_month='.intval($scroll_month+3) ); |
| 392 |
$scroll_titles = array( __('Previous 3 months' ,'booking'), |
| 393 |
__('Previous month' ,'booking'), |
| 394 |
__('Current month' ,'booking'), |
| 395 |
__('Next month' ,'booking'), |
| 396 |
__('Next 3 months' ,'booking') ); |
| 397 |
break; |
| 398 |
|
| 399 |
default: // 30, 60, 90... |
| 400 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 401 |
if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0; |
| 402 |
$scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 403 |
$scroll_params = array( '&scroll_month='.intval($scroll_month-3), |
| 404 |
'&scroll_month='.intval($scroll_month-1), |
| 405 |
'&scroll_month=0', |
| 406 |
'&scroll_month='.intval($scroll_month+1 ), |
| 407 |
'&scroll_month='.intval($scroll_month+3) ); |
| 408 |
$scroll_titles = array( __('Previous 3 months' ,'booking'), |
| 409 |
__('Previous month' ,'booking'), |
| 410 |
__('Current month' ,'booking'), |
| 411 |
__('Next month' ,'booking'), |
| 412 |
__('Next 3 months' ,'booking') ); |
| 413 |
break; |
| 414 |
} |
| 415 |
} |
| 416 |
|
| 417 |
|
| 418 |
$params = array( |
| 419 |
'label_for' => 'calendar_overview_navigation' // "For" parameter of button group element |
| 420 |
, 'label' => '' //__('Calendar Navigation', 'booking') // Label above the button group |
| 421 |
, 'style' => '' // CSS Style of entire div element |
| 422 |
, 'items' => array( |
| 423 |
array( |
| 424 |
'type' => 'button' |
| 425 |
, 'title' => '' // Title of the button |
| 426 |
, 'hint' => array( 'title' => $scroll_titles[0] , 'position' => 'top' ) // Hint |
| 427 |
, 'link' => $bk_admin_url .$scroll_params[0] // Direct link or skip it |
| 428 |
, 'action' => "" // Some JavaScript to execure, for example run the function |
| 429 |
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary |
| 430 |
, 'icon' => '' |
| 431 |
, 'font_icon' => 'wpbc_icn_keyboard_double_arrow_left' |
| 432 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 433 |
, 'style' => '' // Any CSS class here |
| 434 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 435 |
, 'attr' => array() |
| 436 |
) |
| 437 |
, array( |
| 438 |
'type' => 'button' |
| 439 |
, 'title' => '' // Title of the button |
| 440 |
, 'hint' => array( 'title' => $scroll_titles[1] , 'position' => 'top' ) // Hint |
| 441 |
, 'link' => $bk_admin_url .$scroll_params[1] // Direct link or skip it |
| 442 |
, 'action' => "" // Some JavaScript to execure, for example run the function |
| 443 |
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary |
| 444 |
, 'icon' => '' |
| 445 |
, 'font_icon' => 'wpbc_icn_keyboard_arrow_left' |
| 446 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 447 |
, 'style' => '' // Any CSS class here |
| 448 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 449 |
, 'attr' => array() |
| 450 |
) |
| 451 |
, array( |
| 452 |
'type' => 'dropdown' |
| 453 |
, 'id' => 'timeline_navigation_date' |
| 454 |
, 'title' => '' // Title of the button |
| 455 |
, 'hint' => array( 'title' => __('Custom' ,'booking') , 'position' => 'top' ) // Hint |
| 456 |
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary |
| 457 |
, 'icon' => '' |
| 458 |
, 'font_icon' => 'wpbc_icn_gps_fixed' |
| 459 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 460 |
, 'style' => '' // Any CSS class here |
| 461 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 462 |
, 'attr' => array() |
| 463 |
, 'options' => array( |
| 464 |
$scroll_titles[2] => "window.location.href='" |
| 465 |
. wpbc_get_params_in_url( wpbc_get_bookings_url( false ) |
| 466 |
, array('scroll_month', 'scroll_day', 'scroll_start_date') ) |
| 467 |
. $scroll_params[2] . "'" |
| 468 |
, 'divider1' => 'divider' |
| 469 |
, 'custom' => array( array( 'type' => 'group', 'class' => 'input-group text-group') |
| 470 |
, array( |
| 471 |
'type' => 'text' |
| 472 |
, 'id' => 'calendar_overview_navigation_currentdate' |
| 473 |
, 'name' => 'calendar_overview_navigation_currentdate' |
| 474 |
, 'label' => __('Start Date' ,'booking') . ':' |
| 475 |
, 'disabled' => false |
| 476 |
, 'class' => 'wpdevbk-filters-section-calendar' |
| 477 |
, 'style' => '' |
| 478 |
, 'placeholder' => gmdate('Y-m-d') |
| 479 |
, 'attr' => array() |
| 480 |
, 'value' => '' |
| 481 |
) |
| 482 |
) |
| 483 |
, 'divider2' => 'divider' |
| 484 |
, 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group0', 'style'=>'display: flex;flex-flow: row nowrap;align-items: center;justify-content: flex-end;' ), |
| 485 |
array( |
| 486 |
'type' => 'button' |
| 487 |
, 'title' => __('Apply' ,'booking') // Title of the button |
| 488 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 489 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 490 |
, 'action' => "jQuery('#calendar_overview_navigation_container').hide(); |
| 491 |
window.location.href='" |
| 492 |
. wpbc_get_params_in_url( wpbc_get_bookings_url( false ) |
| 493 |
, array('scroll_month', 'scroll_day', 'scroll_start_date') ) |
| 494 |
. "&scroll_start_date=' + jQuery('#calendar_overview_navigation_currentdate').val();" |
| 495 |
|
| 496 |
, 'class' => 'button-primary' // button-secondary | button-primary |
| 497 |
, 'icon' => '' |
| 498 |
, 'font_icon' => '' |
| 499 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 500 |
, 'style' => '' // Any CSS class here |
| 501 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 502 |
, 'attr' => array() |
| 503 |
|
| 504 |
) |
| 505 |
, array( |
| 506 |
'type' => 'button' |
| 507 |
, 'title' => __('Close' ,'booking') // Title of the button |
| 508 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 509 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 510 |
//, 'action' => '' // Some JavaScript to execure, for example run the function |
| 511 |
, 'class' => 'button-secondary' // button-secondary | button-primary |
| 512 |
, 'icon' => '' |
| 513 |
, 'font_icon' => '' |
| 514 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 515 |
, 'style' => 'margin:0 10px;' // Any CSS class here |
| 516 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 517 |
, 'attr' => array() |
| 518 |
) |
| 519 |
) |
| 520 |
) |
| 521 |
) |
| 522 |
, array( |
| 523 |
'type' => 'button' |
| 524 |
, 'title' => '' // Title of the button |
| 525 |
, 'hint' => array( 'title' => $scroll_titles[3] , 'position' => 'top' ) // Hint |
| 526 |
, 'link' => $bk_admin_url .$scroll_params[3] // Direct link or skip it |
| 527 |
, 'action' => "" // Some JavaScript to execure, for example run the function |
| 528 |
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary |
| 529 |
, 'icon' => '' |
| 530 |
, 'font_icon' => 'wpbc_icn_keyboard_arrow_right' |
| 531 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 532 |
, 'style' => '' // Any CSS class here |
| 533 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 534 |
, 'attr' => array() |
| 535 |
) |
| 536 |
, array( |
| 537 |
'type' => 'button' |
| 538 |
, 'title' => '' // Title of the button |
| 539 |
, 'hint' => array( 'title' => $scroll_titles[4] , 'position' => 'top' ) // Hint |
| 540 |
, 'link' => $bk_admin_url .$scroll_params[4] // Direct link or skip it |
| 541 |
, 'action' => "" // Some JavaScript to execure, for example run the function |
| 542 |
, 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary |
| 543 |
, 'icon' => '' |
| 544 |
, 'font_icon' => 'wpbc_icn_keyboard_double_arrow_right' |
| 545 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 546 |
, 'style' => '' // Any CSS class here |
| 547 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 548 |
, 'attr' => array() |
| 549 |
) |
| 550 |
) |
| 551 |
); |
| 552 |
|
| 553 |
wpbc_bs_button_group( $params ); |
| 554 |
} |
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
// --------------------------------------------------------------------------------------------------------------------- |
| 559 |
// Toolbar Options B u t t o n s - Add New Booking ////////////////// |
| 560 |
// --------------------------------------------------------------------------------------------------------------------- |
| 561 |
|
| 562 |
/** Genereate URL based on GET parameters */ |
| 563 |
function wpbc_get_new_booking_url__base( $skip_parameters = array() ) { |
| 564 |
|
| 565 |
$link_base = wpbc_get_new_booking_url( true, false ); |
| 566 |
|
| 567 |
$link_params = array(); |
| 568 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 569 |
if ( ( isset( $_GET['booking_type'] ) ) && ( $_GET['booking_type'] > 0 ) ) $link_params['booking_type'] = sanitize_text_field( wp_unslash( $_GET['booking_type'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 570 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 571 |
if ( isset( $_GET['booking_hash'] ) ) $link_params['booking_hash'] = sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 572 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 573 |
if ( isset( $_GET['parent_res'] ) ) $link_params['parent_res'] = sanitize_text_field( wp_unslash( $_GET['parent_res'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 574 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 575 |
if ( isset( $_GET['booking_form'] ) ) $link_params['booking_form'] = sanitize_text_field( wp_unslash( $_GET['booking_form'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 576 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 577 |
if ( isset( $_GET['calendar_months_count'] ) ) $link_params['calendar_months_count'] = intval( $_GET['calendar_months_count'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 578 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 579 |
if ( isset( $_GET['calendar_months_num_in_1_row'] ) ) $link_params['calendar_months_num_in_1_row'] = intval( $_GET['calendar_months_num_in_1_row'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 580 |
|
| 581 |
|
| 582 |
foreach ( $link_params as $key => $value ) { |
| 583 |
|
| 584 |
if ( ! in_array( $key, $skip_parameters) ) { |
| 585 |
$link_base .= '&' . $key . '=' . $value; |
| 586 |
} |
| 587 |
} |
| 588 |
|
| 589 |
return $link_base; |
| 590 |
} |
| 591 |
|
| 592 |
/** Selection Number of visible months */ |
| 593 |
function wpbc_toolbar_btn__calendar_months_number_selection( $user_calendar_options = array() ) { |
| 594 |
|
| 595 |
$text_label = __('Visible months' ,'booking') .':' ; |
| 596 |
|
| 597 |
$form_options = array( 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12 ); |
| 598 |
|
| 599 |
$parameter_name = 'calendar_months_count'; |
| 600 |
|
| 601 |
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval ( $user_calendar_options[ $parameter_name ] ); |
| 602 |
else $selected_value = 1; |
| 603 |
|
| 604 |
$link_base = wpbc_get_new_booking_url__base( array( $parameter_name ) ) . '&' . $parameter_name . '=' ; |
| 605 |
|
| 606 |
$on_change = ''; //'location.href=\'' . $link_base . '\' + this.value;'; |
| 607 |
|
| 608 |
|
| 609 |
$params = array( |
| 610 |
'label_for' => $parameter_name // "For" parameter of label element |
| 611 |
, 'label' => '' // Label above the input group |
| 612 |
, 'style' => '' // CSS Style of entire div element |
| 613 |
, 'items' => array( |
| 614 |
array( |
| 615 |
'type' => 'addon' |
| 616 |
, 'element' => 'text' // text | radio | checkbox |
| 617 |
, 'text' => $text_label |
| 618 |
, 'class' => '' // Any CSS class here |
| 619 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 620 |
) |
| 621 |
, array( |
| 622 |
'type' => 'select' |
| 623 |
, 'id' => $parameter_name // HTML ID of element |
| 624 |
, 'options' => $form_options // Associated array of titles and values |
| 625 |
, 'value' => $selected_value // Some Value from optins array that selected by default |
| 626 |
, 'style' => '' // CSS of select element |
| 627 |
, 'class' => '' // CSS Class of select element |
| 628 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 629 |
, 'onchange' => $on_change |
| 630 |
) |
| 631 |
) |
| 632 |
); |
| 633 |
?><div class="control-group wpbc-no-padding" style="width:auto;"><?php |
| 634 |
wpbc_bs_input_group( $params ); |
| 635 |
?></div><?php |
| 636 |
} |
| 637 |
|
| 638 |
|
| 639 |
/** Selection Number of calendar months in one row */ |
| 640 |
function wpbc_toolbar_btn__calendar_months_num_in_1_row_selection( $user_calendar_options = array() ) { |
| 641 |
|
| 642 |
$text_label = __('Number of months in one row' ,'booking') . ':'; |
| 643 |
$form_options = array( 0 => __('All', 'booking'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12 ); |
| 644 |
|
| 645 |
$parameter_name = 'calendar_months_num_in_1_row'; |
| 646 |
|
| 647 |
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval ( $user_calendar_options[ $parameter_name ] ); |
| 648 |
else $selected_value = 0; |
| 649 |
|
| 650 |
$link_base = wpbc_get_new_booking_url__base( array( $parameter_name ) ) . '&' . $parameter_name . '=' ; |
| 651 |
|
| 652 |
$on_change = ''; // 'location.href=\'' . $link_base . '\' + this.value;'; |
| 653 |
|
| 654 |
|
| 655 |
$params = array( |
| 656 |
'label_for' => $parameter_name // "For" parameter of label element |
| 657 |
, 'label' => '' // Label above the input group |
| 658 |
, 'style' => '' // CSS Style of entire div element |
| 659 |
, 'items' => array( |
| 660 |
array( |
| 661 |
'type' => 'addon' |
| 662 |
, 'element' => 'text' // text | radio | checkbox |
| 663 |
, 'text' => $text_label |
| 664 |
, 'class' => '' // Any CSS class here |
| 665 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 666 |
) |
| 667 |
, array( |
| 668 |
'type' => 'select' |
| 669 |
, 'id' => $parameter_name // HTML ID of element |
| 670 |
, 'options' => $form_options // Associated array of titles and values |
| 671 |
, 'value' => $selected_value // Some Value from optins array that selected by default |
| 672 |
, 'style' => '' // CSS of select element |
| 673 |
, 'class' => '' // CSS Class of select element |
| 674 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 675 |
, 'onchange' => $on_change |
| 676 |
) |
| 677 |
) |
| 678 |
); |
| 679 |
?><div class="control-group wpbc-no-padding"><?php |
| 680 |
wpbc_bs_input_group( $params ); |
| 681 |
?></div><?php |
| 682 |
} |
| 683 |
|
| 684 |
|
| 685 |
function wpbc_toolbar_btn__calendar_width( $user_calendar_options = array() ){ |
| 686 |
|
| 687 |
$text_label = __('Maximum width of calendar' ,'booking') . ':'; |
| 688 |
$parameter_name = 'calendar_width'; |
| 689 |
|
| 690 |
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval( $user_calendar_options[ $parameter_name ] ); |
| 691 |
else $selected_value = ''; |
| 692 |
|
| 693 |
if ( isset( $user_calendar_options[$parameter_name . 'units'] ) ) $selected_value_units = esc_attr( $user_calendar_options[ $parameter_name . 'units' ] ); |
| 694 |
else $selected_value_units = ''; |
| 695 |
|
| 696 |
$params = array( |
| 697 |
'label_for' => $parameter_name // "For" parameter of label element |
| 698 |
, 'label' => '' // Label above the input group |
| 699 |
, 'style' => '' // CSS Style of entire div element |
| 700 |
, 'items' => array( |
| 701 |
array( |
| 702 |
'type' => 'addon' |
| 703 |
, 'element' => 'text' // text | radio | checkbox |
| 704 |
, 'text' => $text_label |
| 705 |
, 'class' => '' // Any CSS class here |
| 706 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 707 |
) |
| 708 |
, array( |
| 709 |
'type' => 'text' |
| 710 |
, 'id' => $parameter_name // HTML ID of element |
| 711 |
, 'value' => $selected_value // Some Value from optins array that selected by default |
| 712 |
, 'style' => 'width: 5em;' // CSS of select element |
| 713 |
, 'placeholder' => '100%' |
| 714 |
, 'class' => '' // CSS Class of select element |
| 715 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 716 |
) |
| 717 |
, array( |
| 718 |
'type' => 'select' |
| 719 |
, 'id' => $parameter_name . 'units' // HTML ID of element |
| 720 |
, 'options' => array( 'px' => 'px', 'percent' => '%' ) // Associated array of titles and values |
| 721 |
, 'value' => $selected_value_units // Some Value from optins array that selected by default |
| 722 |
, 'style' => 'width: 5em;' // CSS of select element |
| 723 |
, 'class' => '' // CSS Class of select element |
| 724 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 725 |
) |
| 726 |
) |
| 727 |
); |
| 728 |
?><div class="control-group wpbc-no-padding"><?php |
| 729 |
wpbc_bs_input_group( $params ); |
| 730 |
?></div><?php |
| 731 |
} |
| 732 |
|
| 733 |
function wpbc_toolbar_btn__calendar_cell_height( $user_calendar_options = array() ){ |
| 734 |
|
| 735 |
$text_label = __('Calendar cell height' ,'booking') . ':'; |
| 736 |
$parameter_name = 'calendar_cell_height'; |
| 737 |
|
| 738 |
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval( $user_calendar_options[ $parameter_name ] ); |
| 739 |
else $selected_value = ''; |
| 740 |
|
| 741 |
if ( isset( $user_calendar_options[$parameter_name . 'units'] ) ) $selected_value_units = esc_attr( $user_calendar_options[ $parameter_name . 'units' ] ); |
| 742 |
else $selected_value_units = ''; |
| 743 |
|
| 744 |
$params = array( |
| 745 |
'label_for' => $parameter_name // "For" parameter of label element |
| 746 |
, 'label' => '' // Label above the input group |
| 747 |
, 'style' => '' // CSS Style of entire div element |
| 748 |
, 'items' => array( |
| 749 |
array( |
| 750 |
'type' => 'addon' |
| 751 |
, 'element' => 'text' // text | radio | checkbox |
| 752 |
, 'text' => $text_label |
| 753 |
, 'class' => '' // Any CSS class here |
| 754 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 755 |
) |
| 756 |
, array( |
| 757 |
'type' => 'text' |
| 758 |
, 'id' => $parameter_name // HTML ID of element |
| 759 |
, 'value' => $selected_value // Some Value from optins array that selected by default |
| 760 |
, 'style' => 'width: 5em;' // CSS of select element |
| 761 |
, 'placeholder' => '48px' |
| 762 |
, 'class' => '' // CSS Class of select element |
| 763 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 764 |
) |
| 765 |
, array( |
| 766 |
'type' => 'select' |
| 767 |
, 'id' => $parameter_name . 'units' // HTML ID of element |
| 768 |
, 'options' => array( 'px' => 'px', 'percent' => '%' ) // Associated array of titles and values |
| 769 |
, 'value' => $selected_value_units // Some Value from optins array that selected by default |
| 770 |
, 'style' => 'width: 5em;' // CSS of select element |
| 771 |
, 'class' => '' // CSS Class of select element |
| 772 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 773 |
) |
| 774 |
|
| 775 |
) |
| 776 |
); |
| 777 |
?><div class="control-group wpbc-no-padding"><?php |
| 778 |
wpbc_bs_input_group( $params ); |
| 779 |
?></div><?php |
| 780 |
} |
| 781 |
|
| 782 |
|
| 783 |
/** Add New Booking Button*/ |
| 784 |
function wpbc_toolbar_btn__calendar_options_save() { |
| 785 |
|
| 786 |
?><div class="control-group wpbc-no-padding"><?php |
| 787 |
?><a id="toolbar_btn__calendar_options_save" |
| 788 |
class="button button-primary " |
| 789 |
href="javascript:void(0)" |
| 790 |
onclick="javascript:var data_params = {}; |
| 791 |
data_params.calendar_months_count = jQuery('#calendar_months_count').val(); |
| 792 |
data_params.calendar_months_num_in_1_row = jQuery('#calendar_months_num_in_1_row').val(); |
| 793 |
data_params.calendar_width = jQuery('#calendar_width').val(); |
| 794 |
data_params.calendar_widthunits = jQuery('#calendar_widthunits').val(); |
| 795 |
data_params.calendar_cell_height = jQuery('#calendar_cell_height').val(); |
| 796 |
data_params.calendar_cell_heightunits = jQuery('#calendar_cell_heightunits').val(); |
| 797 |
var ajax_data_params = jQuery.param( data_params ); |
| 798 |
wpbc_save_custom_user_data(<?php echo esc_js( wpbc_get_current_user_id() ); ?> |
| 799 |
, '<?php echo 'add_booking_calendar_options'; ?>' |
| 800 |
, ajax_data_params |
| 801 |
, 1 |
| 802 |
);" |
| 803 |
><?php esc_html_e('Save' , 'booking' ); ?></a><?php |
| 804 |
?></div><?php |
| 805 |
} |
| 806 |
|
| 807 |
|
| 808 |
/** Add New Booking Button*/ |
| 809 |
function wpbc_toolbar_btn__calendar_options_reset() { |
| 810 |
|
| 811 |
?><div class="control-group wpbc-no-padding"><?php |
| 812 |
?><a |
| 813 |
class="button button-secondary " |
| 814 |
href="javascript:void(0)" |
| 815 |
onclick="javascript:jQuery('#calendar_months_count').val('1'); |
| 816 |
jQuery('#calendar_months_num_in_1_row').val('0'); |
| 817 |
jQuery('#calendar_width').val('0'); |
| 818 |
jQuery('#calendar_widthunits').val('px'); |
| 819 |
jQuery('#calendar_cell_height').val('0'); |
| 820 |
jQuery('#calendar_cell_heightunits').val('px'); |
| 821 |
jQuery( '#toolbar_btn__calendar_options_save').trigger('click'); |
| 822 |
" |
| 823 |
><?php esc_html_e('Reset' , 'booking' ); ?></a><?php |
| 824 |
?></div><?php |
| 825 |
} |
| 826 |
|
| 827 |
/** |
| 828 |
* Button for ability to add bookings in the past. |
| 829 |
* |
| 830 |
* @return void |
| 831 |
*/ |
| 832 |
function wpbc_toolbar_btn__add_past_booking( $args = array() ) { |
| 833 |
|
| 834 |
if ( isset( $_GET['allow_past'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 835 |
return; |
| 836 |
} |
| 837 |
|
| 838 |
$defaults = array( |
| 839 |
'resource_id' => null, |
| 840 |
'booking_form' => null, |
| 841 |
); |
| 842 |
$args = wp_parse_args( $args, $defaults ); |
| 843 |
|
| 844 |
$link = wpbc_get_new_booking_url(); |
| 845 |
|
| 846 |
if ( null !== $args['resource_id'] ) { |
| 847 |
$link .= '&booking_type=' . absint( $args['resource_id'] ); |
| 848 |
} else { |
| 849 |
$link .= ( ! empty( $_REQUEST['booking_type'] ) ) ? '&booking_type=' . intval( $_REQUEST['booking_type'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 850 |
} |
| 851 |
|
| 852 |
if ( null !== $args['booking_form'] ) { |
| 853 |
$link .= '&booking_form=' . sanitize_text_field( wp_unslash( (string) $args['booking_form'] ) ); |
| 854 |
} else { |
| 855 |
$link .= ( ! empty( $_REQUEST['booking_form'] ) ) ? '&booking_form=' . sanitize_text_field( wp_unslash( $_REQUEST['booking_form'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 856 |
} |
| 857 |
|
| 858 |
$link .= ( ! empty( $_REQUEST['booking_hash'] ) ) ? '&booking_hash=' . sanitize_text_field( wp_unslash( $_REQUEST['booking_hash'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 859 |
$link .= ( ! empty( $_REQUEST['is_show_payment_form'] ) ) ? '&is_show_payment_form=Off' : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 860 |
$link .= ( ! empty( $_REQUEST['parent_res'] ) ) ? '&parent_res=' . intval( $_REQUEST['parent_res'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 861 |
|
| 862 |
$el_id = 'is_allow_bookings_in_past'; |
| 863 |
$el_value = 'Off'; |
| 864 |
|
| 865 |
$params_checkbox = array( |
| 866 |
'id' => $el_id // HTML ID of element |
| 867 |
, 'name' => $el_id |
| 868 |
, 'label' => array( 'title' => __( 'Allow booking in the past', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5. |
| 869 |
, 'style' => '' // CSS of select element |
| 870 |
, 'class' => '' // CSS Class of select element |
| 871 |
, 'disabled' => false |
| 872 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 873 |
, 'legend' => '' // aria-label parameter |
| 874 |
, 'value' => $el_value // Some Value from optins array that selected by default |
| 875 |
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not |
| 876 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 877 |
, 'onchange' => "window.location.href='". $link . "&allow_past=1';" // JavaScript code |
| 878 |
, 'hint' => array( 'title' => __('Allow booking in the past' ,'booking') , 'position' => 'top' ) |
| 879 |
); |
| 880 |
|
| 881 |
?><div class="btn-group" style="display: inline-flex;min-height: 31px;flex-flow: row nowrap;align-items: center;"><?php |
| 882 |
|
| 883 |
wpbc_flex_toggle( $params_checkbox ); |
| 884 |
|
| 885 |
?></div><?php |
| 886 |
} |
| 887 |
|
| 888 |
|
| 889 |
/** Add New Booking Button*/ |
| 890 |
function wpbc_toolbar_btn__add_new_booking( $args = array() ) { |
| 891 |
|
| 892 |
$defaults = array( |
| 893 |
'resource_id' => null, |
| 894 |
); |
| 895 |
$args = wp_parse_args( $args, $defaults ); |
| 896 |
|
| 897 |
if ( null !== $args['resource_id'] ) { |
| 898 |
$bk_type = absint( $args['resource_id'] ); |
| 899 |
} elseif ( isset( $_GET['booking_type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 900 |
$bk_type = intval( $_GET['booking_type'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 901 |
} else { |
| 902 |
$bk_type = 1; |
| 903 |
} |
| 904 |
|
| 905 |
?><a |
| 906 |
class="button-primary button wpbc_submit_button" |
| 907 |
href="javascript:void(0)" |
| 908 |
onclick="wpbc_booking_form_submit( |
| 909 |
document.getElementById('booking_form<?php echo intval( $bk_type ); ?>' ) |
| 910 |
, <?php echo intval( $bk_type ); ?> |
| 911 |
, '<?php echo esc_js( wpbc_get_maybe_reloaded_booking_locale() ); ?>' |
| 912 |
);" |
| 913 |
><?php esc_html_e( 'Add booking', 'booking' ); ?></a><?php |
| 914 |
} |
| 915 |
|
| 916 |
|
| 917 |
/** Checkbox - sending emails or not - duplicated button, usually at the bottom of page*/ |
| 918 |
function wpbc_toolbar_is_send_emails_btn_duplicated() { |
| 919 |
|
| 920 |
?><div class="btn-group" style="margin-top:10px;"><?php |
| 921 |
|
| 922 |
$el_id = 'is_send_email_for_new_booking'; |
| 923 |
|
| 924 |
$el_value = ( get_bk_option( 'booking_send_emails_off_addbooking' ) !== 'On' ) ? 'On' : 'Off'; |
| 925 |
|
| 926 |
$params_checkbox = array( |
| 927 |
'id' => $el_id // HTML ID of element |
| 928 |
, 'name' => $el_id |
| 929 |
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5. |
| 930 |
, 'style' => '' // CSS of select element |
| 931 |
, 'class' => '' // CSS Class of select element |
| 932 |
, 'disabled' => false |
| 933 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 934 |
, 'legend' => '' // aria-label parameter |
| 935 |
, 'value' => $el_value // Some Value from optins array that selected by default |
| 936 |
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not |
| 937 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 938 |
, 'onchange' => "document.getElementById('is_send_email_for_pending').checked = this.checked;" // JavaScript code |
| 939 |
, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' ) |
| 940 |
); |
| 941 |
|
| 942 |
wpbc_flex_toggle( $params_checkbox ); |
| 943 |
|
| 944 |
?></div><?php |
| 945 |
|
| 946 |
?> |
| 947 |
<script type="text/javascript"> |
| 948 |
jQuery( '#is_send_email_for_pending' ).on('change', function() { |
| 949 |
document.getElementById( 'is_send_email_for_new_booking' ).checked = jQuery( '#is_send_email_for_pending' ).is( ':checked' ); |
| 950 |
}); |
| 951 |
</script> |
| 952 |
<?php |
| 953 |
} |
| 954 |
|
| 955 |
|
| 956 |
/** |
| 957 |
* Show Link (button) for adding booking to Google Calendar |
| 958 |
* |
| 959 |
* @param int $booking_id |
| 960 |
* @param array $button_attr |
| 961 |
* @param bool $echo |
| 962 |
* @return string |
| 963 |
*/ |
| 964 |
function wpbc_btn_add_booking_to_google_calendar( $booking_data, $button_attr = array(), $echo = true ) { // FixIn: 7.1.2.5. |
| 965 |
|
| 966 |
//debuge($booking_data); |
| 967 |
if ( ! $echo ) { |
| 968 |
ob_start(); |
| 969 |
} |
| 970 |
|
| 971 |
$defaults = array( |
| 972 |
'title' => __( 'Add to Google Calendar', 'booking' ) |
| 973 |
, 'hint' => __( 'Add to Google Calendar', 'booking' ) |
| 974 |
, 'class' => 'button-secondary button' |
| 975 |
, 'is_show_icon' => true |
| 976 |
, 'is_only_url' => false |
| 977 |
); |
| 978 |
$button_attr = wp_parse_args( $button_attr, $defaults ); |
| 979 |
|
| 980 |
$params = array(); |
| 981 |
$params['timezone'] = get_bk_option('booking_gcal_timezone'); |
| 982 |
|
| 983 |
$booking_gcal_events_form_fields = get_bk_option( 'booking_gcal_events_form_fields'); |
| 984 |
if ( is_serialized( $booking_gcal_events_form_fields ) ) |
| 985 |
$booking_gcal_events_form_fields = unserialize( $booking_gcal_events_form_fields ); |
| 986 |
|
| 987 |
/** |
| 988 |
* Array |
| 989 |
( |
| 990 |
[title] => text^name |
| 991 |
[description] => textarea^details |
| 992 |
[where] => text^ |
| 993 |
) |
| 994 |
*/ |
| 995 |
|
| 996 |
|
| 997 |
// Fields |
| 998 |
$fields = array( 'title' => '', 'description' => '', 'where' => '' ); |
| 999 |
|
| 1000 |
foreach ( $fields as $key_name => $field_value ) { |
| 1001 |
|
| 1002 |
if ( ! empty( $booking_gcal_events_form_fields[ $key_name ] ) ) { |
| 1003 |
|
| 1004 |
$field_name = explode( '^', $booking_gcal_events_form_fields[ $key_name ] ); |
| 1005 |
|
| 1006 |
$field_name = $field_name[ ( count( $field_name ) - 1 ) ]; // FixIn: 8.7.7.6. |
| 1007 |
|
| 1008 |
if ( (! empty($field_name)) |
| 1009 |
&& (! empty($booking_data['form_data'])) |
| 1010 |
&& (! empty($booking_data['form_data']['_all_fields_'])) |
| 1011 |
&& (! empty($booking_data['form_data']['_all_fields_'][ $field_name ])) |
| 1012 |
) { |
| 1013 |
|
| 1014 |
if ( 'description' === $key_name ) { // FixIn: 8.1.3.2. |
| 1015 |
if ( isset( $booking_data['form_show'] ) ) { // FixIn: 8.7.3.14. |
| 1016 |
// FixIn: 8.7.11.4. |
| 1017 |
$fields[ $key_name ] = $booking_data['form_show']; |
| 1018 |
$fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES ); |
| 1019 |
$fields[ $key_name ] = urlencode($fields[ $key_name ]); |
| 1020 |
$fields[ $key_name ] = htmlentities($fields[ $key_name ] ); |
| 1021 |
$fields[ $key_name ] = htmlspecialchars_decode ( $fields[ $key_name ], ENT_NOQUOTES ); |
| 1022 |
} |
| 1023 |
} else { |
| 1024 |
// FixIn: 8.7.11.4. |
| 1025 |
$fields[ $key_name ] = $booking_data['form_data']['_all_fields_'][ $field_name ]; |
| 1026 |
$fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES ); |
| 1027 |
// Convert here from usual symbols to URL symbols https://www.url-encode-decode.com/ |
| 1028 |
// $fields[ $key_name ] = str_replace( array( '%','#', '+', '&' ) |
| 1029 |
// , array( '%25','%23', '%2B', '%26') |
| 1030 |
// , $fields[ $key_name ] |
| 1031 |
// ); |
| 1032 |
$fields[ $key_name ] = urlencode($fields[ $key_name ]); |
| 1033 |
$fields[ $key_name ] = htmlentities($fields[ $key_name ] ); |
| 1034 |
$fields[ $key_name ] = htmlspecialchars_decode ( $fields[ $key_name ], ENT_NOQUOTES ); |
| 1035 |
} |
| 1036 |
} |
| 1037 |
} |
| 1038 |
} |
| 1039 |
//debuge($booking_gcal_events_form_fields, $fields,$booking_data['form_data']); |
| 1040 |
|
| 1041 |
// Dates. |
| 1042 |
|
| 1043 |
$check_in_timestamp = $check_out_timestamp = ''; |
| 1044 |
if ( ! empty( $booking_data[ 'dates_short' ] ) ) { |
| 1045 |
|
| 1046 |
|
| 1047 |
/* all day events, you can use 20161208/20161209 - note that the old google documentation gets it wrong. |
| 1048 |
* You must use the following date as the end date for a one day all day event, |
| 1049 |
* or +1 day to whatever you want the end date to be. |
| 1050 |
*/ |
| 1051 |
|
| 1052 |
$check_in_timestamp = strtotime( $booking_data[ 'dates_short' ][ 0 ], current_time( 'timestamp' ) ); |
| 1053 |
if ( trim( substr( $booking_data[ 'dates_short' ][ 0 ], 11 ) ) == '00:00:00' ) { |
| 1054 |
$check_in_timestamp = gmdate( "Ymd", $check_in_timestamp ); // All day |
| 1055 |
} else { |
| 1056 |
$check_in_timestamp = gmdate( "Ymd\THis", $check_in_timestamp ); |
| 1057 |
//$check_in_timestamp = gmdate( "Ymd\THis\Z", $check_in_timestamp ); |
| 1058 |
} |
| 1059 |
|
| 1060 |
$check_out_timestamp = strtotime( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], current_time( 'timestamp' ) ); |
| 1061 |
if ( trim( substr( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], 11 ) ) == '00:00:00' ) { |
| 1062 |
$check_out_timestamp = strtotime( '+1 day', $check_out_timestamp ); |
| 1063 |
$check_out_timestamp = gmdate( "Ymd", $check_out_timestamp ); // All day |
| 1064 |
} else { |
| 1065 |
$check_out_timestamp = gmdate( "Ymd\THis", $check_out_timestamp ); |
| 1066 |
//$check_out_timestamp = gmdate( "Ymd\THis\Z", $check_out_timestamp ); |
| 1067 |
} |
| 1068 |
|
| 1069 |
} |
| 1070 |
|
| 1071 |
//debuge($check_in_timestamp,$check_out_timestamp, $fields );die; |
| 1072 |
//Convert an ISO date/time to a UNIX timestamp |
| 1073 |
//function iso_to_ts( $iso ) { |
| 1074 |
// sscanf( $iso, "%u-%u-%uT%u:%u:%uZ", $year, $month, $day, $hour, $minute, $second ); |
| 1075 |
// return mktime( intval($hour), intval($minute), intval($second), intval($month), intval($day), intval($year) ); |
| 1076 |
// 20140127T224000Z |
| 1077 |
// gmdate("Ymd\THis\Z", time()); |
| 1078 |
|
| 1079 |
/** |
| 1080 |
action: |
| 1081 |
action=TEMPLATE |
| 1082 |
A default required parameter. |
| 1083 |
|
| 1084 |
src: |
| 1085 |
Example: src=default%40gmail.com |
| 1086 |
Format: src=text |
| 1087 |
This is not covered by Google help but is an optional parameter in order to add an event to a shared calendar rather than a user's default. |
| 1088 |
|
| 1089 |
text: |
| 1090 |
Example: text=Garden%20Waste%20Collection |
| 1091 |
Format: text=text |
| 1092 |
This is a required parameter giving the event title. |
| 1093 |
|
| 1094 |
dates: |
| 1095 |
Example: dates=20090621T063000Z/20090621T080000Z (i.e. an event on 21 June 2009 from 7.30am to 9.0am British Summer Time (=GMT+1)). |
| 1096 |
Format: dates=YYYYMMDDToHHMMSSZ/YYYYMMDDToHHMMSSZ |
| 1097 |
This required parameter gives the start and end dates and times (in Greenwich Mean Time) for the event. |
| 1098 |
|
| 1099 |
location: |
| 1100 |
Example: location=Home |
| 1101 |
Format: location=text |
| 1102 |
The obvious location field. |
| 1103 |
|
| 1104 |
trp: |
| 1105 |
Example: trp=false |
| 1106 |
Format: trp=true/false |
| 1107 |
Show event as busy (true) or available (false) |
| 1108 |
|
| 1109 |
sprop: |
| 1110 |
Example: sprop=http%3A%2F%2Fwww.me.org |
| 1111 |
Example: sprop=name:Home%20Page |
| 1112 |
Format: sprop=website and/or sprop=name:website_name |
| 1113 |
*/ |
| 1114 |
|
| 1115 |
// $link_add2gcal = 'http://www.google.com/calendar/event?action=TEMPLATE'; |
| 1116 |
// $link_add2gcal .= '&text=' . $fields['title']; |
| 1117 |
// FixIn: 8.7.3.10. |
| 1118 |
$link_add2gcal = 'https://calendar.google.com/calendar/r/eventedit?'; |
| 1119 |
$link_add2gcal .= 'text=' . $fields['title']; // FixIn: 8.7.11.4. |
| 1120 |
//$link_add2gcal .= '&dates=[start-custom format='Ymd\\THi00\\Z']/[end-custom format='Ymd\\THi00\\Z']'; |
| 1121 |
$link_add2gcal .= '&dates=' . $check_in_timestamp . '/' . $check_out_timestamp; |
| 1122 |
$link_add2gcal .= '&details=' . ( ( 'On' !== get_bk_option( 'booking_g_cal_export_no_data' ) ) ? $fields['description'] : '' ); // FixIn: 10.3.0.1. |
| 1123 |
$link_add2gcal .= '&location=' . ( ( 'On' !== get_bk_option( 'booking_g_cal_export_no_data' ) ) ? $fields['where'] : '' ); |
| 1124 |
$link_add2gcal .= '&trp=false'; |
| 1125 |
if ( ! empty( $params['timezone'] ) ) { |
| 1126 |
$link_add2gcal .= '&ctz=' . str_replace( '%', '%25', $params['timezone'] ); //FixIn: 8.7.3.10 //TimeZone |
| 1127 |
} |
| 1128 |
|
| 1129 |
|
| 1130 |
//$link_add2gcal .= '&sprop='; |
| 1131 |
//$link_add2gcal .= '&sprop=name:'; |
| 1132 |
|
| 1133 |
if ( $button_attr['is_only_url'] ) { |
| 1134 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1135 |
echo $link_add2gcal; |
| 1136 |
} else { |
| 1137 |
|
| 1138 |
?><a href="<?php echo esc_url( $link_add2gcal ); ?>" target="_blank" rel="nofollow" |
| 1139 |
class="tooltip_top <?php echo esc_attr( $button_attr['class'] ) ?>" |
| 1140 |
title="<?php echo esc_attr( $button_attr['hint'] ); ?>" |
| 1141 |
><?php |
| 1142 |
if ( $button_attr['is_show_icon'] ) { |
| 1143 |
?><i class="wpbc_icn_event"></i><?php //FixIn: 9.0.1.4 glyphicon icon-1x glyphicon-export |
| 1144 |
} else { |
| 1145 |
echo esc_js( $button_attr['title'] ); |
| 1146 |
} |
| 1147 |
?></a><?php |
| 1148 |
} |
| 1149 |
|
| 1150 |
if ( ! $echo ) { |
| 1151 |
return ob_get_clean(); |
| 1152 |
} |
| 1153 |
|
| 1154 |
} |
| 1155 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1156 |
// Toolbar Other UI elements - General |
| 1157 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1158 |
|
| 1159 |
/** |
| 1160 |
* Selection elements in toolbar UI selectbox |
| 1161 |
* |
| 1162 |
* @param array $params |
| 1163 |
* |
| 1164 |
* Exmaple: |
| 1165 |
wpbc_toolbar_btn__selection_element( array( |
| 1166 |
'name' => 'resources_count' |
| 1167 |
, 'title' => __('Resources count' ,'booking') . ':' |
| 1168 |
, 'selected' => 1 |
| 1169 |
, 'options' => array_combine( range(1, 201) ,range(1, 201) ) |
| 1170 |
) ) ; |
| 1171 |
|
| 1172 |
*/ |
| 1173 |
function wpbc_toolbar_btn__selection_element( $params ) { |
| 1174 |
|
| 1175 |
$defaults = array( |
| 1176 |
'name' => 'random_' . wp_rand( 1000, 10000 ) |
| 1177 |
, 'title' => __('Total', 'booking') . ':' |
| 1178 |
, 'on_change' => '' //'location.href=\'' . $link_base . '\' + this.value;'; //$link_base = wpbc_get_new_booking_url__base( array( $params['name'] ) ) . '&' . $params['name'] . '=' ; |
| 1179 |
, 'options' => array() |
| 1180 |
, 'selected' => 0 |
| 1181 |
); |
| 1182 |
$params = wp_parse_args( $params, $defaults ); |
| 1183 |
|
| 1184 |
|
| 1185 |
|
| 1186 |
|
| 1187 |
for ( $i = 1; $i < 201; $i++ ) { |
| 1188 |
$form_options[ $i ] = $i; |
| 1189 |
} |
| 1190 |
|
| 1191 |
$params = array( |
| 1192 |
'label_for' => $params['name'] // "For" parameter of label element |
| 1193 |
, 'label' => '' // Label above the input group |
| 1194 |
, 'style' => '' // CSS Style of entire div element |
| 1195 |
, 'items' => array( |
| 1196 |
array( |
| 1197 |
'type' => 'addon' |
| 1198 |
, 'element' => 'text' // text | radio | checkbox |
| 1199 |
, 'text' => $params['title'] |
| 1200 |
, 'class' => '' // Any CSS class here |
| 1201 |
, 'style' => 'font-weight:600;' // CSS Style of entire div element |
| 1202 |
) |
| 1203 |
, array( |
| 1204 |
'type' => 'select' |
| 1205 |
, 'id' => $params['name'] // HTML ID of element |
| 1206 |
, 'name' => $params['name'] // HTML ID of element |
| 1207 |
, 'options' => $params['options'] // Associated array of titles and values |
| 1208 |
, 'value' => $params['selected'] // Some Value from optins array that selected by default |
| 1209 |
, 'style' => '' // CSS of select element |
| 1210 |
, 'class' => '' // CSS Class of select element |
| 1211 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1212 |
, 'onchange' => $params['on_change'] |
| 1213 |
) |
| 1214 |
) |
| 1215 |
); |
| 1216 |
?><div class="control-group wpbc-no-padding"><?php |
| 1217 |
wpbc_bs_input_group( $params ); |
| 1218 |
?></div><?php |
| 1219 |
} |
| 1220 |
|
| 1221 |
|
| 1222 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1223 |
// Toolbar S e a r c h F o r m at Top Right side of Settings page |
| 1224 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1225 |
|
| 1226 |
// FixIn: 8.0.1.12. |
| 1227 |
/** |
| 1228 |
* Add hidden input SEARCH KEY field into main form, if previosly was searching by ID or Title |
| 1229 |
* @param array $params => array( 'search_get_key' => 'wh_resource_id' ) |
| 1230 |
*/ |
| 1231 |
function wpbc_hidden_search_by_id_field_in_main_form( $params = array() ){ |
| 1232 |
|
| 1233 |
$defaults = array( |
| 1234 |
'search_get_key' => 'wh_search_id' |
| 1235 |
); |
| 1236 |
$params = wp_parse_args( $params, $defaults ); |
| 1237 |
|
| 1238 |
|
| 1239 |
$search_form_value = ''; |
| 1240 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 1241 |
if ( isset( $_REQUEST[ $params[ 'search_get_key' ] ] ) ) { |
| 1242 |
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 1243 |
$wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params['search_get_key'] ] ); // '12,0,45,9' or '10'. |
| 1244 |
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 1245 |
$wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params['search_get_key'] ] ); // Clean string. |
| 1246 |
|
| 1247 |
if ( ! empty( $wh_resource_id ) ) { |
| 1248 |
$search_form_value = $wh_resource_id; |
| 1249 |
} else { |
| 1250 |
$search_form_value = $wh_resource_title; |
| 1251 |
} |
| 1252 |
} |
| 1253 |
|
| 1254 |
if ( '' !== $search_form_value ) { |
| 1255 |
?><input name="<?php echo esc_attr( $params['search_get_key'] ); ?>" value="<?php echo esc_attr( $search_form_value ); ?>" type="hidden"><?php |
| 1256 |
} |
| 1257 |
} |
| 1258 |
|
| 1259 |
/** |
| 1260 |
* Real Search booking data by ID | Title (at top right side of page) |
| 1261 |
* |
| 1262 |
* @param array $params - array of parameters |
| 1263 |
* Exmaple: |
| 1264 |
wpbc_toolbar_search_by_id__top_form( array( |
| 1265 |
'search_form_id' => 'wpbc_seasonfilters_search_form' |
| 1266 |
, 'search_get_key' => 'wh_search_id' |
| 1267 |
, 'is_pseudo' => false |
| 1268 |
) ); |
| 1269 |
|
| 1270 |
*/ |
| 1271 |
function wpbc_toolbar_search_by_id__top_form( $params ) { |
| 1272 |
|
| 1273 |
$defaults = array( |
| 1274 |
'search_form_id' => 'wpbc_seasonfilters_search_form' |
| 1275 |
, 'search_get_key' => 'wh_search_id' |
| 1276 |
, 'is_pseudo' => false //'location.href=\'' . $link_base . '\' + this.value;'; //$link_base = wpbc_get_new_booking_url__base( array( $params['name'] ) ) . '&' . $params['name'] . '=' ; |
| 1277 |
, 'container_style' => 'position: absolute; right: 20px; top: 0px;z-index: 0;' // FixIn: 10.0.0.29. |
| 1278 |
); |
| 1279 |
$params = wp_parse_args( $params, $defaults ); |
| 1280 |
|
| 1281 |
|
| 1282 |
$exclude_params = array(); //array('page_num', 'orderby', 'order'); - if using "only_these_parameters", then this parameter does NOT require |
| 1283 |
$only_these_parameters = array( 'page', 'tab', 'subtab', $params[ 'search_get_key' ] ); //FixIn: 8.1.1.11 - added , 'subtab' - ability to search booking resources in sub tab pages in settings |
| 1284 |
$wpbc_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false, false ), $exclude_params, $only_these_parameters ); |
| 1285 |
|
| 1286 |
|
| 1287 |
$search_form_value = ''; |
| 1288 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 1289 |
if ( isset( $_REQUEST[ $params[ 'search_get_key' ] ] ) ) { |
| 1290 |
$wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params[ 'search_get_key' ] ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // '12,0,45,9' or '10' |
| 1291 |
$wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params[ 'search_get_key' ] ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // Clean string |
| 1292 |
if ( ! empty( $wh_resource_id ) ) { |
| 1293 |
$search_form_value = $wh_resource_id; |
| 1294 |
} else { |
| 1295 |
$search_form_value = $wh_resource_title; |
| 1296 |
} |
| 1297 |
} |
| 1298 |
|
| 1299 |
|
| 1300 |
wpbc_clear_div(); |
| 1301 |
|
| 1302 |
?> |
| 1303 |
<span class="wpdevelop"> |
| 1304 |
|
| 1305 |
<?php if ( ! $params['is_pseudo'] ) { ?> |
| 1306 |
<div style="<?php echo esc_attr( $params['container_style'] ); ?>"> |
| 1307 |
<form action="<?php echo esc_url( $wpbc_admin_url ); ?>" method="post" id="<?php echo esc_attr( $params[ 'search_form_id' ] ); ?>" name="<?php echo esc_attr( $params[ 'search_form_id' ] ); ?>" > |
| 1308 |
<?php |
| 1309 |
} else { |
| 1310 |
?><div style="float:right;" id="<?php echo esc_attr( $params['search_form_id'] . '_pseudo' ); ?>"><?php |
| 1311 |
} |
| 1312 |
|
| 1313 |
|
| 1314 |
if(0){ |
| 1315 |
$params_for_element = array( 'label_for' => $params[ 'search_get_key' ] . ( ( $params['is_pseudo'] ) ? '_pseudo' : '' ) |
| 1316 |
, 'label' => ''//__('Keyword:', 'booking') |
| 1317 |
, 'items' => array( |
| 1318 |
array( 'type' => 'text' |
| 1319 |
, 'id' => $params[ 'search_get_key' ] . ( ( $params['is_pseudo'] ) ? '_pseudo' : '' ) |
| 1320 |
, 'value' => $search_form_value |
| 1321 |
, 'placeholder' => __('ID or Title', 'booking') |
| 1322 |
) |
| 1323 |
, array( |
| 1324 |
'type' => 'button' |
| 1325 |
, 'title' => __('Go', 'booking') |
| 1326 |
, 'class' => 'button-secondary' |
| 1327 |
, 'font_icon' => 'wpbc_icn_search' |
| 1328 |
, 'icon_position' => 'right' |
| 1329 |
, 'action' => ( ( ! $params['is_pseudo'] ) ? "jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" |
| 1330 |
: "jQuery('#" . $params[ 'search_get_key' ] . "').val( jQuery('#" . $params[ 'search_get_key' ] . "_pseudo').val() ); jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" ) //Submit real form at the top of page. |
| 1331 |
) |
| 1332 |
) |
| 1333 |
); |
| 1334 |
|
| 1335 |
?><div class="control-group wpbc-no-padding" ><?php |
| 1336 |
wpbc_bs_input_group( $params_for_element ); |
| 1337 |
?></div><?php |
| 1338 |
} else { |
| 1339 |
?><div id="booking_resources_toolbar_container" class="wpbc_ajx_toolbar wpbc_background_transparent"><?php |
| 1340 |
|
| 1341 |
?><div class="ui_container ui_container_toolbar ui_container_small ui_container_options ui_container_options_row_1" |
| 1342 |
style=" display: flex"><?php |
| 1343 |
|
| 1344 |
?><div class="ui_group"><?php |
| 1345 |
|
| 1346 |
// Search Keyword text field |
| 1347 |
?><div class="ui_element"><?php |
| 1348 |
|
| 1349 |
$el_id = 'booking_resource_search_keyword'; |
| 1350 |
|
| 1351 |
$default_value = $search_form_value; |
| 1352 |
|
| 1353 |
$params_for_element = array( |
| 1354 |
'type' => 'text' |
| 1355 |
, 'id' => $params[ 'search_get_key' ] . ( ( $params['is_pseudo'] ) ? '_pseudo' : '' ) |
| 1356 |
, 'name' => $params[ 'search_get_key' ] . ( ( $params['is_pseudo'] ) ? '_pseudo' : '' ) |
| 1357 |
, 'label' => '' |
| 1358 |
, 'disabled' => false |
| 1359 |
, 'class' => '' |
| 1360 |
, 'style' => 'min-width:100px;' |
| 1361 |
, 'placeholder' => __('ID or Title' ,'booking') |
| 1362 |
, 'attr' => array( 'maxlength' => '200' ) |
| 1363 |
, 'value' => $default_value |
| 1364 |
, 'onfocus' => '' |
| 1365 |
); |
| 1366 |
|
| 1367 |
wpbc_flex_text( $params_for_element ); |
| 1368 |
|
| 1369 |
?></div><?php |
| 1370 |
|
| 1371 |
|
| 1372 |
// Reset keyword |
| 1373 |
$params_for_element = array( |
| 1374 |
'type' => 'button' , |
| 1375 |
'title' => '',//__( 'Reset', 'booking' ) . ' ', // Title of the button |
| 1376 |
'hint' => array( 'title' => __( 'Reset keyword text field', 'booking' ), 'position' => 'top' ), // Hint |
| 1377 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1378 |
// 'action' => "jQuery( '#booking_resource_search_keyword').val(''); |
| 1379 |
// window.location.href='" . $option_params['url'] . "';", // JavaScript |
| 1380 |
'action' => ( ( ! $params['is_pseudo'] ) ? "jQuery('#" . $params[ 'search_get_key' ] . "').val( '' ); jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" |
| 1381 |
: "jQuery('#" . $params[ 'search_get_key' ] . "').val( '' ); jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" ) , |
| 1382 |
'icon' => array( |
| 1383 |
'icon_font' => 'wpbc_icn_close', //'wpbc_icn_rotate_left', |
| 1384 |
'position' => 'left', |
| 1385 |
'icon_img' => '' |
| 1386 |
), |
| 1387 |
'class' => 'wpbc_button_as_icon', // '' | 'wpbc_ui_button_primary' |
| 1388 |
'style' => '', // Any CSS class here |
| 1389 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1390 |
'attr' => array() |
| 1391 |
); |
| 1392 |
|
| 1393 |
?><div class="ui_element" style="flex: 0 1 auto;margin-left: -50px;z-index: 1;"><?php |
| 1394 |
wpbc_flex_button( $params_for_element ); |
| 1395 |
?></div><?php |
| 1396 |
|
| 1397 |
|
| 1398 |
// Go button |
| 1399 |
?><div class="ui_element"><?php |
| 1400 |
|
| 1401 |
$booking_action = 'booking_resource_search_keyword_btn'; |
| 1402 |
|
| 1403 |
$el_id = 'ui_btn_' . $booking_action; |
| 1404 |
|
| 1405 |
// Escaped construction of search keyword. // FixIn: 9.9.0.11. |
| 1406 |
$params_for_element = array( |
| 1407 |
'type' => 'button' , |
| 1408 |
'title' => '',//__( 'Search', 'booking' ) . ' ', // Title of the button |
| 1409 |
'hint' => array( 'title' => __('Search' ,'booking'), 'position' => 'top' ), // Hint |
| 1410 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1411 |
//'link' => $option_params['url'] . '&wh_resource_id=sdfs+f', |
| 1412 |
// 'action' => "if (jQuery('#booking_resource_search_keyword' ).val() == '' ) { |
| 1413 |
// wpbc_field_highlight( '#booking_resource_search_keyword' ); |
| 1414 |
// } else { |
| 1415 |
// window.location.href='" . $option_params['url'] . "&wh_resource_id='+window.encodeURIComponent(jQuery('#booking_resource_search_keyword' ).val()); |
| 1416 |
// }" , |
| 1417 |
'action' => ( ( ! $params['is_pseudo'] ) ? "jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" |
| 1418 |
: "jQuery('#" . $params[ 'search_get_key' ] . "').val( jQuery('#" . $params[ 'search_get_key' ] . "_pseudo').val() ); jQuery('#". $params[ 'search_form_id' ] ."').trigger( 'submit' );" ) , |
| 1419 |
|
| 1420 |
'icon' => array( |
| 1421 |
'icon_font' => 'wpbc_icn_search', |
| 1422 |
'position' => 'left', |
| 1423 |
'icon_img' => '' |
| 1424 |
), |
| 1425 |
'class' => 'wpbc_ui_button _primary', // '' | 'wpbc_ui_button_primary' |
| 1426 |
'style' => '', // Any CSS class here |
| 1427 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1428 |
'attr' => array( 'id' => $el_id ) |
| 1429 |
); |
| 1430 |
|
| 1431 |
wpbc_flex_button( $params_for_element ); |
| 1432 |
|
| 1433 |
?></div><?php |
| 1434 |
|
| 1435 |
?></div><?php |
| 1436 |
|
| 1437 |
?></div><?php |
| 1438 |
|
| 1439 |
?></div><?php |
| 1440 |
|
| 1441 |
} |
| 1442 |
|
| 1443 |
|
| 1444 |
|
| 1445 |
|
| 1446 |
if ( ! $params['is_pseudo'] ) { ?> |
| 1447 |
</form> |
| 1448 |
<?php } ?> |
| 1449 |
<?php wpbc_clear_div(); ?> |
| 1450 |
|
| 1451 |
<?php |
| 1452 |
if ( $params['is_pseudo'] ) { |
| 1453 |
// Required for opening specific page NUM during saving //////// |
| 1454 |
?><input type="hidden" value="<?php |
| 1455 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1456 |
echo $search_form_value; ?>" name="<?php echo esc_attr( $params[ 'search_get_key' ] ); ?>" /><?php |
| 1457 |
?><div class="clear" style="height:20px;"></div><?php |
| 1458 |
} |
| 1459 |
?> |
| 1460 |
</div> |
| 1461 |
</span> |
| 1462 |
<?php |
| 1463 |
|
| 1464 |
if ( $params['is_pseudo'] ) { |
| 1465 |
|
| 1466 |
// Hide pseudo form, if real search form does not exist |
| 1467 |
?> |
| 1468 |
<script type="text/javascript"> |
| 1469 |
jQuery(document).ready(function(){ |
| 1470 |
if ( jQuery('#<?php echo esc_js( $params[ 'search_form_id' ] ); ?>').length == 0 ) { |
| 1471 |
jQuery('#<?php echo esc_js( $params['search_form_id'] . '_pseudo' ); ?>').hide(); |
| 1472 |
} |
| 1473 |
}); |
| 1474 |
</script> |
| 1475 |
<?php |
| 1476 |
} |
| 1477 |
} |
| 1478 |
|
| 1479 |
|
| 1480 |
// FixIn: 9.6.3.5. |
| 1481 |
|
| 1482 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1483 |
// JS & CSS |
| 1484 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1485 |
|
| 1486 |
/** |
| 1487 |
* Load support JavaScript for "Bookings" page :: JS Tooltips, Popover, Datepicker |
| 1488 |
*/ |
| 1489 |
function wpbc_js_for_bookings_page() { |
| 1490 |
|
| 1491 |
wpbc_bs_javascript_tooltips(); // JS Tooltips |
| 1492 |
wpbc_bs_javascript_popover(); // JS Popover |
| 1493 |
wpbc_datepicker_js(); // JS Datepicker |
| 1494 |
wpbc_datepicker_css(); // CSS DatePicker |
| 1495 |
} |
| 1496 |
|
| 1497 |
|
| 1498 |
/** Datepicker activation JavaScript */ |
| 1499 |
function wpbc_datepicker_js() { |
| 1500 |
?> |
| 1501 |
<script type="text/javascript"> |
| 1502 |
<?php |
| 1503 |
echo wpbc_jq_ready_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1504 |
?> |
| 1505 |
if ( 'function' === typeof( jQuery('input.wpdevbk-filters-section-calendar').datepick ) ) { |
| 1506 |
jQuery( 'input.wpdevbk-filters-section-calendar' ).datepick( |
| 1507 |
{ |
| 1508 |
beforeShowDay : function ( date ) { |
| 1509 |
return [true, 'date_available']; |
| 1510 |
}, |
| 1511 |
onSelect : function ( string_dates, js_dates_arr ){ /** |
| 1512 |
* string_dates = '23.08.2023 - 26.08.2023' | '23.08.2023 - 23.08.2023' | '19.09.2023, 24.08.2023, 30.09.2023' |
| 1513 |
* js_dates_arr = range: [ Date (Aug 23 2023), Date (Aug 25 2023)] | multiple: [ Date(Oct 24 2023), Date(Oct 20 2023), Date(Oct 16 2023) ] |
| 1514 |
*/ |
| 1515 |
return wpbc_filters_section_calendar_selected_day( string_dates, {}, this ); |
| 1516 |
}, |
| 1517 |
showOn : 'focus', |
| 1518 |
multiSelect : 0, |
| 1519 |
numberOfMonths : 1, |
| 1520 |
stepMonths : 1, |
| 1521 |
prevText : '‹', |
| 1522 |
nextText : '›', |
| 1523 |
dateFormat : 'yy-mm-dd', |
| 1524 |
changeMonth : false, |
| 1525 |
changeYear : false, |
| 1526 |
minDate : null, |
| 1527 |
maxDate : null, //'1Y', |
| 1528 |
showStatus : false, |
| 1529 |
multiSeparator : ', ', |
| 1530 |
closeAtTop : null, //!false, |
| 1531 |
firstDay : <?php echo intval( get_bk_option( 'booking_start_day_weeek' ) ); ?>, |
| 1532 |
gotoCurrent : false, |
| 1533 |
hideIfNoPrevNext: true, |
| 1534 |
useThemeRoller : false, |
| 1535 |
mandatory : true |
| 1536 |
} |
| 1537 |
); |
| 1538 |
function wpbc_filters_section_calendar_selected_day( string_dates, params_arr, _this ) { |
| 1539 |
// FixIn: 10.11.4.2. |
| 1540 |
if ( 'ui_wh_booking_date_checkin' === jQuery( _this ).attr( 'id' ) ) { |
| 1541 |
setTimeout( function () { |
| 1542 |
jQuery( '#ui_wh_booking_date_checkout' ).val( string_dates ); |
| 1543 |
jQuery( '#ui_wh_booking_date_checkout' ).trigger( 'focus' ); |
| 1544 |
}, 100 ); |
| 1545 |
} |
| 1546 |
} |
| 1547 |
} else { |
| 1548 |
console.log( 'WPBC Error. JavaScript library "datepick" was not defined.' ); |
| 1549 |
} |
| 1550 |
<?php |
| 1551 |
echo wpbc_jq_ready_end(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1552 |
?> |
| 1553 |
</script> |
| 1554 |
<?php |
| 1555 |
} |
| 1556 |
|
| 1557 |
|
| 1558 |
/** Support CSS - datepick, etc... */ |
| 1559 |
function wpbc_datepicker_css(){ |
| 1560 |
|
| 1561 |
// FixIn: 9.7.3.4 |
| 1562 |
$width = 300; |
| 1563 |
$height = 40; |
| 1564 |
?> |
| 1565 |
<style type="text/css"> |
| 1566 |
#datepick-div { |
| 1567 |
max-width: <?php echo intval( $width ); ?>px !important; |
| 1568 |
width:100%; |
| 1569 |
margin-top: 2px; |
| 1570 |
background: #fff; |
| 1571 |
} |
| 1572 |
#datepick-div .datepick-days-cell { |
| 1573 |
height: <?php echo intval( $height ); ?>px !important; |
| 1574 |
} |
| 1575 |
#datepick-div .datepick-control { |
| 1576 |
display: none; |
| 1577 |
font-size: 10px; |
| 1578 |
text-align: center; |
| 1579 |
} |
| 1580 |
#datepick-div .datepick .datepick-days-cell a{ |
| 1581 |
font-size: 12px; |
| 1582 |
} |
| 1583 |
#datepick-div table.datepick tr td { |
| 1584 |
padding: 0 !important; |
| 1585 |
} |
| 1586 |
#datepick-div .datepick-one-month { |
| 1587 |
height: auto; |
| 1588 |
} |
| 1589 |
</style> |
| 1590 |
<?php |
| 1591 |
} |
| 1592 |
|
| 1593 |
|
| 1594 |
/** Sortable Table JavaScript */ |
| 1595 |
function wpbc_sortable_js() { |
| 1596 |
?> |
| 1597 |
<script type="text/javascript"> |
| 1598 |
// Activate Sortable Functionality |
| 1599 |
jQuery( document ).ready(function(){ |
| 1600 |
|
| 1601 |
jQuery('.wpbc_input_table tbody th').css('cursor','move'); |
| 1602 |
|
| 1603 |
jQuery('.wpbc_input_table tbody td.sort').css('cursor','move'); |
| 1604 |
|
| 1605 |
jQuery('.wpbc_input_table.sortable tbody').sortable({ |
| 1606 |
items:'tr', |
| 1607 |
cursor:'move', |
| 1608 |
axis:'y', |
| 1609 |
scrollSensitivity:40, |
| 1610 |
forcePlaceholderSize: true, |
| 1611 |
helper: 'clone', |
| 1612 |
opacity: 0.65, |
| 1613 |
placeholder: '.wpbc_sortable_table .sort', |
| 1614 |
start:function(event,ui){ |
| 1615 |
ui.item.css('background-color','#f6f6f6'); |
| 1616 |
}, |
| 1617 |
stop:function(event,ui){ |
| 1618 |
ui.item.removeAttr('style'); |
| 1619 |
} |
| 1620 |
}); |
| 1621 |
}); |
| 1622 |
</script> |
| 1623 |
<?php |
| 1624 |
|
| 1625 |
} |
| 1626 |
|