PluginProbe ʕ •ᴥ•ʔ
PiWeb Delivery & Pickup Date Time for WooCommerce / 3.0.49.11
PiWeb Delivery & Pickup Date Time for WooCommerce v3.0.49.11
3.0.63 3.0.62 3.0.61 3.0.60 3.0.49.49 3.0.49.6 3.0.49.60 3.0.49.61 3.0.49.62 3.0.49.63 3.0.49.64 3.0.49.66 3.0.49.67 3.0.49.69 3.0.49.7 3.0.49.70 3.0.49.72 3.0.49.73 3.0.49.74 3.0.49.76 3.0.49.77 3.0.49.79 3.0.49.9 3.0.49.90 3.0.49.91 3.0.49.92 3.0.49.93 3.0.49.94 3.0.49.96 3.0.49.97 3.0.49.99 trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 2.9.17 3.0.47 3.0.49 3.0.49.1 3.0.49.10 3.0.49.11 3.0.49.12 3.0.49.13 3.0.49.16 3.0.49.17 3.0.49.19 3.0.49.2 3.0.49.20 3.0.49.21 3.0.49.22 3.0.49.23 3.0.49.24 3.0.49.26 3.0.49.27 3.0.49.29 3.0.49.3 3.0.49.30 3.0.49.31 3.0.49.32 3.0.49.33 3.0.49.34 3.0.49.36 3.0.49.37 3.0.49.39 3.0.49.4 3.0.49.40 3.0.49.41 3.0.49.42 3.0.49.43 3.0.49.44 3.0.49.46 3.0.49.47
pi-woocommerce-order-date-time-and-type / admin / options-time.php
pi-woocommerce-order-date-time-and-type / admin Last commit date
css 1 year ago img 1 year ago js 1 year ago class-adv-order-filter.php 1 year ago class-pi-dtt-labels.php 1 year ago class-pi-dtt-order-table.php 1 year ago conflict-fixer.php 1 year ago menu.php 1 year ago options-addons.php 1 year ago options-date.php 1 year ago options-limit.php 1 year ago options-pickup.php 1 year ago options-time-slot.php 1 year ago options-time.php 1 year ago options.php 1 year ago
options-time.php
215 lines
1 <?php
2
3 class pisol_dtt_option_time{
4
5 private $settings = array();
6
7 private $active_tab;
8
9 private $this_tab = 'time';
10
11 private $tab_name = "Time Range";
12
13 private $setting_key = 'pisol_dtt_time';
14
15 public $tab;
16
17 function __construct(){
18
19 $this->tab = sanitize_text_field(filter_input( INPUT_GET, 'tab'));
20 $this->active_tab = $this->tab != "" ? $this->tab : 'default';
21
22
23
24 $this->settings = array(
25 array('field'=>'sunday', 'class'=> 'bg-secondary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Set general time range, that will be applied for all days of the week','pisol-dtt'), 'type'=>'setting_category'),
26
27 array('field'=>'pi_delivery_start_time', 'label'=>__('Delivery start time','pisol-dtt'), 'type'=>'text', 'required'=>'required', 'readonly'=>'readonly'),
28
29 array('field'=>'pi_delivery_end_time', 'label'=>__('Delivery end time','pisol-dtt'), 'type'=>'text', 'required'=>'required', 'readonly'=>'readonly') ,
30
31 array('field'=>'pi_pickup_start_time', 'label'=>__('Pickup start time','pisol-dtt'), 'type'=>'text', 'required'=>'required', 'readonly'=>'readonly'),
32
33 array('field'=>'pi_pickup_end_time', 'label'=>__('Pickup end time','pisol-dtt'), 'type'=>'text', 'required'=>'required', 'readonly'=>'readonly')
34 );
35
36
37 if($this->this_tab == $this->active_tab){
38 add_action('pisol_dtt_tab_content', array($this,'tab_content'));
39 }
40
41 add_action('pisol_dtt_tab', array($this,'tab'),2);
42
43 add_action('admin_notices',array($this,'validateTime'));
44
45 $this->register_settings();
46
47 if(PISOL_DTT_FREE_RESET_SETTING){
48 $this->delete_settings();
49 }
50
51 }
52
53 function delete_settings(){
54 foreach($this->settings as $setting){
55 delete_option( $setting['field'] );
56 }
57 }
58
59 function register_settings(){
60
61 foreach($this->settings as $setting){
62 pisol_class_form::register_setting( $this->setting_key, $setting);
63 }
64
65 }
66
67 function tab(){
68 $page = sanitize_text_field(filter_input( INPUT_GET, 'page'));
69 ?>
70 <a class=" pi-side-menu <?php echo ($this->active_tab == $this->this_tab ? 'bg-primary' : 'bg-secondary'); ?>" href="<?php echo admin_url( 'admin.php?page='.$page.'&tab='.$this->this_tab ); ?>">
71 <span class="dashicons dashicons-dashboard"></span> <?php _e( $this->tab_name, 'pisol-dtt' ); ?>
72 </a>
73 <?php
74 }
75
76 function tab_content(){
77 ?>
78 <form method="post" action="options.php" class="pisol-setting-form">
79 <?php settings_fields( $this->setting_key ); ?>
80 <?php
81 foreach($this->settings as $setting){
82 new pisol_class_form($setting, $this->setting_key);
83 }
84
85 $this->proFeatureRow(__('Monday (Set different time range for Monday)', 'pisol-dtt' ), 'pi_monday_time_slot_delivery', 'pi_monday_time_slot_pickup','monday1');
86 $this->proFeatureRow(__('Tuesday (Set different time range for Tuesday)', 'pisol-dtt' ), 'pi_tuesday_time_slot_delivery', 'pi_tuesday_time_slot_pickup','tuesday1');
87 $this->proFeatureRow(__('Wednesday (Set different time range for Wednesday)', 'pisol-dtt' ), 'pi_wednesday_time_slot_delivery', 'pi_wednesday_time_slot_pickup','wednesday1');
88 $this->proFeatureRow(__('Thursday (Set different time range for Thursday)', 'pisol-dtt' ), 'pi_Thursday_time_slot_delivery', 'pi_Thursday_time_slot_pickup','Thursday1');
89 $this->proFeatureRow(__('Friday (Set different time range for Friday)', 'pisol-dtt' ), 'pi_Friday_time_slot_delivery', 'pi_Friday_time_slot_pickup','Friday1');
90 $this->proFeatureRow(__('Saturday (Set different time range for Saturday)', 'pisol-dtt' ), 'pi_Saturday_time_slot_delivery', 'pi_Saturday_time_slot_pickup','Saturday1');
91 $this->proFeatureRow(__('Sunday (Set different time range for Sunday)', 'pisol-dtt' ), 'pi_Sunday_time_slot_delivery', 'pi_Sunday_time_slot_pickup','Sunday1');
92
93 ?>
94 <input type="submit" name="submit" id="submit" class="btn btn-primary btn-lg my-3" value="<?php echo __('Save Changes','pisol-dtt'); ?>">
95 </form>
96
97 <?php
98
99 }
100
101 function validateTime(){
102 $delivery_start = get_option('pi_delivery_start_time', '');
103 $delivery_end = get_option('pi_delivery_end_time', '');
104 $pickup_start = get_option('pi_pickup_start_time', '');
105 $pickup_end = get_option('pi_pickup_end_time', '');
106
107 $time_enabled = get_option('pi_datetime', true);
108
109 if(empty($time_enabled)) return;
110
111 $delivery_types = get_option('pi_type', 'Both');
112
113 $range_slot = get_option('pi_use_time_slot','all_range');
114
115 $time_range_page = admin_url('admin.php?page=pisol-dtt&tab=time');
116
117 if($range_slot == 'all_range' || $range_slot == 'pickup_slot_delivery_range'){
118 if($delivery_types == 'Both' || $delivery_types == 'Delivery'){
119 if( !empty($delivery_start) && !empty($delivery_end) ){
120 $delivery_start_time = strtotime($delivery_start);
121 $delivery_end_time = strtotime($delivery_end);
122
123 if($delivery_start_time > $delivery_end_time){
124 self::adminError('Delivery start time cant be grater then the end time in Time range', $time_range_page);
125 }
126 }
127
128 if( empty($delivery_start) && empty($delivery_end) ){
129
130 self::adminError('Set Delivery timing range else default timing range will be used 9 AM to 9 PM', $time_range_page);
131
132 }
133 }
134 }
135
136 if($range_slot == 'all_range' || $range_slot == 'delivery_slot_pickup_range'){
137 if($delivery_types == 'Both' || $delivery_types == 'Pickup'){
138 if(!empty($pickup_start) && !empty($pickup_end) ){
139 $pickup_start_time = strtotime($pickup_start);
140 $pickup_end_time = strtotime($pickup_end);
141
142 if($pickup_start_time > $pickup_end_time){
143 self::adminError('Pickup start time cant be grater then the end time in Time range', $time_range_page);
144 }
145 }
146
147 if( empty($delivery_start) && empty($delivery_end) ){
148
149 self::adminError('Set Pickup timing range else default timing range will be used 9 AM to 9 PM', $time_range_page);
150
151 }
152 }
153 }
154
155 $delivery_slots = get_option('pi_general_time_slot_delivery',array());
156 $pickup_slots = get_option('pi_general_time_slot_pickup',array());
157
158 $time_slot_page = admin_url('admin.php?page=pisol-dtt&tab=pi_time_slot');
159
160 if(($range_slot == 'all_slot' || $range_slot == 'delivery_slot_pickup_range') && empty($delivery_slots)){
161 self::adminError('Configure Delivery time slots in Time slot tab',$time_slot_page);
162 }
163
164 if(($range_slot == 'all_slot' || $range_slot == 'pickup_slot_delivery_range') && empty($pickup_slots)){
165 self::adminError('Configure Pickup time slots in Time slot tab',$time_slot_page);
166 }
167 }
168
169 static function adminError($msg, $page){
170
171 echo sprintf('<div class="notice notice-error is-dismissible"><p><strong><span style="color:#f00;">ERROR: </span> %s</strong> <a href="%s">Click here to correct this issue</a></p></div>', $msg, esc_attr($page));
172 }
173
174 function proFeatureRow($label, $field_delivery, $field_pickup, $overwrite_day = ""){
175 if(empty($overwrite_day)){
176 $bg = 'bg-primary';
177 $hide="";
178 }else{
179 $bg = 'bg-dark';
180 $overwrite_value = pisol_dtt_get_setting('pi_different_slot_for_'.$overwrite_day, "");
181 $checked ="";
182 $hide =' style="display:none;" ';
183 if(!empty($overwrite_value)){
184 $checked = ' checked="checked" ';
185 $hide="";
186 }
187 }
188 ?>
189 <div id="row_sunday" class="row py-2 border-bottom align-items-center free-version <?php echo $bg; ?> text-light">
190 <div class="col-10">
191 <?php if(empty($overwrite_day)){ ?>
192 <h5 class="mt-0 mb-0 py-2 text-light font-weight-light h4"><label for="pi_different_slot_for_<?php echo $overwrite_day; ?>"><?php echo $label; ?></label></h5>
193 <?php }else{ ?>
194 <h5 class="mt-0 mb-0 text-light font-weight-light h5"><label for="pi_different_slot_for_<?php echo $overwrite_day; ?>"><?php echo $label; ?></label></h5>
195 <?php } ?>
196 </div>
197 <?php if(!empty($overwrite_day)): ?>
198 <div class="col-2 text-right">
199 <div class="custom-control custom-switch">
200 <input type="checkbox" class="custom-control-input" name="pi_different_slot_for_<?php echo $overwrite_day; ?>" id="pi_different_slot_for_<?php echo $overwrite_day; ?>" <?php echo $checked; ?>>
201 <label class="custom-control-label" for="pi_different_slot_for_<?php echo $overwrite_day; ?>"></label>
202 </div>
203 </div>
204 <?php endif; ?>
205 </div>
206 <?php
207 }
208
209 }
210
211 /* if we have pro version setting for time tab then we can disable this */
212 new pisol_dtt_option_time();
213
214
215