PluginProbe
Booking Calendar / 10.10
Booking Calendar v10.10
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 10.11 10.11.2 10.11.3 All 202 releases
booking / includes / page-setup / setup_templates.php

setup_templates.php in Booking Calendar 10.10, at includes/page-setup/setup_templates.php

474 lines 18.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 * @description Templates for Setup pages
4 * @category Setup Templates
5 * @author wpdevelop
6 *
7 * @web-site http://oplugins.com/
8 * @email info@oplugins.com
9 *
10 * @modified 2024-08-27
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15
16 class WPBC_AJX__Setup_Wizard__Templates {
17
18 // <editor-fold defaultstate="collapsed" desc=" /// JS | CSS files | Tpl loading /// " >
19
20 /**
21 * Define HOOKs for loading CSS and JavaScript files
22 */
23 public function init_load_css_js_tpl() {
24
25 // Load only at specific Page
26 if ( wpbc_is_setup_wizard_page() ) {
27
28 add_action( 'wpbc_enqueue_js_files', array( $this, 'js_load_files' ), 50 );
29 add_action( 'wpbc_enqueue_css_files', array( $this, 'enqueue_css_files' ), 50 );
30
31 add_action( 'wpbc_hook_settings_page_footer', array( $this, 'hook__load_templates_at_footer' ) );
32 }
33 }
34
35
36 /** JS */
37 public function js_load_files( $where_to_load ) {
38
39 $in_footer = true;
40
41 if ( wpbc_is_setup_wizard_page() ){
42
43 wp_enqueue_script( 'wpbc_all', wpbc_plugin_url( '/_dist/all/_out/wpbc_all.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) );
44 wp_enqueue_script( 'wpbc-main-client', wpbc_plugin_url( '/js/client.js' ), array( 'wpbc-datepick' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) );
45 wp_enqueue_script( 'wpbc-times', wpbc_plugin_url( '/js/wpbc_times.js' ), array( 'wpbc-main-client' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) );
46
47 wp_enqueue_script( 'wpbc-general_ui_js_css', wpbc_plugin_url( '/includes/_general_ui_js_css/_out/wpbc_main_ui_funcs.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer );
48
49 wp_enqueue_script( 'wpbc-settings_obj', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/settings_obj.js', array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer );
50 wp_enqueue_script( 'wpbc-setup_wizard_obj', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_obj.js', array( 'wpbc-settings_obj' ), WP_BK_VERSION_NUM, $in_footer );
51 wp_enqueue_script( 'wpbc-setup_wizard_show', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_show.js', array( 'wpbc-setup_wizard_obj' ), WP_BK_VERSION_NUM, $in_footer );
52 wp_enqueue_script( 'wpbc-setup_wizard_ajax', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_ajax.js', array( 'wpbc-setup_wizard_obj' ), WP_BK_VERSION_NUM, $in_footer );
53 }
54 }
55
56
57 /** CSS */
58 public function enqueue_css_files( $where_to_load ) {
59
60 if ( wpbc_is_setup_wizard_page() ){
61
62 wp_enqueue_style( 'wpbc-setup_wizard_page', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_page.css', array(), WP_BK_VERSION_NUM );
63 }
64 }
65
66 // </editor-fold>
67
68
69 // <editor-fold defaultstate="collapsed" desc=" /// Templates /// " >
70
71
72 /**
73 * Load Templates at footer of page
74 *
75 * @param $page string
76 */
77 public function hook__load_templates_at_footer( $page ){
78
79 // Hook from ../includes/page-setup/setup__page.php
80 if ( 'wpbc-ajx_booking_setup_wizard' === $page ) {
81
82 $this->wpbc_template__stp_wiz__main_content();
83
84 wpbc_stp_wiz__template__welcome();
85 wpbc_stp_wiz__template__general_info();
86 wpbc_stp_wiz__template__date_time_formats();
87 wpbc_stp_wiz__template__bookings_types();
88 wpbc_stp_wiz__template__form_structure();
89 wpbc_stp_wiz__template__cal_availability();
90 wpbc_stp_wiz__template__color_theme();
91 wpbc_stp_wiz__template__optional_other_settings();
92 wpbc_stp_wiz__template__wizard_publish();
93 wpbc_stp_wiz__template__get_started();
94
95 $this->wpbc_template__stp_wiz__left_navigation();
96 $this->wpbc_template__stp_wiz__left_navigation_item();
97
98 $this->wpbc_template__timeline_steps();
99 $this->wpbc_template__timeline_steps_icons();
100
101 $this->wpbc_template__stp_wiz__footer_buttons();
102 }
103 }
104
105
106 // =============================================================================================================
107 // == Templates ==
108 // =============================================================================================================
109 /**
110 * Template - Page Container
111 *
112 * Help Tips:
113 *
114 * <script type="text/html" id="tmpl-template_name_a">
115 * Escaped: {{data.test_key}}
116 * HTML: {{{data.test_key}}}
117 * JS: <# if (true) { alert( 1 ); } #>
118 * </script>
119 *
120 * var template__var = wp.template( 'template_name_a' );
121 *
122 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
123 *
124 * @return void
125 */
126 private function wpbc_template__stp_wiz__main_content() {
127 ?><script type="text/html" id="tmpl-wpbc_template__stp_wiz__main_content">
128 <#
129 var wpbc_template__timeline_steps = wp.template( 'wpbc_template__timeline_steps' );
130
131 jQuery( '.wpbc__container_place__steps_for_timeline' ).html( wpbc_template__timeline_steps( data.steps_is_done ) );
132 #>
133 <div class="wpbc__container_place__steps_for_timeline">{{{ wpbc_template__timeline_steps( data.steps_is_done ) }}}</div>
134 <div class="wpbc_setup_wizard_page__container wpbc_ajx_page__container">
135
136 <# if ( false !== data.steps[ data.current_step ][ 'show_section_left' ] ) { #>
137
138 <div class="wpbc_ajx_page__section wpbc_setup_wizard_page__section_left wpbc_ajx_page__section_left">
139 <# var wpbc_template__stp_wiz__left_navigation = wp.template( 'wpbc_template__stp_wiz__left_navigation' ); #>{{{
140
141 wpbc_template__stp_wiz__left_navigation({
142 'left_navigation' : data.left_navigation,
143 'ajx_cleaned_params': data.ajx_cleaned_params
144 })
145 }}}
146 </div>
147
148 <# } #>
149
150 <div class="wpbc_ajx_page__section wpbc_setup_wizard_page__section_main wpbc_ajx_page__section_main">
151 <?php if(0){ ?><script><?php } echo '<#'; ?>
152
153 var template__main_section;
154
155 switch ( data.current_step ) {
156
157 case 'welcome':
158 template__main_section = wp.template( 'wpbc_stp_wiz__template__welcome' );
159 break;
160
161 case 'general_info':
162 template__main_section = wp.template( 'wpbc_stp_wiz__template__general_info' );
163 break;
164
165 case 'date_time_formats':
166 template__main_section = wp.template( 'wpbc_stp_wiz__template__date_time_formats' );
167 break;
168
169 case 'bookings_types':
170 template__main_section = wp.template( 'wpbc_stp_wiz__template__bookings_types' );
171 break;
172
173 case 'form_structure':
174 template__main_section = wp.template( 'wpbc_stp_wiz__template__form_structure' );
175 break;
176
177 case 'cal_availability':
178 template__main_section = wp.template( 'wpbc_stp_wiz__template__cal_availability' );
179 break;
180
181 case 'color_theme':
182 template__main_section = wp.template( 'wpbc_stp_wiz__template__color_theme' );
183 break;
184
185 case 'optional_other_settings':
186
187 template__main_section = wp.template( 'wpbc_stp_wiz__template__optional_other_settings' );
188 break;
189
190 case 'wizard_publish':
191 template__main_section = wp.template( 'wpbc_stp_wiz__template__wizard_publish' );
192 break;
193
194 case 'get_started':
195 template__main_section = wp.template( 'wpbc_stp_wiz__template__get_started' );
196 break;
197
198 default:
199 // Default
200 template__main_section = wp.template( 'wpbc_stp_wiz__template__general_info' );
201 }
202
203 <?php if(0){ ?></script><?php } echo '#>'; ?>
204 {{{
205 template__main_section( data )
206 }}}
207 </div>
208
209 <# if ( false !== data.steps[ data.current_step ][ 'show_section_right' ] ) { #>
210
211 <div class="wpbc_ajx_page__section wpbc_setup_wizard_page__section_right wpbc_ajx_page__section_right">
212 <?php $this->test_right_widget(); ?>
213 </div>
214 <# } #>
215
216 <#
217 var wpbc_template__stp_wiz__footer_buttons = wp.template( 'wpbc_template__stp_wiz__footer_buttons' );
218 #>
219 <div class="wpbc_ajx_page__section wpbc_setup_wizard_page__section_footer wpbc_ajx_page__section_footer">
220 <div class="wpbc__container_place__footer_buttons wpbc_container wpbc_form wpbc_container_booking_form">{{{
221 wpbc_template__stp_wiz__footer_buttons( data )
222 }}}</div>
223 </div>
224 </div>
225 </script><?php
226 }
227
228
229 // -------------------------------------------------------------------------------------------------------------
230 // == Timeline Steps - Line with Checked Dots ==
231 // -------------------------------------------------------------------------------------------------------------
232 private function wpbc_template__timeline_steps(){
233
234 ?><script type="text/html" id="tmpl-wpbc_template__timeline_steps">
235 <# var wpbc_template__timeline_steps_icons = wp.template( 'wpbc_template__timeline_steps_icons' ); #>
236 <div class="wpbc_steps_for_timeline_container">
237 <div class="wpbc_steps_for_timeline">
238 <#
239
240 var steps_count = wpbc_setup_wizard_page__get_steps_count();
241 var actual_step_number = wpbc_setup_wizard_page__get_actual_step_number();
242
243 var css_class_for_step = '';
244 var css_class_for_line = '';
245 var is_line_exist = false;
246
247 for ( var i = 1; i <= steps_count ; i++ ) {
248
249 is_line_exist = ( i > 1 );
250
251 if ( actual_step_number > i ) {
252 css_class_for_step = ' wpbc_steps_for_timeline_step_completed';
253 css_class_for_line = 'wpbc_steps_for_timeline_line_active';
254 } else if ( actual_step_number == i ) {
255 css_class_for_step = ' wpbc_steps_for_timeline_step_active';
256 css_class_for_line = 'wpbc_steps_for_timeline_line_active';
257 } else {
258 css_class_for_step = '';
259 css_class_for_line = '';
260 }
261
262
263 if ( is_line_exist ) { #>
264 <div class="wpbc_steps_for_timeline_step_line {{css_class_for_line}}"></div>
265 <# } #>
266 <div class="wpbc_steps_for_timeline_step {{css_class_for_step}}">
267 {{{ wpbc_template__timeline_steps_icons({ }) }}}
268 </div>
269 <# } #>
270 </div>
271 </div>
272 </script><?php
273 }
274
275 /**
276 * Show template for steps timeline icons
277 *
278 * @return void
279 */
280 private function wpbc_template__timeline_steps_icons() {
281
282 ?>
283 <script type="text/html" id="tmpl-wpbc_template__timeline_steps_icons">
284 <?php
285 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
286 echo wpbc_ui__steps_timeline__get_icons();
287 ?>
288 </script>
289 <?php
290 }
291
292
293 // -------------------------------------------------------------------------------------------------------------
294 // == Footer Action Buttons ==
295 // -------------------------------------------------------------------------------------------------------------
296 private function wpbc_template__stp_wiz__footer_buttons(){
297
298 ?><script type="text/html" id="tmpl-wpbc_template__stp_wiz__footer_buttons">
299 <div class="wpbc__form__div">
300 <hr>
301 <div class="wpbc__row wpbc__row__btn_prior_next">
302 <?php /* ?>
303 <div class="wpbc__field">
304 <input type="button" value="<?php esc_attr_e('Reset Wizard and Start from Beginning','booking'); ?>"
305 class="wpbc_button_light wpbc_button_danger tooltip_top " style=""
306 onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'make_reset' } ); ">
307 </div>
308 <?php */ ?>
309 <div class="wpbc__field">
310 <# if ( '' != data['steps'][ data['current_step'] ]['prior'] ) { #>
311 <a class="wpbc_button_light" style="margin-left:auto;margin-right:10px;" tabindex="0"
312 id="btn__toolbar__buttons_prior"
313 onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( {
314 'current_step': '{{data.steps[ data.current_step ].prior}}',
315 'do_action': 'none',
316 'ui_clicked_element_id': 'btn__toolbar__buttons_prior'
317 } );
318 wpbc_button_enable_loading_icon( this );
319 wpbc_admin_show_message_processing( '' );" ><i class="menu_icon icon-1x wpbc_icn_arrow_back_ios"></i><span>&nbsp;&nbsp;&nbsp;{{data.steps[ data.current_step ].prior_title}}</span></a>
320
321 <# } else { #>
322 <span style="margin-left:auto;"></span>
323 <# } #>
324 <a class="wpbc_button_light button-primary" tabindex="0"
325 id="btn__toolbar__buttons_next"
326 onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( {
327 'current_step': '{{data.steps[ data.current_step ].next}}',
328 'do_action': '{{data.steps[ data.current_step ].do_action}}',
329 'ui_clicked_element_id': 'btn__toolbar__buttons_next'
330 } );
331 wpbc_button_enable_loading_icon( this );
332 wpbc_admin_show_message_processing( '' );" ><span>{{data.steps[ data.current_step ].next_title}}&nbsp;&nbsp;&nbsp;</span><i class="menu_icon icon-1x wpbc_icn_arrow_forward_ios"></i></a>
333 </div>
334 </div>
335 <div class="wpbc__row wpbc__row__btn_skip_exist">
336 <div class="wpbc__field">
337 <p class="wpbc_exit_link_small">
338 <a href="javascript:void(0)" tabindex="-1"
339 onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'skip_wizard' } ); "
340 title="<?php esc_attr_e('Exit and skip the setup wizard','booking'); ?>"
341 ><?php
342 esc_html_e('Exit and skip the setup wizard','booking');
343 ?></a>
344 <?php ?>
345 <a href="javascript:void(0)" class="wpbc_button_danger" style="margin: 25px 0 0; font-size: 12px;" tabindex="-1"
346 onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'make_reset' } ); "
347 title="<?php esc_attr_e('Start Setup from Beginning','booking'); ?>"
348 ><?php
349 esc_html_e('Reset Wizard','booking');
350 ?></a>
351 <?php /**/ ?>
352 </p>
353 </div>
354 </div>
355 </div>
356 </script><?php
357 }
358
359
360
361 // -------------------------------------------------------------------------------------------------------------
362 // == Left Navigation ==
363 // -------------------------------------------------------------------------------------------------------------
364 /**
365 * Template - Left Navigation
366 *
367 * Help Tips:
368 *
369 * <script type="text/html" id="tmpl-template_name_a">
370 * Escaped: {{data.test_key}}
371 * HTML: {{{data.test_key}}}
372 * JS: <# if (true) { alert( 1 ); } #>
373 * </script>
374 *
375 * var template__var = wp.template( 'template_name_a' );
376 *
377 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
378 *
379 * @return void
380 */
381 private function wpbc_template__stp_wiz__left_navigation() {
382 ?><script type="text/html" id="tmpl-wpbc_template__stp_wiz__left_navigation">
383 <div class="wpbc_navigation_menu_left">
384 <#
385 var wpbc_template__stp_wiz__left_navigation_item = wp.template( 'wpbc_template__stp_wiz__left_navigation_item' );
386 _.each( data.left_navigation, function ( p_val, p_id, p_data_arr ){
387 if ( undefined === p_val.a_style){ p_val.a_style = ''; }
388 if ( undefined === p_val.style){ p_val.style = ''; }
389 #>{{{
390 wpbc_template__stp_wiz__left_navigation_item({
391 'id' : p_id,
392 'data_arr': p_val
393 })
394 }}}
395 <# } ); #>
396 </div>
397 </script><?php
398 }
399
400
401 /**
402 * Template - Left Navigation Item
403 *
404 * Help Tips:
405 *
406 * <script type="text/html" id="tmpl-template_name_a">
407 * Escaped: {{data.test_key}}
408 * HTML: {{{data.test_key}}}
409 * JS: <# if (true) { alert( 1 ); } #>
410 * </script>
411 *
412 * var template__var = wp.template( 'template_name_a' );
413 *
414 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
415 *
416 * @return void
417 */
418 private function wpbc_template__stp_wiz__left_navigation_item() {
419 ?><script type="text/html" id="tmpl-wpbc_template__stp_wiz__left_navigation_item">
420 <div id="{{data.id}}"
421 class="wpbc_navigation_menu_left_item {{data.data_arr.class}}" style="{{data.data_arr.style}}">
422 <div class="wpbc_navigation_menu_left_item_container">
423 <a class="wpbc_navigation_menu_left_item_a" style="{{data.data_arr.a_style}}" onclick="javascript:{{{data.data_arr.action}}}" href="javascript:void(0);">
424 <i class="wpbc_navigation_menu_left_item_icon menu_icon icon-1x {{data.data_arr.icon}}"></i>
425 <div class="wpbc_navigation_menu_left_item_text">{{{data.data_arr.title}}}</div>
426 </a>
427 <# if ( undefined != data.data_arr.right_icon ) { #>
428 <a class="wpbc_navigation_menu_left_item_icon_right" onclick="javascript:{{{data.data_arr.right_icon.action}}}" href="javascript:void(0);"
429 ><i class="menu_icon icon-1x {{data.data_arr.right_icon.icon}}"></i>
430 <# if ( undefined != data.data_arr.right_icon.text ) { #>
431 <div class="wpbc_navigation_menu_left_small_text_right">{{{data.data_arr.right_icon.text}}}</div>
432 <# } #>
433 </a>
434 <# } #>
435 </div>
436 </div>
437 </script><?php
438 }
439
440
441
442 // TODO: Update this
443 private function test_right_widget(){
444 ?>
445 <div class="wpbc_widgets">
446 <div class="wpbc_widget wpbc_widget_change_calendar_skin">
447 <div class="wpbc_widget_header">
448 <span class="wpbc_widget_header_text">Calendar Skin</span>
449 <a href="/" class="wpbc_widget_header_settings_link"><i class="menu_icon icon-1x wpbc_icn_settings"></i></a>
450 </div>
451 <div class="wpbc_widget_content wpbc_ajx_toolbar" style="margin:0 0 20px;">
452 <div class="ui_container">
453 <div class="ui_group ui_group__change_calendar_skin">
454 </div>
455 </div>
456 </div>
457 </div>
458 </div>
459 <?php
460 }
461
462 // </editor-fold>
463
464 }
465
466
467 /**
468 * Just for loading CSS and JavaScript files
469 */
470 if ( true ) {
471 $setup_wizard_page_loading = new WPBC_AJX__Setup_Wizard__Templates;
472 $setup_wizard_page_loading->init_load_css_js_tpl();
473 }
474