| 1 |
<?php |
| 2 |
/** |
| 3 |
* @version 1.0 |
| 4 |
* @package Booking Calendar Shortcodes Config |
| 5 |
* @subpackage Shortcodes Content - 'Booking Form': [bookingform type=1 selected_dates='03.03.2024'] |
| 6 |
* @category Shortcodes |
| 7 |
* |
| 8 |
* @author wpdevelop |
| 9 |
* @link https://wpbookingcalendar.com/ |
| 10 |
* @email info@wpbookingcalendar.com |
| 11 |
* |
| 12 |
* @modified 2024-03-03 |
| 13 |
*/ |
| 14 |
|
| 15 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.9.0.15. |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
// ===================================================================================================================== |
| 20 |
// Shortcode [booking ... ] |
| 21 |
// ===================================================================================================================== |
| 22 |
|
| 23 |
/** |
| 24 |
* Content of PopUp - for shortcode [booking ...] |
| 25 |
* |
| 26 |
* @return void |
| 27 |
*/ |
| 28 |
function wpbc_shortcode_config__content__bookingform() { |
| 29 |
|
| 30 |
$shortcode_name = 'bookingform'; |
| 31 |
|
| 32 |
?><div id="wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>" class="wpbc_sc_container__shortcode wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>"><?php |
| 33 |
|
| 34 |
wpbc_shortcode_config__bookingform__top_tabs(); |
| 35 |
|
| 36 |
// 'General' -------------------------------------------------------------------------------------------------- |
| 37 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__general"><?php |
| 38 |
|
| 39 |
//-------------------------------------------------------------------------------------------------------------- |
| 40 |
// 'Upgrade to Pro' widget |
| 41 |
//-------------------------------------------------------------------------------------------------------------- |
| 42 |
$upgrade_content_arr = wpbc_get_upgrade_widget( array( |
| 43 |
'id' => 'widget_wpbc_dismiss__booking_form_only', |
| 44 |
'dismiss_css_class' => '.wpbc_dismiss__booking_form_only', |
| 45 |
'blured_in_versions' => array( 'free', 'ps', 'bs', 'bm' ), |
| 46 |
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'faq/shortcode-booking-form-no-calendar/' ), |
| 47 |
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ), |
| 48 |
'versions' => 'Business Large, MultiUser versions', |
| 49 |
'css' => 'transform: translate(0) translateY(120px);' |
| 50 |
) ); |
| 51 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 52 |
echo $upgrade_content_arr['content']; |
| 53 |
|
| 54 |
//-------------------------------------------------------------------------------------------------------------- |
| 55 |
// Real Content |
| 56 |
//-------------------------------------------------------------------------------------------------------------- |
| 57 |
|
| 58 |
?><table class="form-table wpbc_dismiss__booking_form_only <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>"><tbody><?php |
| 59 |
|
| 60 |
// Booking Resource |
| 61 |
wpbc_shortcode_config_fields__select_resource( $shortcode_name . '_wpbc_resource_id', $shortcode_name ); |
| 62 |
|
| 63 |
// Custom form |
| 64 |
wpbc_shortcode_config_fields__select_custom_form( $shortcode_name . '_wpbc_custom_form', $shortcode_name ); |
| 65 |
|
| 66 |
// Date |
| 67 |
wpbc_shortcode_config_fields__booking_date_bookingform( $shortcode_name . '_wpbc_booking_date', $shortcode_name ); |
| 68 |
|
| 69 |
?></tbody></table> |
| 70 |
</div><?php |
| 71 |
|
| 72 |
|
| 73 |
?> |
| 74 |
<div class="wpbc_shortcode_config_content_toolbar__next_prior"> |
| 75 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button"> |
| 76 |
<span class="in-button-text">‹</span> |
| 77 |
</a> |
| 78 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button"> |
| 79 |
<span class="in-button-text">›</span> |
| 80 |
</a> |
| 81 |
</div> |
| 82 |
<?php |
| 83 |
|
| 84 |
?></div><?php |
| 85 |
|
| 86 |
wpbc_clear_div(); |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
/** |
| 91 |
* Top Tabs for shortcode [booking ...] |
| 92 |
* @return void |
| 93 |
*/ |
| 94 |
function wpbc_shortcode_config__bookingform__top_tabs(){ |
| 95 |
|
| 96 |
$shortcode_name = 'booking'; |
| 97 |
|
| 98 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 99 |
|
| 100 |
$js = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');" |
| 101 |
. "jQuery(this).addClass('nav-tab-active');" |
| 102 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 103 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 104 |
. "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();"; |
| 105 |
|
| 106 |
wpbc_bs_display_tab( array( |
| 107 |
'title' => __('Only form without calendar', 'booking') |
| 108 |
, 'text_css' => 'line-height: 18px;vertical-align: text-top;' |
| 109 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 110 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__general').show();" |
| 111 |
, 'font_icon' => 'menu_icon icon-1x menu_icon icon-1x wpbc-bi-card-checklist' |
| 112 |
, 'default' => true |
| 113 |
) ); |
| 114 |
// wpbc_bs_display_tab( array( |
| 115 |
// 'title' => __('Advanced', 'booking') |
| 116 |
// // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 117 |
// , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__other').show();" |
| 118 |
// , 'font_icon' => 'wpbc_icn_tune' |
| 119 |
// , 'default' => false |
| 120 |
// |
| 121 |
// ) ); |
| 122 |
|
| 123 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 124 |
} |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
// ===================================================================================================================== |
| 129 |
// Fields |
| 130 |
// ===================================================================================================================== |
| 131 |
|
| 132 |
|
| 133 |
/** |
| 134 |
* Shortcode Fields: Start Date: 2024-02-21 |
| 135 |
* |
| 136 |
* @param $id |
| 137 |
* @param $group_key |
| 138 |
* |
| 139 |
* @return void |
| 140 |
*/ |
| 141 |
function wpbc_shortcode_config_fields__booking_date_bookingform( $id , $group_key ){ |
| 142 |
|
| 143 |
//////////////////////////////////////////////////////////////////// |
| 144 |
// Start Month |
| 145 |
//////////////////////////////////////////////////////////////////// |
| 146 |
?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_sub_settings_grayed0"> |
| 147 |
<th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php esc_html_e('Booking Date', 'booking'); ?>:</label></th> |
| 148 |
<td class=""><fieldset><?php |
| 149 |
|
| 150 |
WPBC_Settings_API::field_select_row_static( $id . '_year' |
| 151 |
, array( |
| 152 |
'type' => 'select' |
| 153 |
, 'title' => '' |
| 154 |
, 'description' => '' |
| 155 |
, 'description_tag' => 'span' |
| 156 |
, 'label' => '' |
| 157 |
, 'multiple' => false |
| 158 |
, 'group' => $group_key |
| 159 |
, 'class' => '' |
| 160 |
, 'css' => 'width:5em;' |
| 161 |
, 'only_field' => true |
| 162 |
, 'attr' => array() |
| 163 |
, 'value' => gmdate( 'Y' ) |
| 164 |
, 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) ) |
| 165 |
) |
| 166 |
); |
| 167 |
|
| 168 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php |
| 169 |
|
| 170 |
WPBC_Settings_API::field_select_row_static( $id . '_month' |
| 171 |
, array( |
| 172 |
'type' => 'select' |
| 173 |
, 'title' => '' |
| 174 |
, 'description' => '' |
| 175 |
, 'description_tag' => 'span' |
| 176 |
, 'label' => '' |
| 177 |
, 'multiple' => false |
| 178 |
, 'group' => $group_key |
| 179 |
, 'class' => '' |
| 180 |
, 'css' => 'width:4em;' |
| 181 |
, 'only_field' => true |
| 182 |
, 'attr' => array() |
| 183 |
, 'value' => gmdate('n') |
| 184 |
, 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) ) |
| 185 |
) |
| 186 |
); |
| 187 |
|
| 188 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php |
| 189 |
|
| 190 |
WPBC_Settings_API::field_select_row_static( $id . '_day' |
| 191 |
, array( |
| 192 |
'type' => 'select' |
| 193 |
, 'title' => '' |
| 194 |
, 'description' => '' |
| 195 |
, 'description_tag' => 'span' |
| 196 |
, 'label' => '' |
| 197 |
, 'multiple' => false |
| 198 |
, 'group' => $group_key |
| 199 |
, 'class' => '' |
| 200 |
, 'css' => 'width:4em;' |
| 201 |
, 'only_field' => true |
| 202 |
, 'attr' => array() |
| 203 |
, 'value' => gmdate('j') |
| 204 |
, 'options' => array_combine( range( 1, 31 ), range( 1, 31 ) ) |
| 205 |
) |
| 206 |
); |
| 207 |
|
| 208 |
?><span class="description"> <?php esc_html_e('Select date, which you want to use for users to submit the bookings' ,'booking'); ?></span></fieldset></td> |
| 209 |
</tr><?php |
| 210 |
|
| 211 |
} |
| 212 |
|
| 213 |
|