PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 All 205 releases
← All changes | includes/page-add-booking/add_booking__page.php +101 -89 11.6 → 11.9 View file →
@@ -1,16 +1,16 @@
1 -<?php /**
2 - * @version 1.0
3 - * @package Booking Calendar
4 - * @category Content of Add New Booking
5 - * @author wpdevelop
6 - *
7 - * @web-site https://wpbookingcalendar.com/
8 - * @email [email protected]
9 - *
10 - * @modified 2015-10-31
11 - */
12 -
1 +<?php /**
2 + * @version 1.0
3 + * @package Booking Calendar
4 + * @category Content of Add New Booking
5 + * @author wpdevelop
6 + *
7 + * @web-site https://wpbookingcalendar.com/
8 + * @email [email protected]
9 + *
10 + * @modified 2015-10-31
11 + */
12 +
13 13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14 14
15 15
16 16 /**
@@ -134,16 +134,16 @@
134 134 array( 'in_footer' => WPBC_JS_IN_FOOTER )
135 135 );
136 136 }
137 137 add_action( 'wpbc_enqueue_js_files', 'wpbc_add_booking_page_enqueue_js', 73 );
138 -
139 -
140 -/**
141 - * Show Content
142 - * Update Content
143 - * Define Slug
144 - * Define where to show
145 - */
138 +
139 +
140 +/**
141 + * Show Content
142 + * Update Content
143 + * Define Slug
144 + * Define where to show
145 + */
146 146 class WPBC_Page_AddNewBooking extends WPBC_Page_Structure {
147 147
148 148
149 149 /**
@@ -174,32 +174,32 @@
174 174 public function tabs() {
175 175
176 176 $is_can_add_booking = WPBC_Add_Booking_Component::current_user_can_add_booking();
177 177 $is_inspector_ui = wpbc_add_booking_page_is_inspector_enabled();
178 -
179 - $tabs = array();
180 - $tabs['add-booking'] = array(
181 - 'is_show_top_path' => true, // true | false. By default value is: true.
178 +
179 + $tabs = array();
180 + $tabs['add-booking'] = array(
181 + 'is_show_top_path' => true, // true | false. By default value is: true.
182 182 'is_show_top_navigation' => true,
183 - 'left_navigation__default_view_mode' => 'min', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''.
183 + 'left_navigation__default_view_mode' => '', // FixIn:11.7.1.1: 'min', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''.
184 184 'right_vertical_sidebar__is_show' => $is_inspector_ui,
185 185 'right_vertical_sidebar__default_view_mode' => '',
186 186 'right_vertical_sidebar_compact__is_show' => $is_inspector_ui,
187 - 'page_title' => __( 'Add New Booking', 'booking' ), // Header - Title. If false, than hidden.
188 - 'page_description' => __( 'Manually add new bookings from the Admin Panel.', 'booking' ), // Header - Title Description. If false, than hidden.
189 - 'title' => __( 'Add booking', 'booking' ), // Title of TAB.
190 - 'hint' => __( 'Add booking', 'booking' ), // Hint.
191 - 'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link.
192 - 'position' => '', // Can be: 'left' | 'right' | ''.
193 - 'css_classes' => '', // this is CSS class(es).
194 - 'icon' => '', // Icon - link to the real PNG img.
195 - 'font_icon' => 'wpbc-bi-plus', // CSS definition of forn Icon.
196 - 'default' => true, // Is this tab activated by default or not: true || false.
197 - 'disabled' => ! $is_can_add_booking, // Is this tab disbaled: true || false.
198 - 'hided' => ! $is_can_add_booking, // Is this tab hided: true || false.
199 - 'subtabs' => array(),
200 - );
201 -
187 + 'page_title' => __( 'Add New Booking', 'booking' ), // Header - Title. If false, than hidden.
188 + 'page_description' => __( 'Manually add new bookings from the Admin Panel.', 'booking' ), // Header - Title Description. If false, than hidden.
189 + 'title' => __( 'Add booking', 'booking' ), // Title of TAB.
190 + 'hint' => __( 'Add booking', 'booking' ), // Hint.
191 + 'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link.
192 + 'position' => '', // Can be: 'left' | 'right' | ''.
193 + 'css_classes' => '', // this is CSS class(es).
194 + 'icon' => '', // Icon - link to the real PNG img.
195 + 'font_icon' => 'wpbc-bi-plus', // CSS definition of forn Icon.
196 + 'default' => true, // Is this tab activated by default or not: true || false.
197 + 'disabled' => ! $is_can_add_booking, // Is this tab disbaled: true || false.
198 + 'hided' => ! $is_can_add_booking, // Is this tab hided: true || false.
199 + 'subtabs' => array(),
200 + );
201 +
202 202 return $tabs;
203 203 }
204 204
205 205
@@ -370,9 +370,9 @@
370 370 * @return void
371 371 */
372 372 private function render_booking_setup_summary() {
373 373
374 - $resource_id = $this->get_selected_booking_resource_id();
374 + $resource_id = $this->get_selected_booking_resource_id();
375 375 $resource_title = function_exists( 'wpbc_get_resource_title' ) ? wpbc_get_resource_title( $resource_id ) : '';
376 376 $form_name = $this->get_selected_booking_form_name( $resource_id );
377 377 $days_mode = $this->get_current_days_selection_mode();
378 378 $send_emails = 'On' !== get_bk_option( 'booking_send_emails_off_addbooking' );
@@ -923,8 +923,21 @@
923 923 $allow_past_url = esc_url_raw( wpbc_add_booking_page_get_allow_past_url( true ) );
924 924 $normal_url = esc_url_raw( wpbc_add_booking_page_get_allow_past_url( false ) );
925 925 $send_emails = 'On' !== get_bk_option( 'booking_send_emails_off_addbooking' );
926 926 ?>
927 + <?php
928 + wpbc_render_admin_cost_correction_control(
929 + array(
930 + 'input_id' => 'wpbc_add_booking_cost_correction',
931 + 'resource_id' => $this->get_selected_booking_resource_id(),
932 + 'wrapper_class' => 'inspector__row wpbc_add_booking__cost_correction',
933 + 'label_class' => 'inspector__label',
934 + 'control_class' => 'inspector__control',
935 + 'help_class' => 'description wpbc_bfb__help',
936 + 'help' => __( 'Leave the number empty to use the calculated Booking cost. Enter an exact total to replace the final cost for this Booking.', 'booking' ),
937 + )
938 + );
939 + ?>
927 940 <div class="inspector__row inspector__row--toggle">
928 941 <div class="inspector__control">
929 942 <?php
930 943 wpbc_flex_toggle(
@@ -962,9 +975,8 @@
962 975 <?php do_action( 'wpbc_admin_add_booking_tools_panel', $this ); ?>
963 976 <?php
964 977 }
965 978
966 -
967 979 /**
968 980 * Render per-user calendar sizing controls and their existing AJAX actions.
969 981 *
970 982 * @return void
@@ -1081,10 +1093,10 @@
1081 1093 <?php do_action( 'wpbc_admin_add_booking_help_panel', $this ); ?>
1082 1094 </div>
1083 1095 <?php
1084 1096 }
1085 -
1086 -
1097 +
1098 +
1087 1099 /**
1088 1100 * Render the legacy page or the released inspector presentation.
1089 1101 *
1090 1102 * Both presentations delegate the actual Booking Form to the same reusable
@@ -1092,23 +1104,23 @@
1092 1104 *
1093 1105 * @return void|false False when the current user cannot use the page.
1094 1106 */
1095 1107 public function content() {
1096 -
1097 - do_action( 'wpbc_hook_add_booking_page_header', 'add_booking' ); // Define Notices Section and show some static messages, if needed.
1098 -
1099 - if ( ! wpbc_is_mu_user_can_be_here( 'activated_user' ) ) {
1100 - return false; // Check if MU user activated, otherwise show Warning message.
1101 - }
1102 -
1103 - if ( ! WPBC_Add_Booking_Component::current_user_can_add_booking() ) {
1104 - return false;
1105 - }
1106 -
1107 - if ( ! wpbc_set_default_resource_to__get() ) {
1108 - return false; // Define default booking resources for $_ GET and check if booking resource belong to user.
1109 - }
1110 -
1108 +
1109 + do_action( 'wpbc_hook_add_booking_page_header', 'add_booking' ); // Define Notices Section and show some static messages, if needed.
1110 +
1111 + if ( ! wpbc_is_mu_user_can_be_here( 'activated_user' ) ) {
1112 + return false; // Check if MU user activated, otherwise show Warning message.
1113 + }
1114 +
1115 + if ( ! WPBC_Add_Booking_Component::current_user_can_add_booking() ) {
1116 + return false;
1117 + }
1118 +
1119 + if ( ! wpbc_set_default_resource_to__get() ) {
1120 + return false; // Define default booking resources for $_ GET and check if booking resource belong to user.
1121 + }
1122 +
1111 1123 if ( wpbc_add_booking_page_is_inspector_enabled() ) {
1112 1124 ?>
1113 1125 <div class="wpbc_add_booking_page" data-wpbc-add-booking-page="1">
1114 1126 <div class="wpbc_add_booking__canvas">
@@ -1128,20 +1140,20 @@
1128 1140 <?php
1129 1141 } else {
1130 1142 WPBC_Add_Booking_Component::render();
1131 1143 }
1132 -
1133 - do_action( 'wpbc_hook_add_booking_page_footer', 'add_booking' );
1134 - }
1135 -
1136 -
1137 - /**
1138 - * Get Calendar Options of specific User
1139 - *
1144 +
1145 + do_action( 'wpbc_hook_add_booking_page_footer', 'add_booking' );
1146 + }
1147 +
1148 +
1149 + /**
1150 + * Get Calendar Options of specific User
1151 + *
1140 1152 * @return array<string,mixed> Normalized calendar display options.
1141 - */
1153 + */
1142 1154 public function get_saved_user_calendar_options() {
1143 -
1155 +
1144 1156 return WPBC_Add_Booking_Component::get_saved_user_calendar_options();
1145 1157 }
1146 1158
1147 1159
@@ -1153,24 +1165,24 @@
1153 1165 private function get_saved_user_calendar_settings() {
1154 1166
1155 1167 return WPBC_Add_Booking_Component::get_saved_user_calendar_settings();
1156 1168 }
1157 -
1158 -}
1159 -add_action('wpbc_menu_created', array( new WPBC_Page_AddNewBooking() , '__construct') ); // Executed after creation of Menu
1160 -
1161 -/**
1162 - * Redirect legacy/main-menu Add Booking page to the Add Booking tab under Bookings.
1163 - *
1164 - * @param string $page_tag Current menu page tag.
1165 - *
1166 - * @return void
1167 - */
1168 -function wpbc_add_booking_menu_page__redirect_to_add_booking_tab( $page_tag ) {
1169 -
1170 - if ( 'wpbc-new' !== $page_tag ) {
1171 - return;
1172 - }
1173 -
1174 - wpbc_redirect( wpbc_get_new_booking_url() );
1175 -}
1176 -add_action( 'wpbc_page_structure_show', 'wpbc_add_booking_menu_page__redirect_to_add_booking_tab', 0 );
1169 +
1170 +}
1171 +add_action('wpbc_menu_created', array( new WPBC_Page_AddNewBooking() , '__construct') ); // Executed after creation of Menu
1172 +
1173 +/**
1174 + * Redirect legacy/main-menu Add Booking page to the Add Booking tab under Bookings.
1175 + *
1176 + * @param string $page_tag Current menu page tag.
1177 + *
1178 + * @return void
1179 + */
1180 +function wpbc_add_booking_menu_page__redirect_to_add_booking_tab( $page_tag ) {
1181 +
1182 + if ( 'wpbc-new' !== $page_tag ) {
1183 + return;
1184 + }
1185 +
1186 + wpbc_redirect( wpbc_get_new_booking_url() );
1187 +}
1188 +add_action( 'wpbc_page_structure_show', 'wpbc_add_booking_menu_page__redirect_to_add_booking_tab', 0 );