$el_id // HTML ID of element
, 'name' => $el_id
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) //FixIn: 9.6.1.5
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'disabled' => false
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'legend' => '' // aria-label parameter
, 'value' => $el_value // Some Value from optins array that selected by default
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code
, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' )
);
wpbc_flex_toggle( $params_checkbox );
?>
__( 'Help', 'booking' )
, 'font_icon' => 'wpbc_icn_support' //FixIn: 9.0.1.4 'glyphicon glyphicon-question-sign'
, 'position' => 'right'
, 'items' => array(
array( 'type' => 'link', 'title' => "What's New"/*__('Get Started')*/, 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) ) )
, array( 'type' => 'divider' )
, array( 'type' => 'link', 'title' => __('Help', 'booking'), 'url' => 'https://wpbookingcalendar.com/help/' )
, array( 'type' => 'link', 'title' => __('FAQ', 'booking'), 'url' => 'https://wpbookingcalendar.com/faq/' )
, array( 'type' => 'link', 'title' => __('Technical Support', 'booking'), 'url' => 'https://wpbookingcalendar.com/support/' )
, array( 'type' => 'divider' )
, array( 'type' => 'link', 'title' => __('About Booking Calendar', 'booking')
// , 'url' => wpbc_up_link()
, 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about-premium' ), 'index.php' ) ) )
, 'attr' => array(
// 'target' => '_blank'
'style' => 'font-weight: 600;font-size: 1em;'
)
)
)
) );
}
/** View Mode - B u t t o n */
function wpbc_toolbar_btn__view_mode() {
$selected_view_mode = ( isset( $_REQUEST['view_mode'] ) ) ? $_REQUEST['view_mode'] : '';
$bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ), array('view_mode', 'wh_booking_id', 'page_num' ) );
$params = array();
//FixIn: 9.6.3.5
$is_selected = ( ( $selected_view_mode == 'vm_booking_listing' ) || ( $selected_view_mode == 'vm_listing' ) ) ? true : false;
$params['btn_vm_listing_new'] = array(
'title' => ''
, 'hint' => array( 'title' => __('Booking Listing' ,'booking') , 'position' => 'top' )
, 'selected' => $is_selected
, 'link' => wpbc_get_bookings_url('booking-listing', true ) . '&view_mode=vm_booking_listing'
, 'icon' => ''
, 'font_icon' => 'wpbc-bi-collection'//'glyphicon glyphicon-align-justify'
);
$bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ) , array() // Exclude Value of this parameter
, array( 'page', 'tab', 'tab_cvm', 'wh_booking_type', 'scroll_start_date', 'scroll_month', 'view_days_num'
, 'wh_trash' //FixIn: 6.1.1.10
) // Only this parameters
);
$params['btn_vm_calendar'] = array(
'title' => ''
, 'hint' => array( 'title' => __('Calendar Overview' ,'booking') , 'position' => 'bottom' )
, 'selected' => ( $selected_view_mode == 'vm_calendar' ) ? true : false
, 'link' => $bk_admin_url . '&view_mode=vm_calendar'
, 'icon' => ''
, 'font_icon' => 'wpbc-bi-calendar2-range'// 'glyphicon glyphicon-calendar'
);
?>
'calendar_overview_number_of_days_to_show' // "For" parameter of button group element
, 'label' => '' //__('Calendar view mode', 'booking') // Label above the button group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'button'
, 'title' => __('Day', 'booking') . ' ' // Title of the button //FixIn: Flex TimeLine 1.0
, 'hint' => array( 'title' => __('Show day' ,'booking') , 'position' => 'top' ) // Hint
, 'font_icon' => 'wpbc-bi-calendar-event'
// , 'title' => __('Month', 'booking') . ' ' // Title of the button
// , 'hint' => array( 'title' => __('Show month' ,'booking') , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url . '&view_days_num=30' // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary btn_dn_30' // button-secondary | button-primary
, 'icon' => ''
// , 'font_icon' => 'glyphicon glyphicon-align-justify'
, 'icon_position' => 'right' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => __('Week', 'booking') . ' ' // Title of the button //FixIn: Flex TimeLine 1.0
, 'hint' => array( 'title' => __('Show week' ,'booking') , 'position' => 'top' ) // Hint
, 'font_icon' => 'wpbc-bi-calendar-week'
// , 'title' => __('3 Months', 'booking') . ' ' // Title of the button
// , 'hint' => array( 'title' => __('Show 3 months' ,'booking') , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url . '&view_days_num=90' // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary btn_dn_90' // button-secondary | button-primary
, 'icon' => ''
// , 'font_icon' => 'glyphicon glyphicon-th-list'
, 'icon_position' => 'right' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => __('Month', 'booking') . ' ' // Title of the button
, 'hint' => array( 'title' => __('Show month' ,'booking') , 'position' => 'top' ) // Hint
, 'font_icon' => 'wpbc-bi-calendar3'
// , 'title' => __('Year', 'booking') . ' ' // Title of the button
// , 'hint' => array( 'title' => __('Show year' ,'booking') , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url . '&view_days_num=365' // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary btn_dn_365' // button-secondary | button-primary
, 'icon' => ''
// , 'font_icon' => 'glyphicon glyphicon-th'
, 'icon_position' => 'right' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
)
);
} else {
$params = array(
'label_for' => 'calendar_overview_number_of_days_to_show' // "For" parameter of button group element
, 'label' => '' //__('Calendar view mode:', 'booking') // Label above the button group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'button'
, 'title' => __('Day', 'booking') . ' ' // Title of the button
, 'hint' => array( 'title' => __('Show day' ,'booking') , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url . '&view_days_num=1' // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary btn_dn_1' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc-bi-calendar-event' //'wpbc_icn_event'
, 'icon_position' => 'right' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => __('Week', 'booking') . ' ' // Title of the button
, 'hint' => array( 'title' => __('Show week' ,'booking') , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url . '&view_days_num=7' // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary btn_dn_7' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc-bi-calendar-week'//'wpbc_icn_calendar_view_week'
, 'icon_position' => 'right' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => __('Month', 'booking') . ' ' // Title of the button
, 'hint' => array( 'title' => __('Show month' ,'booking') , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url . '&view_days_num=30' // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary btn_dn_30' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc-bi-calendar3'//'wpbc_icn_calendar_view_month'
, 'icon_position' => 'right' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => __('2 Months', 'booking') . ' ' // Title of the button
, 'hint' => array( 'title' => __('Show 2 months' ,'booking') , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url . '&view_days_num=60' // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary btn_dn_60' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc-bi-calendar2-week'//'wpbc_icn_density_medium'
, 'icon_position' => 'right' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
)
);
}
wpbc_bs_button_group( $params );
//FixIn: 7.0.1.10
?> 'calendar_overview_navigation' // "For" parameter of button group element
, 'label' => '' //__('Calendar Navigation', 'booking') // Label above the button group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'button'
, 'title' => '' // Title of the button
, 'hint' => array( 'title' => $scroll_titles[0] , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url .$scroll_params[0] // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc_icn_keyboard_double_arrow_left'
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => '' // Title of the button
, 'hint' => array( 'title' => $scroll_titles[1] , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url .$scroll_params[1] // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc_icn_keyboard_arrow_left'
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'dropdown'
, 'id' => 'timeline_navigation_date'
, 'title' => '' // Title of the button
, 'hint' => array( 'title' => __('Custom' ,'booking') , 'position' => 'top' ) // Hint
, 'class' => 'button-secondary' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc_icn_gps_fixed'
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
, 'options' => array(
$scroll_titles[2] => "window.location.href='"
. wpbc_get_params_in_url( wpbc_get_bookings_url( false )
, array('scroll_month', 'scroll_day', 'scroll_start_date') )
. $scroll_params[2] . "'"
, 'divider1' => 'divider'
, 'custom' => array( array( 'type' => 'group', 'class' => 'input-group text-group')
, array(
'type' => 'text'
, 'id' => 'calendar_overview_navigation_currentdate'
, 'name' => 'calendar_overview_navigation_currentdate'
, 'label' => __('Start Date' ,'booking') . ':'
, 'disabled' => false
, 'class' => 'wpdevbk-filters-section-calendar'
, 'style' => ''
, 'placeholder' => date('Y-m-d')
, 'attr' => array()
, 'value' => ''
)
)
, 'divider2' => 'divider'
, 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group' ),
array(
'type' => 'button'
, 'title' => __('Apply' ,'booking') // Title of the button
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
, 'link' => 'javascript:void(0)' // Direct link or skip it
, 'action' => "jQuery('#calendar_overview_navigation_container').hide();
window.location.href='"
. wpbc_get_params_in_url( wpbc_get_bookings_url( false )
, array('scroll_month', 'scroll_day', 'scroll_start_date') )
. "&scroll_start_date=' + jQuery('#calendar_overview_navigation_currentdate').val();"
, 'class' => 'button-primary' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => ''
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => __('Close' ,'booking') // Title of the button
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
, 'link' => 'javascript:void(0)' // Direct link or skip it
//, 'action' => '' // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => ''
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
)
)
)
, array(
'type' => 'button'
, 'title' => '' // Title of the button
, 'hint' => array( 'title' => $scroll_titles[3] , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url .$scroll_params[3] // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc_icn_keyboard_arrow_right'
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
, array(
'type' => 'button'
, 'title' => '' // Title of the button
, 'hint' => array( 'title' => $scroll_titles[4] , 'position' => 'top' ) // Hint
, 'link' => $bk_admin_url .$scroll_params[4] // Direct link or skip it
, 'action' => "" // Some JavaScript to execure, for example run the function
, 'class' => 'button-secondary' // button-secondary | button-primary
, 'icon' => ''
, 'font_icon' => 'wpbc_icn_keyboard_double_arrow_right'
, 'icon_position' => 'left' // Position of icon relative to Text: left | right
, 'style' => '' // Any CSS class here
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
, 'attr' => array()
)
)
);
wpbc_bs_button_group( $params );
}
////////////////////////////////////////////////////////////////////////////////
// Toolbar Options B u t t o n s - Add New Booking //////////////////
////////////////////////////////////////////////////////////////////////////////
/** Genereate URL based on GET parameters */
function wpbc_get_new_booking_url__base( $skip_parameters = array() ) {
$link_base = wpbc_get_new_booking_url( true, false );
$link_params = array();
if ( ( isset( $_GET['booking_type'] ) ) && ( $_GET['booking_type'] > 0 ) ) $link_params['booking_type'] = $_GET['booking_type'];
if ( isset( $_GET['booking_hash'] ) ) $link_params['booking_hash'] = $_GET['booking_hash'];
if ( isset( $_GET['parent_res'] ) ) $link_params['parent_res'] = $_GET['parent_res'];
if ( isset( $_GET['booking_form'] ) ) $link_params['booking_form'] = $_GET['booking_form'];
if ( isset( $_GET['calendar_months_count'] ) ) $link_params['calendar_months_count'] = intval( $_GET['calendar_months_count'] );
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'] );
foreach ( $link_params as $key => $value ) {
if ( ! in_array( $key, $skip_parameters) ) {
$link_base .= '&' . $key . '=' . $value;
}
}
return $link_base;
}
/** Selection Number of visible months */
function wpbc_toolbar_btn__calendar_months_number_selection( $user_calendar_options = array() ) {
$text_label = __('Visible months' ,'booking') .':' ;
$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 );
$parameter_name = 'calendar_months_count';
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval ( $user_calendar_options[ $parameter_name ] );
else $selected_value = 1;
$link_base = wpbc_get_new_booking_url__base( array( $parameter_name ) ) . '&' . $parameter_name . '=' ;
$on_change = ''; //'location.href=\'' . $link_base . '\' + this.value;';
$params = array(
'label_for' => $parameter_name // "For" parameter of label element
, 'label' => '' // Label above the input group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'addon'
, 'element' => 'text' // text | radio | checkbox
, 'text' => $text_label
, 'class' => '' // Any CSS class here
, 'style' => 'font-weight:600;' // CSS Style of entire div element
)
, array(
'type' => 'select'
, 'id' => $parameter_name // HTML ID of element
, 'options' => $form_options // Associated array of titles and values
, 'value' => $selected_value // Some Value from optins array that selected by default
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'onchange' => $on_change
)
)
);
?>
__('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 );
$parameter_name = 'calendar_months_num_in_1_row';
if ( isset( $user_calendar_options[$parameter_name] ) ) $selected_value = intval ( $user_calendar_options[ $parameter_name ] );
else $selected_value = 0;
$link_base = wpbc_get_new_booking_url__base( array( $parameter_name ) ) . '&' . $parameter_name . '=' ;
$on_change = ''; // 'location.href=\'' . $link_base . '\' + this.value;';
$params = array(
'label_for' => $parameter_name // "For" parameter of label element
, 'label' => '' // Label above the input group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'addon'
, 'element' => 'text' // text | radio | checkbox
, 'text' => $text_label
, 'class' => '' // Any CSS class here
, 'style' => 'font-weight:600;' // CSS Style of entire div element
)
, array(
'type' => 'select'
, 'id' => $parameter_name // HTML ID of element
, 'options' => $form_options // Associated array of titles and values
, 'value' => $selected_value // Some Value from optins array that selected by default
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'onchange' => $on_change
)
)
);
?>
$parameter_name // "For" parameter of label element
, 'label' => '' // Label above the input group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'addon'
, 'element' => 'text' // text | radio | checkbox
, 'text' => $text_label
, 'class' => '' // Any CSS class here
, 'style' => 'font-weight:600;' // CSS Style of entire div element
)
, array(
'type' => 'text'
, 'id' => $parameter_name // HTML ID of element
, 'value' => $selected_value // Some Value from optins array that selected by default
, 'style' => 'width: 5em;' // CSS of select element
, 'placeholder' => '100%'
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
)
, array(
'type' => 'select'
, 'id' => $parameter_name . 'units' // HTML ID of element
, 'options' => array( 'px' => 'px', 'percent' => '%' ) // Associated array of titles and values
, 'value' => $selected_value_units // Some Value from optins array that selected by default
, 'style' => 'width: 5em;' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
)
)
);
?>
$parameter_name // "For" parameter of label element
, 'label' => '' // Label above the input group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'addon'
, 'element' => 'text' // text | radio | checkbox
, 'text' => $text_label
, 'class' => '' // Any CSS class here
, 'style' => 'font-weight:600;' // CSS Style of entire div element
)
, array(
'type' => 'text'
, 'id' => $parameter_name // HTML ID of element
, 'value' => $selected_value // Some Value from optins array that selected by default
, 'style' => 'width: 5em;' // CSS of select element
, 'placeholder' => '48px'
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
)
, array(
'type' => 'select'
, 'id' => $parameter_name . 'units' // HTML ID of element
, 'options' => array( 'px' => 'px', 'percent' => '%' ) // Associated array of titles and values
, 'value' => $selected_value_units // Some Value from optins array that selected by default
, 'style' => 'width: 5em;' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
)
)
);
?>
$el_id // HTML ID of element
, 'name' => $el_id
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) //FixIn: 9.6.1.5
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'disabled' => false
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'legend' => '' // aria-label parameter
, 'value' => $el_value // Some Value from optins array that selected by default
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
, 'onchange' => "document.getElementById('is_send_email_for_pending').checked = this.checked;" // JavaScript code
, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' )
);
wpbc_flex_toggle( $params_checkbox );
?>
__( 'Add to Google Calendar', 'booking' )
, 'hint' => __( 'Add to Google Calendar', 'booking' )
, 'class' => 'button-secondary button'
, 'is_show_icon' => true
, 'is_only_url' => false
);
$button_attr = wp_parse_args( $button_attr, $defaults );
$params = array();
$params['timezone'] = get_bk_option('booking_gcal_timezone');
$booking_gcal_events_form_fields = get_bk_option( 'booking_gcal_events_form_fields');
if ( is_serialized( $booking_gcal_events_form_fields ) )
$booking_gcal_events_form_fields = unserialize( $booking_gcal_events_form_fields );
/**
* Array
(
[title] => text^name
[description] => textarea^details
[where] => text^
)
*/
// Fields
$fields = array( 'title' => '', 'description' => '', 'where' => '' );
foreach ( $fields as $key_name => $field_value ) {
if ( ! empty( $booking_gcal_events_form_fields[ $key_name ] ) ) {
$field_name = explode( '^', $booking_gcal_events_form_fields[ $key_name ] );
$field_name = $field_name[ ( count( $field_name ) - 1 ) ]; //FixIn: 8.7.7.6
if ( (! empty($field_name))
&& (! empty($booking_data['form_data']))
&& (! empty($booking_data['form_data']['_all_fields_']))
&& (! empty($booking_data['form_data']['_all_fields_'][ $field_name ]))
) {
if ( 'description' === $key_name ) { //FixIn: 8.1.3.2
if ( isset( $booking_data['form_show'] ) ) { //FixIn: 8.7.3.14
//FixIn: 8.7.11.4
$fields[ $key_name ] = $booking_data['form_show'];
$fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES );
$fields[ $key_name ] = urlencode($fields[ $key_name ]);
$fields[ $key_name ] = htmlentities($fields[ $key_name ] );
$fields[ $key_name ] = htmlspecialchars_decode ( $fields[ $key_name ], ENT_NOQUOTES );
}
} else {
//FixIn: 8.7.11.4
$fields[ $key_name ] = $booking_data['form_data']['_all_fields_'][ $field_name ];
$fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES );
// Convert here from usual symbols to URL symbols https://www.url-encode-decode.com/
// $fields[ $key_name ] = str_replace( array( '%','#', '+', '&' )
// , array( '%25','%23', '%2B', '%26')
// , $fields[ $key_name ]
// );
$fields[ $key_name ] = urlencode($fields[ $key_name ]);
$fields[ $key_name ] = htmlentities($fields[ $key_name ] );
$fields[ $key_name ] = htmlspecialchars_decode ( $fields[ $key_name ], ENT_NOQUOTES );
}
}
}
}
//debuge($booking_gcal_events_form_fields, $fields,$booking_data['form_data']);
// Dates.
$check_in_timestamp = $check_out_timestamp = '';
if ( ! empty( $booking_data[ 'dates_short' ] ) ) {
/* all day events, you can use 20161208/20161209 - note that the old google documentation gets it wrong.
* You must use the following date as the end date for a one day all day event,
* or +1 day to whatever you want the end date to be.
*/
$check_in_timestamp = strtotime( $booking_data[ 'dates_short' ][ 0 ], current_time( 'timestamp' ) );
if ( trim( substr( $booking_data[ 'dates_short' ][ 0 ], 11 ) ) == '00:00:00' ) {
$check_in_timestamp = date( "Ymd", $check_in_timestamp ); // All day
} else {
$check_in_timestamp = date( "Ymd\THis", $check_in_timestamp );
//$check_in_timestamp = date( "Ymd\THis\Z", $check_in_timestamp );
}
$check_out_timestamp = strtotime( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], current_time( 'timestamp' ) );
if ( trim( substr( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], 11 ) ) == '00:00:00' ) {
$check_out_timestamp = strtotime( '+1 day', $check_out_timestamp );
$check_out_timestamp = date( "Ymd", $check_out_timestamp ); // All day
} else {
$check_out_timestamp = date( "Ymd\THis", $check_out_timestamp );
//$check_out_timestamp = date( "Ymd\THis\Z", $check_out_timestamp );
}
}
//debuge($check_in_timestamp,$check_out_timestamp, $fields );die;
//Convert an ISO date/time to a UNIX timestamp
//function iso_to_ts( $iso ) {
// sscanf( $iso, "%u-%u-%uT%u:%u:%uZ", $year, $month, $day, $hour, $minute, $second );
// return mktime( intval($hour), intval($minute), intval($second), intval($month), intval($day), intval($year) );
// 20140127T224000Z
// date("Ymd\THis\Z", time());
/**
action:
action=TEMPLATE
A default required parameter.
src:
Example: src=default%40gmail.com
Format: src=text
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.
text:
Example: text=Garden%20Waste%20Collection
Format: text=text
This is a required parameter giving the event title.
dates:
Example: dates=20090621T063000Z/20090621T080000Z (i.e. an event on 21 June 2009 from 7.30am to 9.0am British Summer Time (=GMT+1)).
Format: dates=YYYYMMDDToHHMMSSZ/YYYYMMDDToHHMMSSZ
This required parameter gives the start and end dates and times (in Greenwich Mean Time) for the event.
location:
Example: location=Home
Format: location=text
The obvious location field.
trp:
Example: trp=false
Format: trp=true/false
Show event as busy (true) or available (false)
sprop:
Example: sprop=http%3A%2F%2Fwww.me.org
Example: sprop=name:Home%20Page
Format: sprop=website and/or sprop=name:website_name
*/
// $link_add2gcal = 'http://www.google.com/calendar/event?action=TEMPLATE';
// $link_add2gcal .= '&text=' . $fields['title'];
//FixIn: 8.7.3.10
$link_add2gcal = 'https://calendar.google.com/calendar/r/eventedit?';
$link_add2gcal .= 'text=' . $fields['title']; //FixIn: 8.7.11.4
//$link_add2gcal .= '&dates=[start-custom format='Ymd\\THi00\\Z']/[end-custom format='Ymd\\THi00\\Z']';
$link_add2gcal .= '&dates=' . $check_in_timestamp . '/' . $check_out_timestamp;
$link_add2gcal .= '&details=' . $fields['description']; //FixIn: 8.7.11.4
$link_add2gcal .= '&location=' . $fields['where']; //FixIn: 8.7.11.4
$link_add2gcal .= '&trp=false';
if ( ! empty( $params['timezone'] ) ) {
$link_add2gcal .= '&ctz=' . str_replace( '%', '%25', $params['timezone'] ); //FixIn: 8.7.3.10 //TimeZone
}
//$link_add2gcal .= '&sprop=';
//$link_add2gcal .= '&sprop=name:';
if ( $button_attr['is_only_url'] ) {
echo $link_add2gcal;
} else {
?> 'resources_count'
, 'title' => __('Resources count' ,'booking') . ':'
, 'selected' => 1
, 'options' => array_combine( range(1, 201) ,range(1, 201) )
) ) ;
*/
function wpbc_toolbar_btn__selection_element( $params ) {
$defaults = array(
'name' => 'random_' . rand( 1000, 10000 )
, 'title' => __('Total', 'booking') . ':'
, 'on_change' => '' //'location.href=\'' . $link_base . '\' + this.value;'; //$link_base = wpbc_get_new_booking_url__base( array( $params['name'] ) ) . '&' . $params['name'] . '=' ;
, 'options' => array()
, 'selected' => 0
);
$params = wp_parse_args( $params, $defaults );
for ( $i = 1; $i < 201; $i++ ) {
$form_options[ $i ] = $i;
}
$params = array(
'label_for' => $params['name'] // "For" parameter of label element
, 'label' => '' // Label above the input group
, 'style' => '' // CSS Style of entire div element
, 'items' => array(
array(
'type' => 'addon'
, 'element' => 'text' // text | radio | checkbox
, 'text' => $params['title']
, 'class' => '' // Any CSS class here
, 'style' => 'font-weight:600;' // CSS Style of entire div element
)
, array(
'type' => 'select'
, 'id' => $params['name'] // HTML ID of element
, 'name' => $params['name'] // HTML ID of element
, 'options' => $params['options'] // Associated array of titles and values
, 'value' => $params['selected'] // Some Value from optins array that selected by default
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'onchange' => $params['on_change']
)
)
);
?>
array( 'search_get_key' => 'wh_resource_id' )
*/
function wpbc_hidden_search_by_id_field_in_main_form( $params = array() ){
$defaults = array(
'search_get_key' => 'wh_search_id'
);
$params = wp_parse_args( $params, $defaults );
$search_form_value = '';
if ( isset( $_REQUEST[ $params[ 'search_get_key' ] ] ) ) {
$wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params[ 'search_get_key' ] ] ); // '12,0,45,9' or '10'
$wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params[ 'search_get_key' ] ] ); // Clean string
if ( ! empty( $wh_resource_id ) ) {
$search_form_value = $wh_resource_id;
} else {
$search_form_value = $wh_resource_title;
}
}
if ( '' !== $search_form_value ) {
?> 'wpbc_seasonfilters_search_form'
, 'search_get_key' => 'wh_search_id'
, 'is_pseudo' => false
) );
*/
function wpbc_toolbar_search_by_id__top_form( $params ) {
$defaults = array(
'search_form_id' => 'wpbc_seasonfilters_search_form'
, 'search_get_key' => 'wh_search_id'
, 'is_pseudo' => false //'location.href=\'' . $link_base . '\' + this.value;'; //$link_base = wpbc_get_new_booking_url__base( array( $params['name'] ) ) . '&' . $params['name'] . '=' ;
, 'container_style' => 'position: absolute; right: 20px; top: 0px;z-index: 0;' //FixIn: 10.0.0.29
);
$params = wp_parse_args( $params, $defaults );
$exclude_params = array(); //array('page_num', 'orderby', 'order'); - if using "only_these_parameters", then this parameter does NOT require
$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
$wpbc_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false, false ), $exclude_params, $only_these_parameters );
$search_form_value = '';
if ( isset( $_REQUEST[ $params[ 'search_get_key' ] ] ) ) {
$wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params[ 'search_get_key' ] ] ); // '12,0,45,9' or '10'
$wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params[ 'search_get_key' ] ] ); // Clean string
if ( ! empty( $wh_resource_id ) ) {
$search_form_value = $wh_resource_id;
} else {
$search_form_value = $wh_resource_title;
}
}
wpbc_clear_div();
?>