PluginProbe
Booking Calendar / 10.15.7
Booking Calendar v10.15.7
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 10.15.7, at includes/page-resource-free/page-resource-free.php

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