__('Booking Calendar Form', 'booking')
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__general').show();"
, 'font_icon' => 'wpbc-bi-calendar3-range'
, 'default' => true
) );
wpbc_bs_display_tab( array(
'title' => __('Conditional Days Selection', 'booking')
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__conditions').show();"
, 'font_icon' => 'wpbc-bi-calendar2-week'
, 'default' => false
, 'css_classes' => 'wpbc_dismiss__conditional_days'
) );
wpbc_bs_display_tab( array(
'title' => __('Aggregate', 'booking')
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__aggregate').show();"
, 'font_icon' => 'wpbc-bi-calendar2-plus'
, 'default' => false
, 'css_classes' => 'wpbc_dismiss__booking_param_aggregate'
) );
wpbc_bs_display_tab( array(
'title' => __('Advanced', 'booking')
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__other').show();"
, 'font_icon' => 'wpbc_icn_tune'
, 'default' => false
) );
wpbc_bs_toolbar_tabs_html_container_end();
}
// =====================================================================================================================
// Fields
// =====================================================================================================================
/**
* Shortcode Field: Select-box - "Booking Resource"
*
* @param $id
* @param $group_key
*
* @return void
*/
function wpbc_shortcode_config_fields__select_resource( $id , $group_key ){
if ( class_exists( 'wpdev_bk_personal' ) ){
WPBC_Settings_API::field_select_row_static( $id
, array(
'type' => 'select'
, 'title' => __( 'Booking resource', 'booking')
, 'description' => __( 'Select booking resource', 'booking' )
, 'description_tag' => 'span'
, 'label' => ''
, 'multiple' => false
, 'group' => $group_key
, 'tr_class' => $group_key . '_standard_section'
, 'class' => ''
, 'css' => 'margin-right:10px;'
, 'only_field' => false
, 'attr' => array()
, 'value' => ''
, 'options' => wpbc_get_all_booking_resources_list()
) );
}
}
/**
* Shortcode Field: Select-box - "Custom Booking Form"
*
* @param $id
* @param $group_key
*
* @return void
*/
function wpbc_shortcode_config_fields__select_custom_form( $id , $group_key ){
WPBC_FE_Custom_Form_Helper::wpbc_bfb__custom_booking_forms_list__selectbox_html__sh_modal(
array(
'name' => $id,
'title' => __( 'Booking Form', 'booking' ),
'description' => __( 'Select custom booking form', 'booking' ),
'group' => $group_key,
)
);
}
/**
* Shortcode Field: Select-box - "Calendar Months Number"
*
* @param $id
* @param $group_key
*
* @return void
*/
function wpbc_shortcode_config_fields__select_nummonths( $id , $group_key ){
WPBC_Settings_API::field_select_row_static( $id
, array(
'type' => 'select'
, 'title' => __('Visible months', 'booking')
, 'description' => __('Select number of month to show for calendar.' ,'booking')
, 'description_tag' => 'span'
, 'label' => ''
, 'multiple' => false
, 'group' => $group_key
, 'tr_class' => $group_key . '_standard_section'
, 'class' => ''
, 'css' => 'margin-right:10px;'
, 'only_field' => false
, 'attr' => array()
, 'value' => get_bk_option( 'booking_client_cal_count' )
, 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) )
)
);
}
/**
* Shortcode Fields: OPTION - "Define Calendar Size"
*
* @param $id
* @param $group_key
*
* @return void
*/
function wpbc_shortcode_config_fields__calendar_size( $id , $group_key ){
// ---------------------------------------------------------------------------------------------------------
WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled'
, array(
'type' => 'checkbox'
, 'title' => __('Setup Size & Structure', 'booking')
, 'description' => __('Configure Calendar Size and Structure', 'booking')
, 'description_tag' => 'span'
, 'label' => ''
, 'class' => ''
, 'css' => ''
, 'tr_class' => ''
, 'attr' => array()
, 'group' => $group_key
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed'
, 'only_field' => !true
, 'is_new_line' => false
, 'value' => false
)
);
WPBC_Settings_API::field_select_row_static( $id . '_months_num_in_row'
, array(
'type' => 'select'
, 'title' => __('Number of months in a row', 'booking')
, 'description' => __('Select the number of months to show in one row on a wide screen.' ,'booking')
, 'description_tag' => 'span'
, 'label' => ''
, 'multiple' => false
, 'group' => $group_key
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_calendar_size'
, 'class' => ''
, 'css' => 'margin-right:10px;'
, 'only_field' => false
, 'attr' => array()
, 'value' => get_bk_option( 'booking_client_cal_count' )
, 'options' => array_combine( range( 1, 6 ), range( 1, 6 ) )
)
);
?>
|
|
|
|
|
'checkbox'
, 'title' => __( 'Open in popup', 'booking' )
, 'description' => __( 'Show a button that opens the booking form in a popup window.', 'booking' )
, 'description_tag' => 'span'
, 'label' => ''
, 'class' => ''
, 'css' => ''
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed'
, 'attr' => array()
, 'group' => $group_key
, 'only_field' => false
, 'is_new_line' => false
, 'value' => false
)
);
WPBC_Settings_API::field_text_row_static( $id . '_button_title'
, array(
'type' => 'text'
, 'title' => __( 'Button title', 'booking' )
, 'description' => __( 'Text on the button that opens the booking form popup.', 'booking' )
, 'description_tag' => 'span'
, 'placeholder' => __( 'Book now', 'booking' )
, 'class' => ''
, 'css' => ''
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
, 'attr' => array()
, 'group' => $group_key
, 'only_field' => false
, 'value' => __( 'Book now', 'booking' )
)
);
WPBC_Settings_API::field_text_row_static( $id . '_title'
, array(
'type' => 'text'
, 'title' => __( 'Popup title', 'booking' )
, 'description' => __( 'Title displayed in the popup header.', 'booking' )
, 'description_tag' => 'span'
, 'placeholder' => __( 'Booking Form', 'booking' )
, 'class' => ''
, 'css' => ''
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
, 'attr' => array()
, 'group' => $group_key
, 'only_field' => false
, 'value' => __( 'Booking Form', 'booking' )
)
);
WPBC_Settings_API::field_text_row_static( $id . '_button_class'
, array(
'type' => 'text'
, 'title' => __( 'Button CSS class', 'booking' )
, 'description' => __( 'CSS class for the popup button.', 'booking' )
, 'description_tag' => 'span'
, 'placeholder' => 'wp-element-button'
, 'class' => ''
, 'css' => ''
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
, 'attr' => array()
, 'group' => $group_key
, 'only_field' => false
, 'value' => 'wp-element-button'
)
);
WPBC_Settings_API::field_text_row_static( $id . '_modal_class'
, array(
'type' => 'text'
, 'title' => __( 'Popup CSS class', 'booking' )
, 'description' => __( 'Optional CSS class for the popup modal.', 'booking' )
, 'description_tag' => 'span'
, 'placeholder' => ''
, 'class' => ''
, 'css' => ''
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
, 'attr' => array()
, 'group' => $group_key
, 'only_field' => false
, 'value' => ''
)
);
WPBC_Settings_API::field_select_row_static( $id . '_size'
, array(
'type' => 'select'
, 'title' => __( 'Popup size', 'booking' )
, 'description' => __( 'Select the popup window size.', 'booking' )
, 'description_tag' => 'span'
, 'label' => ''
, 'multiple' => false
, 'group' => $group_key
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
, 'class' => ''
, 'css' => 'margin-right:10px;'
, 'only_field' => false
, 'attr' => array()
, 'value' => 'lg'
, 'options' => array(
'lg' => __( 'Large', 'booking' ),
'default' => __( 'Default', 'booking' ),
'sm' => __( 'Small', 'booking' ),
)
)
);
}
/**
* Shortcode Fields: Start Month
*
* @param $id
* @param $group_key
*
* @return void
*/
function wpbc_shortcode_config_fields__start_month( $id , $group_key ){
////////////////////////////////////////////////////////////////////
// Start Month
////////////////////////////////////////////////////////////////////
?>
|
|
|
|
|
|
'widget_wpbc_dismiss__booking_param_aggregate',
'dismiss_css_class' => '.wpbc_dismiss__booking_param_aggregate',
'blured_in_versions' => array( 'free' ),
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#booking-resources' ),
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
'versions' => 'paid versions',
'css' => 'transform: translate(0) translateY(180px);'
) );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $upgrade_content_arr['content'];
//--------------------------------------------------------------------------------------------------------------
// Real Content
//--------------------------------------------------------------------------------------------------------------
$resources_list = array();
if ( class_exists( 'wpdev_bk_personal' ) ){
$resources_list_orig = wpbc_get_all_booking_resources_list();
$resources_list[0] = array( 'title' => __('None', 'booking' ), 'attr' => array ( 'class' => 'wpbc_single_resource', 'style' => 'border-bottom:1px dashed #ddd;') );
foreach ($resources_list_orig as $res_id => $res_val) {
$resources_list[$res_id] = $res_val;
}
}
?>
-
-
'
. esc_html__( 'Hold down the Ctrl button to make multiple selections.', 'booking' );
echo ' ' . esc_html__( 'Code Example', 'booking' ) . ': '
. '
[booking resource_id=1 aggregate=\'3;5;9\']';
?>
-
', ''
, 'Booking > Availability > Days Availability'
) );
?>
' . esc_html__( 'Code Example', 'booking' ) . ': '
, '
[booking resource_id=1 aggregate=\'3;5;9\' options=\'{aggregate type=bookings_only}\']';
?>
-
', ''
, '', '' ) );
?>
$id . '_' . 'conditional_days_weekdays',
'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
'blured_in_versions' => array( 'free', 'ps', 'bs' ),
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
'versions' => 'Business Medium / Large, MultiUser versions',
'css' => 'transform: translate(0) translateY(120px);'
) );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $upgrade_content_arr['content'];
//--------------------------------------------------------------------------------------------------------------
// Conditions for Weekdays selection
//--------------------------------------------------------------------------------------------------------------
?>
-
-
' . esc_html__( 'Code Example', 'booking' ) . ': '
. '
{select-day condition="weekday" for="1" value="5,7"},{select-day condition="weekday" for="6" value="2-7"}';
?>
-
', ''
, '', '' ) );
?>
-
','') );
?>
$id . '_' . 'conditional_days_seasons',
'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
'blured_in_versions' => array( 'free', 'ps', 'bs' ),
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
'versions' => 'Business Medium / Large, MultiUser versions',
'css' => 'transform: translate(0) translateY(120px);'
) );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $upgrade_content_arr['content'];
//--------------------------------------------------------------------------------------------------------------
// Conditions for Seasons days selection
//--------------------------------------------------------------------------------------------------------------
$options = wpbc_shortcode_config_fields__get_options_for_seasons();
?>
-
-
' . esc_html__( 'Code Example', 'booking' ) . ': '
. '
{select-day condition="season" for="High season" value="7-14,21"},{select-day condition="season" for="Low season" value="2-5"}';
?>
-
', ''
, '', '' ) );
?>
-
','') );
?>
get_data() = [
* 1 => [
* booking_filter_id = "1"
* title = "Weekend"
* filter = "a:4:{s:8:"weekdays";a:7..."
* users = "1"
* id = "1"
*/
$season_filter_arr = $wpbc_sf_cache->get_data();
} else {
$season_filter_arr = array();
}
// $wpbc_br_cache = wpbc_br_cache();
/*
$wpbc_br_cache->get_resources() = [
1 = [
booking_type_id = "1"
title = "Standard"
users = "1"
import = null
export = "/ics/wpbm.ics"
cost = "25"
default_form = "standard"
prioritet = "1"
parent = "0"
visitors = "2"
id = "1"
count = {int} 5
7 = [...
*/
$current_user_id = wpbc_get_current_user_id();
$options = array(
0 => array(
'title' => ' - ' . __( 'Please Select', 'booking' ) . ' - ',
'attr' => array( 'style' => 'color:#999;font-weight: 400;' )
)
);
foreach ( $season_filter_arr as $filter_id => $filter_arr ) {
$options[ $filter_arr['id'] ] = $filter_arr;
// MultiUser functionality for regular users showing season filters.
if ( ( class_exists( 'wpdev_bk_multiuser' ) ) && ( ! empty( $filter_arr['users'] ) ) ) {
// Is current user suer booking admin and if this user was simulated log in
$season_user_id = intval( $filter_arr['users'] );
$is_user_super_admin = apply_bk_filter( 'is_user_super_admin', $season_user_id );
if ( ( ! $is_user_super_admin ) && ( $current_user_id != $season_user_id ) ) {
$options[ $filter_arr['id'] ]['attr'] = array( 'style' => 'color:#a43232;font-weight: 400;font-style: italic;' );
$user_name = get_userdata( $season_user_id );
$user_name = $user_name->display_name;
$options[ $filter_arr['id'] ]['title'] .= ' (' . __( 'Regular User', 'booking' ) . ': ' . $user_name . ')';
}
}
}
return $options;
}
/**
* Season Days Start Day - Condition fields for 'option' parameter.
*
* @param $id
* @param $group_key
*
* @return void
*/
function wpbc_shortcode_config_fields__season_start_day_conditions( $id, $group_key ) {
//--------------------------------------------------------------------------------------------------------------
// 'Upgrade to Pro' widget
//--------------------------------------------------------------------------------------------------------------
$upgrade_content_arr = wpbc_get_upgrade_widget( array(
'id' => $id . '_' . 'conditional_days_startday',
'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
'blured_in_versions' => array( 'free', 'ps', 'bs' ),
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
'versions' => 'Business Medium / Large, MultiUser versions',
'css' => 'transform: translate(0) translateY(120px);'
) );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $upgrade_content_arr['content'];
//--------------------------------------------------------------------------------------------------------------
// Conditions for Seasons days START selection
//--------------------------------------------------------------------------------------------------------------
$options = wpbc_shortcode_config_fields__get_options_for_seasons();
?>
-
-
' . esc_html__( 'Code Example', 'booking' ) . ': '
. '
{start-day condition="season" for="Low season" value="0,5"}';
?>
-
', ''
, '', '' ) );
?>
-
','') );
?>
$id . '_' . 'conditional_days_fordate',
'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
'blured_in_versions' => array( 'free', 'ps', 'bs' ),
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
'versions' => 'Business Medium / Large, MultiUser versions',
'css' => 'transform: translate(0) translateY(120px);'
) );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $upgrade_content_arr['content'];
//--------------------------------------------------------------------------------------------------------------
// Conditions for DATE selection
//--------------------------------------------------------------------------------------------------------------
?>
-
-
' . esc_html__( 'Code Example', 'booking' ) . ': '
. '
{select-day condition="date" for="2027-02-15" value="7,14,21"}';
?>
-
', ''
, '', '' ) );
?>
-
','') );
?>