| 1 |
<?php /** |
| 2 |
* @version 1.0 |
| 3 |
* @description Template 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-10-12 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 14 |
|
| 15 |
|
| 16 |
// ------------------------------------------------------------------------------------------------------------- |
| 17 |
// == Date | Time Formats, Etc... == |
| 18 |
// ------------------------------------------------------------------------------------------------------------- |
| 19 |
/** |
| 20 |
* Template - Date | Time Formats ... - Step 02 |
| 21 |
* |
| 22 |
* Help Tips: |
| 23 |
* |
| 24 |
* <script type="text/html" id="tmpl-template_name_a"> |
| 25 |
* Escaped: {{data.test_key}} |
| 26 |
* HTML: {{{data.test_key}}} |
| 27 |
* JS: <# if (true) { alert( 1 ); } #> |
| 28 |
* </script> |
| 29 |
* |
| 30 |
* var template__var = wp.template( 'template_name_a' ); |
| 31 |
* |
| 32 |
* jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) ); |
| 33 |
* |
| 34 |
* @return void |
| 35 |
*/ |
| 36 |
function wpbc_stp_wiz__template__date_time_formats(){ |
| 37 |
|
| 38 |
?><script type="text/html" id="tmpl-wpbc_stp_wiz__template__date_time_formats"> |
| 39 |
<div class="wpbc_page_main_section wpbc_container wpbc_form wpbc_container_booking_form"> |
| 40 |
<div class="wpbc__form__div wpbc_swp_section wpbc_swp_section__date_time_formats"> |
| 41 |
<div class="wpbc__row"> |
| 42 |
<div class="wpbc__field"> |
| 43 |
<h1 class="wpbc_swp_section_header" ><?php esc_html_e( 'Dates and times preferences', 'booking' ); ?></h1> |
| 44 |
<p class="wpbc_swp_section_header_description"><?php esc_html_e('Customize how dates and times are displayed.','booking'); ?></p> |
| 45 |
</div> |
| 46 |
</div> |
| 47 |
<div class="wpbc__row"> |
| 48 |
<div class="wpbc__field"> |
| 49 |
<label><?php esc_html_e('Date Format','booking'); ?></label><br> |
| 50 |
<select name="wpbc_swp_date_format" > |
| 51 |
<?php |
| 52 |
$date_format = get_bk_option( 'booking_date_format' ); |
| 53 |
$date_format_arr = array( |
| 54 |
'j M Y', 'F j, Y', |
| 55 |
'd/m/Y', 'd.m.Y', 'd-m-Y', |
| 56 |
'm/d/Y', 'm.d.Y', 'm-d-Y', |
| 57 |
'Y/m/d', 'Y.m.d', 'Y-m-d' |
| 58 |
); |
| 59 |
foreach ( $date_format_arr as $format ) { |
| 60 |
?><option <?php selected( $date_format, esc_attr( $format ) ); ?> value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( date_i18n( $format ) ); ?></option><?php |
| 61 |
} |
| 62 |
?> |
| 63 |
</select> |
| 64 |
</div> |
| 65 |
<div class="wpbc__field"> |
| 66 |
<label><?php esc_html_e('Time Format','booking'); ?></label><br> |
| 67 |
<select name="wpbc_swp_time_format" > |
| 68 |
<?php |
| 69 |
$time_format = get_bk_option( 'booking_time_format' ); |
| 70 |
$time_format_arr = array( 'g:i a', 'g:i A', 'H:i' ); |
| 71 |
foreach ( $time_format_arr as $format ) { |
| 72 |
?><option <?php selected( $time_format, esc_attr( $format ) ); ?> value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( date_i18n( $format ) ); ?></option><?php |
| 73 |
} |
| 74 |
?> |
| 75 |
</select> |
| 76 |
</div> |
| 77 |
</div> |
| 78 |
<div class="wpbc__row"> |
| 79 |
<div class="wpbc__field"> |
| 80 |
<label><?php esc_html_e('Start day of the week','booking'); ?></label><br> |
| 81 |
<?php |
| 82 |
$booking_start_day_weeek = get_bk_option( 'booking_start_day_weeek' ); |
| 83 |
$booking_start_day_weeek_arr = array( |
| 84 |
'0' => __('Sunday' ,'booking') |
| 85 |
, '1' => __('Monday' ,'booking') |
| 86 |
, '2' => __('Tuesday' ,'booking') |
| 87 |
, '3' => __('Wednesday' ,'booking') |
| 88 |
, '4' => __('Thursday' ,'booking') |
| 89 |
, '5' => __('Friday' ,'booking') |
| 90 |
, '6' => __('Saturday' ,'booking') |
| 91 |
) |
| 92 |
?> |
| 93 |
<select name="wpbc_swp_start_day_weeek"> |
| 94 |
<?php |
| 95 |
foreach ( $booking_start_day_weeek_arr as $week_day_val => $week_day_title ) { |
| 96 |
?><option <?php selected( $booking_start_day_weeek, esc_attr( $week_day_val ) ); ?> value="<?php echo esc_attr( $week_day_val ); ?>"><?php echo esc_html( $week_day_title ); ?></option><?php |
| 97 |
} |
| 98 |
?> |
| 99 |
</select> |
| 100 |
<span style="font-size:12px;"><?php esc_html_e('Select which day the week starts on.','booking'); ?></span> |
| 101 |
</div> |
| 102 |
<div class="wpbc__field"> |
| 103 |
<label><?php esc_html_e('Default view for dates in booking tables','booking'); ?></label><br> |
| 104 |
<?php |
| 105 |
$booking_start_day_weeek = get_bk_option( 'booking_date_view_type' ); |
| 106 |
$booking_start_day_weeek_arr = array( |
| 107 |
'short' => __('Short days view' ,'booking') |
| 108 |
, 'wide' => __('Wide days view' ,'booking') |
| 109 |
); |
| 110 |
?> |
| 111 |
<select name="wpbc_swp_date_view_type" onchange="javascript: jQuery( '.view_dates' ).hide(); jQuery( '.view_dates_' + jQuery( this ).val() ).show();"> |
| 112 |
<?php |
| 113 |
foreach ( $booking_start_day_weeek_arr as $week_day_val => $week_day_title ) { |
| 114 |
?><option <?php selected( $booking_start_day_weeek, esc_attr( $week_day_val ) ); ?> value="<?php echo esc_attr( $week_day_val ); ?>"><?php echo esc_html( $week_day_title ); ?></option><?php |
| 115 |
} |
| 116 |
?> |
| 117 |
</select> |
| 118 |
<?php |
| 119 |
update_bk_option( 'booking_date_format', 'j M Y' ); |
| 120 |
$dates_comma = wpbc_get_comma_seprated_dates_from_to_day( date_i18n( "d.m.Y", strtotime( 'now' ) ), date_i18n( "d.m.Y", strtotime( '+3 days' ) ) ); |
| 121 |
?> |
| 122 |
<span style="font-size:12px;"><?php esc_html_e('Example','booking'); ?>: </span> |
| 123 |
<span style="font-size:12px;width:25em;<?php echo ( 'wide' == $booking_start_day_weeek ) ? 'display:none' : ''; ?>" class="view_dates view_dates_short"><?php |
| 124 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 125 |
echo wpbc_get_dates_short_format( $dates_comma ); ?></span> |
| 126 |
<span style="font-size:12px;width:25em;<?php echo ( 'short' == $booking_start_day_weeek ) ? 'display:none' : ''; ?>" class="view_dates view_dates_wide"><?php |
| 127 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 128 |
echo wpbc_get_dates_comma_string_localized( $dates_comma ); ?></span> |
| 129 |
<?php update_bk_option( 'booking_date_format', $date_format ); ?> |
| 130 |
</div> |
| 131 |
</div> |
| 132 |
|
| 133 |
<div class="wpbc__spacer" style="width:100%;clear:both;height:40px;margin-bottom:5px;border-bottom:1px solid #ccc;"></div> |
| 134 |
<div class="wpbc__row wpbc_setup_wizard_page_note_row"> |
| 135 |
<div class="wpbc__field"> |
| 136 |
<span class="wpbc_setup_wizard_page_note"><?php esc_html_e( 'You can always change this later', 'booking' ); ?> |
| 137 |
- <a href="<?php echo esc_url( wpbc_get_settings_url() . '&scroll_to_section=wpbc_general_settings_datestimes_tab' ); ?>"><?php |
| 138 |
echo esc_html__( 'Settings', 'booking' ) . ' > ' . esc_html__( 'Date / Time Formats', 'booking' ); |
| 139 |
?></a></span> |
| 140 |
</div> |
| 141 |
</div> |
| 142 |
<# |
| 143 |
var currentStep = data.current_step || ''; |
| 144 |
var currentStepData = ( data.steps && data.steps[ currentStep ] ) ? data.steps[ currentStep ] : {}; |
| 145 |
var priorStep = currentStepData.prior || ''; |
| 146 |
var nextStep = currentStepData.next || ''; |
| 147 |
var doAction = currentStepData.do_action || 'none'; |
| 148 |
#> |
| 149 |
<div class="wpbc__row wpbc_setup_wizard_page__section_footer wpbc_setup_wizard_navigation_row"> |
| 150 |
<div class="wpbc__field wpbc_setup_wizard_navigation_links"> |
| 151 |
<p class="wpbc_exit_link_small"> |
| 152 |
<a href="javascript:void(0)" |
| 153 |
onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'skip_wizard' } ); " |
| 154 |
title="<?php esc_attr_e('Exit and skip the setup wizard','booking'); ?>" |
| 155 |
><?php esc_html_e('Exit and skip the setup wizard','booking'); ?></a> |
| 156 |
<a href="javascript:void(0)" class="wpbc_button_danger" |
| 157 |
onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'make_reset' } ); " |
| 158 |
title="<?php esc_attr_e('Reset the Setup Wizard and start from beginning','booking'); ?>" |
| 159 |
><?php esc_html_e('Reset Wizard','booking'); ?></a> |
| 160 |
</p> |
| 161 |
</div> |
| 162 |
<div class="wpbc__field wpbc_container wpbc_container_booking_form wpbc_setup_wizard_navigation_actions"> |
| 163 |
<a class="button button-secondary" style="margin-left:auto;margin-right:10px;" tabindex="0" |
| 164 |
id="btn__toolbar__buttons_prior" |
| 165 |
onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { |
| 166 |
'current_step': '{{priorStep}}', |
| 167 |
'do_action': 'none', |
| 168 |
'ui_clicked_element_id': 'btn__toolbar__buttons_prior' |
| 169 |
} ); |
| 170 |
wpbc_button_enable_loading_icon( this ); |
| 171 |
wpbc_admin_show_message_processing( '' );" ><i class="menu_icon icon-1x wpbc_icn_arrow_back_ios"></i><span> <?php esc_html_e('Go Back','booking'); ?></span></a> |
| 172 |
<a style="" |
| 173 |
class="button button-primary" |
| 174 |
id="btn__toolbar__buttons_next" |
| 175 |
onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { |
| 176 |
'current_step': '{{nextStep}}', |
| 177 |
'do_action': '{{doAction}}', |
| 178 |
'ui_clicked_element_id': 'btn__toolbar__buttons_next', |
| 179 |
'step_data':{ |
| 180 |
'wpbc_swp_date_format': jQuery( '[name=\'wpbc_swp_date_format\']').val(), |
| 181 |
'wpbc_swp_time_format': jQuery( '[name=\'wpbc_swp_time_format\']').val(), |
| 182 |
'wpbc_swp_start_day_weeek': jQuery( '[name=\'wpbc_swp_start_day_weeek\']').val(), |
| 183 |
'wpbc_swp_date_view_type': jQuery( '[name=\'wpbc_swp_date_view_type\']').val() |
| 184 |
} |
| 185 |
} ); |
| 186 |
wpbc_button_enable_loading_icon( this ); |
| 187 |
wpbc_admin_show_message_processing( '' );" ><span><?php esc_html_e('Save and Continue','booking'); ?> </span><i class="menu_icon icon-1x wpbc_icn_arrow_forward_ios"></i></a> |
| 188 |
</div> |
| 189 |
</div> |
| 190 |
|
| 191 |
|
| 192 |
</div> |
| 193 |
<style type="text/css"> |
| 194 |
.wpbc_ajx_page__container .wpbc_ajx_page__section_footer:not(.wpbc__row){ display: none;} |
| 195 |
</style> |
| 196 |
</div> |
| 197 |
</script><?php |
| 198 |
} |
| 199 |
|
| 200 |
|