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
booking / includes / page-resource-free / page-resource-free.php

page-resource-free.php in Booking Calendar 11.9, at includes/page-resource-free/page-resource-free.php

418 lines 20.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php /**
2 * @version 1.0
3 * @package Booking > Resource page
4 * @category Settings page
5 * @author wpdevelop
6 *
7 * @web-site https://wpbookingcalendar.com/
8 * @email [email protected]
9 *
10 * @modified 2023-12-29
11 *
12 */
13
14 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.8.15.7.
15
16
17 /**
18 * Show Content
19 * Update Content
20 * Define Slug
21 * Define where to show
22 */
23 class WPBC_Page_Settings__bresource extends WPBC_Page_Structure {
24
25 public function in_page() {
26 if (
27 class_exists( 'wpdev_bk_personal' )
28 || ( function_exists( 'wpbc_booking_resources_catalog_should_use_new_renderer' ) && wpbc_booking_resources_catalog_should_use_new_renderer() )
29 ) {
30 return (string) wp_rand( 100000, 1000000 );
31 }
32 return 'wpbc-resources';
33 }
34
35 public function tabs() {
36
37 $tabs = array();
38
39 $tabs[ 'resources' ] = array(
40 'title' => __('Resource','booking') // Title of TAB
41 , 'hint' => __('Create unique calendars with individual availability.', 'booking') // Hint
42 , 'page_title' => ucwords( __('Booking resource','booking') ) // Title of Page
43 //, 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be external link
44 //, 'position' => 'left' // 'left' || 'right' || ''
45 //, 'css_classes'=> '' // CSS class(es)
46 //, 'icon' => '' // Icon - link to the real PNG img
47 , 'font_icon' => 'wpbc-bi-list 0wpbc_icn_checklist' // CSS definition of font Icon
48 , 'default' => ( ! class_exists( 'wpdev_bk_personal' ) ) // Is this tab activated by default or not: true || false.
49 //, 'disabled' => false // Is this tab disabled: true || false.
50 , 'hided' => true // Is this tab hided: true || false.
51 , 'subtabs' => array()
52 );
53 return $tabs;
54 }
55
56
57 /** Show Content of Settings page */
58 public function content() {
59 if ( function_exists( 'wpbc_booking_resources_catalog_get_request_renderer' ) && 'legacy' !== wpbc_booking_resources_catalog_get_request_renderer() ) {
60 return false;
61 }
62
63 $this->css();
64
65 ////////////////////////////////////////////////////////////////////////
66 // Checking
67 ////////////////////////////////////////////////////////////////////////
68
69 do_action( 'wpbc_hook_settings_page_header', 'resources'); // Define Notices Section and show some static messages, if needed
70
71 ////////////////////////////////////////////////////////////////////////
72 // S u b m i t Main Form
73 ////////////////////////////////////////////////////////////////////////
74
75 $submit_form_name = 'wpbc_bresources'; // Define form name
76 /*
77 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
78 if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) {
79 // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. }
80 $nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page
81
82 // Save Changes
83 $this->update();
84 }
85 */
86 do_action('wpbc_bresources_check_submit_actions');
87
88 ////////////////////////////////////////////////////////////////////////
89 // JavaScript: Tooltips, Popover, Datepick (js & css)
90 ////////////////////////////////////////////////////////////////////////
91
92 echo '<span class="wpdevelop">';
93
94 wpbc_js_for_bookings_page();
95
96 // Toolbar
97 $this->toolbar();
98
99
100 echo '</span>';
101
102 ?><div class="clear" style="margin-bottom:5px;"></div><?php
103
104
105 // Scroll links ////////////////////////////////////////////////////////
106 if (0) {
107 ?>
108 <div class="wpdvlp-sub-tabs" style="background:none;border:none;box-shadow: none;padding:0;">
109 <span class="nav-tabs" style="text-align:right;">
110 <a href="javascript:void(0);" onclick="javascript:wpbc_scroll_to('#wpbc_booking_resource_table' );" original-title="" class="nav-tab go-to-link"><span><?php esc_html_e('Resource' ,'booking'); ?></span></a>
111 </span>
112 </div>
113 <div class="clear"></div>
114 <?php
115 }
116
117 do_action( 'wpbc_hook_settings_page_before_content_table', 'resources'); // Define Notices Section and show some static messages, if needed
118
119 ////////////////////////////////////////////////////////////////////////
120 // Content ////////////////////////////////////////////////////////////
121 ?>
122 <div class="clear"></div>
123 <span class="metabox-holder">
124 <form name="<?php echo esc_attr( $submit_form_name ); ?>" id="<?php echo esc_attr( $submit_form_name ); ?>" action="" method="post" autocomplete="off">
125 <?php
126 // N o n c e field, and key for checking S u b m i t
127 wp_nonce_field( 'wpbc_settings_page_' . $submit_form_name );
128 ?><input type="hidden" name="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" id="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" value="1" /><?php
129 ?><div class="clear" style="margin-top:20px;"></div>
130 <div id="wpbc_booking_resource_table" class="wpbc_settings_row wpbc_settings_row_rightNO">
131 <?php
132 $this->wpbc_resources_table__show();
133 ?>
134 </div>
135 <div class="clear"></div>
136 </span>
137 <?php
138
139 do_action( 'wpbc_hook_settings_page_footer', 'resources' );
140 }
141
142
143 // <editor-fold defaultstate="collapsed" desc=" CSS & JS " >
144
145 /** CSS for this page */
146 private function css() {
147 ?>
148 <style type="text/css">
149 .wpbc-help-message {
150 border:none;
151 }
152 /* Selectbox element in toolbar */
153 .visibility_container select optgroup{
154 color:#999;
155 vertical-align: middle;
156 font-style: italic;
157 font-weight: 400;
158 }
159 .visibility_container select option {
160 padding:5px;
161 font-weight: 600;
162 }
163 .visibility_container select optgroup option{
164 padding: 5px 20px;
165 color:#555;
166 font-weight: 600;
167 }
168 #wpbc_create_new_custom_form_name_fields {
169 width: 360px;
170 display:none;
171 }
172 @media (max-width: 399px) {
173 #wpbc_create_new_custom_form_name_fields {
174 width: 100%;
175 }
176 }
177 </style>
178 <?php
179 }
180 // </editor-fold>
181
182
183 // -----------------------------------------------------------------------------------------------------------------
184 // Toolbar
185 // -----------------------------------------------------------------------------------------------------------------
186 /** Show Toolbar - Add new booking resources */
187 private function toolbar() {
188
189 $wpbc_hidded_element_id = 'toolbar_booking_resources';
190 ob_start();
191 $is_panel_visible = wpbc_is_dismissed( $wpbc_hidded_element_id , array(
192 'title' => '<i class="menu_icon icon-1x wpbc_icn_close"></i> ',
193 'hint' => __( 'Dismiss', 'booking' ),
194 'class' => 'wpbc_panel_get_started_dismiss',
195 'css' => 'background: #fff;border-radius: 7px;margin-bottom: -100%;z-index: 4;position: relative;top: 12px;right: 13px;'
196 ));
197 ?><script type="text/javascript"> jQuery('#<?php echo esc_attr( $wpbc_hidded_element_id ); ?>').hide(); </script><?php
198 $dismiss_button_content = ob_get_clean();
199
200 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
201 echo $dismiss_button_content;
202
203 if ( $is_panel_visible ) {
204 ?>
205 <div id="toolbar_booking_resources" style="position:relative;margin-bottom: 5em;padding:1px;border:5px solid #fff;border-radius:5px;box-shadow: 0 3px 15px 0px #d4d4d4;">
206 <div class="wpdvlp-top-tabs wpbc_blur">
207 <div class="wpdvlp-tabs-wrapper">
208 <div class="nav-tabs">
209 <a href="javascript:void(0);" class="nav-tab nav-tab-active ">
210 <i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i>
211 <span class="nav-tab-text">&nbsp;&nbsp;<?php echo esc_html__('Add Resource', 'booking') . ' ( ' . esc_html__('Calendar', 'booking') . ' )'; ?></span>
212 </a>
213 <a href="javascript:void(0);" class="nav-tab ">
214 <i class="menu_icon icon-1x wpbc_icn_tune"></i>
215 <span class="nav-tab-text">&nbsp;&nbsp;<?php echo esc_html__('Options', 'booking'); ?></span>
216 </a>
217 </div><!-- nav-tabs -->
218 </div><!-- wpdvlp-tabs-wrapper -->
219 </div><!-- wpdvlp-top-tabs -->
220 <form name="wpbc_form_add_new_booking_resources" id="wpbc_form_add_new_booking_resources" action="" method="post" autocomplete="off">
221 <div id="booking_resources_toolbar_container" class="wpbc_ajx_toolbar wpbc_blur">
222 <div class="ui_container ui_container_toolbar ui_container_small ui_container_actions ui_container_actions_row_1" style="display: flex;">
223 <div class="ui_group">
224 <div class="ui_element">
225 <input type="text" id="booking_resource_name"
226 name="booking_resource_name" style="min-width:250px;"
227 class="wpbc_ui_control wpbc_ui_text "
228 placeholder="Enter name of booking resource" value=""
229 autocomplete="off" maxlength="200">
230 </div>
231 <div class="ui_element">
232 <a class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary tooltip_top " id="ui_btn_erase_availability"
233 href="javascript:void(0);"
234 data-original-title="<?php esc_attr_e( 'Add New Booking Resource(s)' ,'booking'); ?>>"><span><?php esc_html_e('Add New', 'booking'); ?>&nbsp;&nbsp;&nbsp;</span><i
235 class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a>
236 </div>
237 <div class="ui_element" style="margin-left:15px;">
238 <label for="resources_count"
239 class="wpbc_ui_control_label "
240 style=""><span style="font-weight:400"><?php esc_html_e('Resources count', 'booking'); ?> </span></label>
241 <select id="resources_count" name="resources_count" class="wpbc_ui_control wpbc_ui_select " style="max-width: 69px;" autocomplete="off">
242 <option value="1" class="" style="">1</option>
243 </select>
244 </div>
245 </div>
246 </div>
247 </div>
248 </form>
249 <div class="clear"></div>
250 <table style="width: 100%;/*! margin-top: 85px; */">
251 <tbody>
252 <tr>
253 <td colspan="2">
254 <div class="wpbc_widget_content" style="transform: translate(0) translateY(-4em);">
255 <div class="ui_container ui_container_toolbar ui_container_small" style="background: #fff;position: relative;">
256 <div class="ui_group ui_group__upgrade" style="/*! float: right; */">
257 <div class="wpbc_upgrade_note wpbc_upgrade_theme_green" style="margin-left: auto;right: 50px;transform: translate(0) translateY(-50%);width: Min(500px, 90%);">
258 <div>
259 This <a target="_blank" href="https://wpbookingcalendar.com/features/#personal">feature</a>
260 is available in the <strong>Pro versions</strong>.
261 <a target="_blank" href="https://wpbookingcalendar.com/prices/#bk_news_section">Upgrade to Pro</a>.
262 </div>
263 </div>
264 </div>
265 </div>
266 </div>
267 </td>
268 </tr>
269 </tbody>
270 </table>
271 </div>
272 <?php
273 }
274
275 }
276
277 // -----------------------------------------------------------------------------------------------------------------
278 // B o o k i n g R e s o u r c e s T a b l e
279 // -----------------------------------------------------------------------------------------------------------------
280 /** Show booking resources table */
281 public function wpbc_resources_table__show() {
282
283 ?>
284 <div id="wpbc_booking_resource_table" class="wpbc_settings_row wpbc_settings_row_rightNO">
285 <div class="wpdevelop wpbc_selectable_table wpbc_resources_table">
286 <table class="table table-striped widefat " cellspacing="0" cellpadding="0">
287 <thead class="wpbc_selectable_head">
288 <tr>
289 <th class="" style="width:5em;text-align: center;"><span href="javascript:void(0);">ID </span></th>
290 <th class="wpbc_hide_mobile"><span href="javascript:void(0);"><?php esc_html_e( 'Resource Name', 'booking' ); ?> </span></th>
291 <th class="" style="text-align:center;"><?php esc_html_e( 'Shortcode for page', 'booking' ); ?></th>
292 <th class="" style="text-align:center;"><?php esc_html_e( 'Actions', 'booking' ); ?></th>
293 </tr>
294 </thead>
295 <tbody class="wpbc_selectable_body">
296 <tr class="wpbc_row wpbc_resource_row" id="resource_1">
297 <td style="background: transparent;border: none;box-shadow: none;margin: 16px 0 0;padding: 0;display: flex;flex-flow: column;justify-content: center;align-items: center;width: 100%;"
298 class="wpbc_hide_mobile wpbc_flextable">
299 <div class="wpbc_flextable_col wpbc_flextable_col_id">
300 <div class="wpbc_listing_col wpbc_col_booking_labels wpbc_col_labels wpbc_label_resource_id_container">
301 <span class="wpbc_label wpbc_label_booking_id wpbc_label_resource_id">1</span>
302 </div>
303 </div>
304 </td>
305 <td class="wpbc_hide_mobile">
306 <input type="text" value="Default" id="booking_resource_1" name="booking_resource_1"
307 style="float:right;width:100%;font-weight:600;color: #aaa;height: 32px;" disabled="disabled"
308 class="large-text disabled">
309 </td>
310 <?php /* ?>
311 <td class="wpbc_hide_mobile">
312 <div class="wpbc_ajx_toolbar" style="display: flex;flex-flow: row wrap;justify-content: center;align-items: center;margin: 0;">
313 <div class="ui_container ui_container_toolbar ui_container_small ui_container_options ui_container_actions_row_1"
314 style="border: none;background: none;padding: 0;">
315 <div class="ui_group">
316 <div class="ui_element">
317 <a href="https://wpbookingcalendar.com/faq/#shortcodes" class="tooltip_top wpbc-bi-question-circle" style="line-height: 2.4em;"
318 title="<?php esc_attr_e( 'Learn how to integrate the booking form into a page using the shortcode.','booking'); ?>"></a>
319 </div>
320 <div class="ui_element">
321 <input type="text" value="[booking resource_id=1]" readonly="readonly" onfocus="this.select()"
322 id="booking_resource_shortcode_1" name="booking_resource_shortcode_1"
323 class="large-text put-in" style="width:auto;font-weight:600;border:1px solid #e1e1e1;text-align: center;cursor:pointer;" />
324 </div>
325 <!--div class="ui_element">
326 <a href="javascript:void(0)" onclick="javascript:wpbc_resource_page_btn_click(1);"
327 id="ui_btn_erase_availability" class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger0 tooltip_top "
328 title="<?php esc_attr_e( 'Customize Booking Calendar shortcode','booking'); ?>" >
329 <span style="display: none;"><?php esc_html_e('Customize','booking'); ?>&nbsp;&nbsp;&nbsp;</span>
330 <i class="menu_icon icon-1x wpbc_icn_tune"></i>
331 </a>
332 </div-->
333 </div>
334 </div>
335 </div>
336 </td>
337 <td class="" style="text-align: center;">
338 <div class="ui_element" style="margin: 0 15px 0 0;">
339 <a href="javascript:void(0)" onclick="javascript:wpbc_resource_page_btn_click(1);"
340 id="ui_btn_erase_availability" class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger0 tooltip_top "
341 title="<?php esc_attr_e( 'Customize Booking Calendar shortcode','booking'); ?>" >
342 <span style="display: none;"><?php esc_html_e('Customize','booking'); ?>&nbsp;&nbsp;&nbsp;</span>
343 <i class="menu_icon icon-1x wpbc_icn_tune"></i>
344 </a>
345 </div>
346 <a href="javascript:void(0);"
347 onclick="javascript: wpbc_modal_dialog__show__resource_publish( 1 );"
348 class="button button-primary tooltip_top"
349 title="<?php esc_attr_e('Embed your booking form into the page', 'booking'); ?>"
350 ><?php esc_html_e( 'Publish', 'booking' ); ?></a>
351 </td>
352 <?php */
353 // FixIn: 10.3.0.8.
354 ?>
355 <td colspan="2" class="wpbc_flextable_col">
356 <div class="wpbc_ajx_toolbar">
357 <div class="ui_container ui_container_small">
358 <div class="ui_group ui_group__shortcode">
359 <div class="ui_element" style="flex: 1 1 auto;margin: 0;">
360 <div id="div_booking_resource_shortcode_1" name="div_booking_resource_shortcode_1" class="shortcode_text_field large-text put-in">
361 [booking resource_id=1]
362 </div>
363 <input type="hidden" value="[booking resource_id=1]" id="booking_resource_shortcode_1" name="booking_resource_shortcode_1">
364 </div>
365 <div class="ui_element" style="margin-left: 0px;margin-right: 0px;">
366 <a href="https://wpbookingcalendar.com/faq/#shortcodes"
367 class="tooltip_top wpbc-bi-question-circle"
368 data-original-title="<?php echo esc_attr( __('Learn how to integrate the booking form into a page using the shortcode.','booking') ); ?>"></a>
369 </div>
370 </div>
371 <div class="ui_group ui_group__publish_btn">
372 <div class="ui_element" style="margin: 0 15px 0 0;">
373 <a href="javascript:void(0)" onclick="javascript:wpbc_resource_page_btn_click(1);"
374 id="ui_btn_erase_availability"
375 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger0 tooltip_top "
376 data-original-title="<?php echo esc_attr( __('Customize Booking Calendar shortcode','booking') ); ?>">
377 <span style="display: none;"><?php esc_html_e('Customize','booking'); ?>&nbsp;&nbsp;&nbsp;</span>
378 <i class="menu_icon icon-1x wpbc_icn_tune"></i>
379 </a>
380 </div>
381 <div class="ui_element" style="margin: 0 2px 0 0;">
382 <a class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary tooltip_top "
383 href="javascript:void(0);"
384 onclick="javascript: wpbc_modal_dialog__show__resource_publish( 1 );"
385 data-original-title="<?php echo esc_attr( __('Embed your booking form into the page','booking') ); ?>">
386 <span><?php esc_html_e('Publish','booking'); ?></span>
387 <i class="menu_icon icon-1x wpbc_icn_tune" style="display: none;"></i>
388 </a>
389 </div>
390 </div>
391 </div>
392 </div>
393 </td>
394 </tr>
395 </tbody>
396 <tfoot class="wpbc_selectable_foot">
397 <tr>
398 <th colspan="5" style="text-align: center;"></th>
399 </tr>
400 </tfoot>
401 </table>
402 </div>
403 <div class="clear"></div>
404 <?php
405 echo '<a style="margin:0;" class="button button" href="' . esc_url( wpbc_get_settings_url() . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'&restore_dismissed=On#wpbc_general_settings_restore_dismissed_metabox">' .
406 esc_html__( 'Restore all dismissed windows', 'booking' )
407 . '</a>';
408 ?>
409 </div>
410 <?php
411 }
412
413 }
414
415 if ( ! function_exists( 'wpbc_booking_resources_catalog_should_use_new_renderer' ) || ! wpbc_booking_resources_catalog_should_use_new_renderer() ) {
416 add_action( 'wpbc_menu_created', array( new WPBC_Page_Settings__bresource(), '__construct' ) ); // Executed after creation of Menu.
417 }
418