PluginProbe
Welcart e-Commerce / 1.3.8
Welcart e-Commerce v1.3.8
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / includes / admin_schedule.php

admin_schedule.php in Welcart e-Commerce 1.3.8, at includes/admin_schedule.php

347 lines 16.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 require_once(USCES_PLUGIN_DIR . '/classes/calendar.class.php');
3
4 //cur
5 list($todayyy, $todaymm, $todaydd) = getToday();
6 $cal1 = new calendarData();
7 $cal1->setToday($todayyy, $todaymm, $todaydd);
8 $cal1->setCalendarData();
9 //next
10 list($nextyy, $nextmm, $nextdd) = getAfterMonth($todayyy, $todaymm, 1, 1);
11 $cal2 = new calendarData();
12 $cal2->setToday($nextyy, $nextmm, $nextdd);
13 $cal2->setCalendarData();
14 //aft
15 list($lateryy, $latermm, $laterdd) = getAfterMonth($todayyy, $todaymm, 1, 2);
16 $cal3 = new calendarData();
17 $cal3->setToday($lateryy, $latermm, $laterdd);
18 $cal3->setCalendarData();
19
20 $yearstr = substr(get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), 0, 4);
21
22 $status = $this->action_status;
23 $message = $this->action_message;
24 $this->action_status = 'none';
25 $this->action_message = '';
26
27 $campaign_schedule_start_year = isset($this->options['campaign_schedule']['start']['year']) ? $this->options['campaign_schedule']['start']['year'] : 0;
28 $campaign_schedule_start_month = isset($this->options['campaign_schedule']['start']['month']) ? $this->options['campaign_schedule']['start']['month'] : 0;
29 $campaign_schedule_start_day = isset($this->options['campaign_schedule']['start']['day']) ? $this->options['campaign_schedule']['start']['day'] : 0;
30 $campaign_schedule_start_hour = isset($this->options['campaign_schedule']['start']['hour']) ? $this->options['campaign_schedule']['start']['hour'] : 0;
31 $campaign_schedule_start_min = isset($this->options['campaign_schedule']['start']['min']) ? $this->options['campaign_schedule']['start']['min'] : 0;
32 $campaign_schedule_end_year = isset($this->options['campaign_schedule']['end']['year']) ? $this->options['campaign_schedule']['end']['year'] : 0;
33 $campaign_schedule_end_month = isset($this->options['campaign_schedule']['end']['month']) ? $this->options['campaign_schedule']['end']['month'] : 0;
34 $campaign_schedule_end_day = isset($this->options['campaign_schedule']['end']['day']) ? $this->options['campaign_schedule']['end']['day'] : 0;
35 $campaign_schedule_end_hour = isset($this->options['campaign_schedule']['end']['hour']) ? $this->options['campaign_schedule']['end']['hour'] : 0;
36 $campaign_schedule_end_min = isset($this->options['campaign_schedule']['end']['min']) ? $this->options['campaign_schedule']['end']['min'] : 0;
37 ?>
38 <script type="text/javascript">
39 jQuery(function($){
40 <?php if($status == 'success'){ ?>
41 $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000);
42 <?php }else if($status == 'caution'){ ?>
43 $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000);
44 <?php }else if($status == 'error'){ ?>
45 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
46 <?php } ?>
47
48 $("#aAdditionalURLs").click(function () {
49 $("#AdditionalURLs").toggle();
50 });
51 });
52
53 function toggleVisibility(id) {
54 var e = document.getElementById(id);
55 if(e.style.display == 'block')
56 e.style.display = 'none';
57 else
58 e.style.display = 'block';
59 }
60
61 function cangeBus(id, r, c) {
62 var e = document.getElementById(id+'_'+r+'_'+c);
63 var v = document.getElementById(id).rows[r].cells[c];
64 if (e.value == '0') {
65 e.value = '1';
66 v.style.backgroundColor = '#DFFFDD';
67 v.style.color = '#555555';
68 v.style.fontWeight = 'normal';
69 } else {
70 e.value = '0';
71 v.style.backgroundColor = '#FFAA55';
72 v.style.color = '#FFFFFF';
73 v.style.fontWeight = 'bold';
74 }
75 }
76
77 function cangeWday1(id, c) {
78 <?php for ($i = 0; $i < $cal1->getRow(); $i++) : ?>
79 if (document.getElementById(id+'_'+<?php echo ($i+1); ?>+'_'+c)) {
80 var e = document.getElementById(id+'_'+<?php echo ($i+1); ?>+'_'+c);
81 var v = document.getElementById(id).rows[<?php echo ($i+1); ?>].cells[c];
82 if (e.value == '0') {
83 e.value = '1';
84 v.style.backgroundColor = '#DFFFDD';
85 v.style.color = '#555555';
86 v.style.fontWeight = 'normal';
87 } else {
88 e.value = '0';
89 v.style.backgroundColor = '#FFAA55';
90 v.style.color = '#FFFFFF';
91 v.style.fontWeight = 'bold';
92 }
93 }
94 <?php endfor; ?>
95 }
96
97 function cangeWday2(id, c) {
98 <?php for ($i = 0; $i < $cal2->getRow(); $i++) : ?>
99 if (document.getElementById(id+'_'+<?php echo ($i+1); ?>+'_'+c)) {
100 var e = document.getElementById(id+'_'+<?php echo ($i+1); ?>+'_'+c);
101 var v = document.getElementById(id).rows[<?php echo ($i+1); ?>].cells[c];
102 if (e.value == '0') {
103 e.value = '1';
104 v.style.backgroundColor = '#DFFFDD';
105 v.style.color = '#555555';
106 v.style.fontWeight = 'normal';
107 } else {
108 e.value = '0';
109 v.style.backgroundColor = '#FFAA55';
110 v.style.color = '#FFFFFF';
111 v.style.fontWeight = 'bold';
112 }
113 }
114 <?php endfor; ?>
115 }
116
117 function cangeWday3(id, c) {
118 <?php for ($i = 0; $i < $cal3->getRow(); $i++) : ?>
119 if (document.getElementById(id+'_'+<?php echo ($i+1); ?>+'_'+c)) {
120 var e = document.getElementById(id+'_'+<?php echo ($i+1); ?>+'_'+c);
121 var v = document.getElementById(id).rows[<?php echo ($i+1); ?>].cells[c];
122 if (e.value == '0') {
123 e.value = '1';
124 v.style.backgroundColor = '#DFFFDD';
125 v.style.color = '#555555';
126 v.style.fontWeight = 'normal';
127 } else {
128 e.value = '0';
129 v.style.backgroundColor = '#FFAA55';
130 v.style.color = '#FFFFFF';
131 v.style.fontWeight = 'bold';
132 }
133 }
134 <?php endfor; ?>
135 }
136
137 </script>
138 <div class="wrap">
139 <div class="usces_admin">
140 <h2>Welcart Shop <?php _e('Business Days Setting','usces'); ?></h2>
141 <div id="aniboxStatus" class="<?php echo $status; ?>">
142 <div id="anibox" class="clearfix">
143 <img src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
144 <div class="mes" id="info_massage"><?php echo $message; ?></div>
145 </div>
146 </div>
147 <form action="" method="post" name="option_form" id="option_form">
148 <input name="usces_option_update" type="submit" class="button" value="<?php _e('change decision','usces'); ?>" />
149 <div id="poststuff" class="metabox-holder">
150 <?php do_action( 'usces_action_admin_schedule1' ); ?>
151 <div class="postbox">
152 <h3 class="hndle"><span><?php _e('Campaign Schedule','usces'); ?></span><a style="cursor:pointer;" onclick="toggleVisibility('ex_campaign_schedule');"> (<?php _e('explanation', 'usces'); ?>) </a></h3>
153 <div class="inside">
154 <table class="form_table">
155 <tr>
156 <th><?php _e('starting time','usces'); ?></th>
157 <td><select name="campaign_schedule[start][year]">
158 <option value="0"<?php if($campaign_schedule_start_year == 0) echo ' selected="selected"'; ?>></option>
159 <option value="<?php echo $yearstr; ?>"<?php if($campaign_schedule_start_year == $yearstr) echo ' selected="selected"'; ?>><?php echo $yearstr; ?></option>
160 <option value="<?php echo $yearstr+1; ?>"<?php if($campaign_schedule_start_year == ($yearstr+1)) echo ' selected="selected"'; ?>><?php echo $yearstr+1; ?></option>
161 </select></td>
162 <td><?php _e('year','usces'); ?></td>
163 <td><select name="campaign_schedule[start][month]">
164 <option value="0"<?php if($campaign_schedule_start_month == 0) echo ' selected="selected"'; ?>></option>
165 <?php for($i=1; $i<13; $i++) : ?>
166 <option value="<?php echo $i; ?>"<?php if($campaign_schedule_start_month == $i) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
167 <?php endfor; ?>
168 </select></td>
169 <td><?php _e('month','usces'); ?></td>
170 <td><select name="campaign_schedule[start][day]">
171 <option value="0"<?php if($campaign_schedule_start_day == 0) echo ' selected="selected"'; ?>></option>
172 <?php for($i=1; $i<32; $i++) : ?>
173 <option value="<?php echo $i; ?>"<?php if($campaign_schedule_start_day == $i) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
174 <?php endfor; ?>
175 </select></td>
176 <td><?php _e('day','usces'); ?></td>
177 <td><select name="campaign_schedule[start][hour]">
178 <?php for($i=0; $i<24; $i++) : ?>
179 <option value="<?php echo $i; ?>"<?php if($campaign_schedule_start_hour == $i) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
180 <?php endfor; ?>
181 </select></td>
182 <td><?php _e('hour','usces'); ?></td>
183 <td><select name="campaign_schedule[start][min]">
184 <?php for($i=0; $i<12; $i++) : ?>
185 <option value="<?php echo $i*5; ?>"<?php if($campaign_schedule_start_min == ($i*5)) echo ' selected="selected"'; ?>><?php echo $i*5; ?></option>
186 <?php endfor; ?>
187 </select></td>
188 <td><?php _e('min','usces'); ?></td>
189 </tr>
190 <tr>
191 <th><?php _e('date and time of termination','usces'); ?></th>
192 <td><select name="campaign_schedule[end][year]">
193 <option value="0"<?php if($campaign_schedule_end_year == 0) echo ' selected="selected"'; ?>></option>
194 <option value="<?php echo $yearstr; ?>"<?php if($campaign_schedule_end_year == $yearstr) echo ' selected="selected"'; ?>><?php echo $yearstr; ?></option>
195 <option value="<?php echo $yearstr+1; ?>"<?php if($campaign_schedule_end_year == ($yearstr+1)) echo ' selected="selected"'; ?>><?php echo $yearstr+1; ?></option>
196 </select></td>
197 <td><?php _e('year','usces'); ?></td>
198 <td><select name="campaign_schedule[end][month]">
199 <option value="0"<?php if($campaign_schedule_end_month == 0) echo ' selected="selected"'; ?>></option>
200 <?php for($i=1; $i<13; $i++) : ?>
201 <option value="<?php echo $i; ?>"<?php if($campaign_schedule_end_month == $i) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
202 <?php endfor; ?>
203 </select></td>
204 <td><?php _e('month','usces'); ?></td>
205 <td><select name="campaign_schedule[end][day]">
206 <option value="0"<?php if($campaign_schedule_end_day == 0) echo ' selected="selected"'; ?>></option>
207 <?php for($i=1; $i<32; $i++) : ?>
208 <option value="<?php echo $i; ?>"<?php if($campaign_schedule_end_day == $i) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
209 <?php endfor; ?>
210 </select></td>
211 <td><?php _e('day','usces'); ?></td>
212 <td><select name="campaign_schedule[end][hour]">
213 <?php for($i=0; $i<24; $i++) : ?>
214 <option value="<?php echo $i; ?>"<?php if($campaign_schedule_end_hour == $i) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
215 <?php endfor; ?>
216 </select></td>
217 <td><?php _e('hour','usces'); ?></td>
218 <td><select name="campaign_schedule[end][min]">
219 <?php for($i=0; $i<12; $i++) : ?>
220 <option value="<?php echo $i*5; ?>"<?php if($campaign_schedule_end_min == ($i*5)) echo ' selected="selected"'; ?>><?php echo $i*5; ?></option>
221 <?php endfor; ?>
222 </select></td>
223 <td><?php _e('min','usces'); ?></td>
224 </tr>
225 </table>
226 <hr size="1" color="#CCCCCC" />
227 <div id="ex_campaign_schedule" class="explanation"><?php _e('reserve the period of campaign.', 'usces'); ?></div>
228 </div>
229 </div><!--postbox-->
230 <?php do_action( 'usces_action_admin_schedule2' ); ?>
231 <div class="postbox">
232 <h3 class="hndle"><span><?php _e('Business Calendar', 'usces'); ?></span><a style="cursor:pointer;" onclick="toggleVisibility('ex_shipping_charge');"> (<?php _e('explanation', 'usces'); ?>) </a></h3>
233 <div class="inside">
234 <table class="form_table">
235 <tr>
236 <th><?php _e('This month', 'usces'); ?><br /><?php echo sprintf(__('%2$s/%1$s', 'usces'),$todayyy,$todaymm); ?></th>
237 <td>
238 <table cellspacing="0" id="calendar1" class="calendar">
239 <tr>
240 <th class="cal"><div onclick="cangeWday1('calendar1', '0');"><font color="#FF3300"><?php _e('Sun', 'usces'); ?></font></div></th>
241 <th class="cal"><div onclick="cangeWday1('calendar1', '1');"><?php _e('Mon', 'usces'); ?></div></th>
242 <th class="cal"><div onclick="cangeWday1('calendar1', '2');"><?php _e('Tue', 'usces'); ?></div></th>
243 <th class="cal"><div onclick="cangeWday1('calendar1', '3');"><?php _e('Wed', 'usces'); ?></div></th>
244 <th class="cal"><div onclick="cangeWday1('calendar1', '4');"><?php _e('Thu', 'usces'); ?></div></th>
245 <th class="cal"><div onclick="cangeWday1('calendar1', '5');"><?php _e('Fri', 'usces'); ?></div></th>
246 <th class="cal"><div onclick="cangeWday1('calendar1', '6');"><?php _e('Sat', 'usces'); ?></div></th>
247 </tr>
248 <?php for ($i = 0; $i < $cal1->getRow(); $i++) : ?>
249 <tr>
250 <?php for ($d = 0; $d <= 6; $d++) :
251 $mday = $cal1->getDateText($i, $d);
252 if ($mday != "") {
253 $business = $this->options['business_days'][$todayyy][$todaymm][$mday];
254 $color = ($business == 1) ? '#DFFFDD' : '#FFAA55;color:#FFFFFF;font-weight:bold;'; ?>
255 <td class="cal" style="background-color:<?php echo $color; ?>"><div onclick="cangeBus('calendar1', <?php echo ($i + 1); ?>, <?php echo $d; ?>);"><?php echo $mday; ?></div>
256 <input name="business_days[<?php echo $todayyy; ?>][<?php echo $todaymm; ?>][<?php echo $mday; ?>]" id="calendar1_<?php echo ($i+1); ?>_<?php echo $d; ?>" type="hidden" value="<?php echo $business; ?>"></td>
257 <?php } else { ?>
258 <td>&nbsp;</td>
259 <?php } ?>
260 <?php endfor; ?>
261 </tr>
262 <?php endfor; ?>
263 </table>
264 </td>
265 <td><span class="business_days_exp_box" style="background-color:#DFFFDD">&nbsp;&nbsp;&nbsp;</span><?php _e('Working day', 'usces'); ?><br /><span class="business_days_exp_box" style="background-color:#FFAA55">&nbsp;&nbsp;&nbsp;</span><?php _e('Holiday for Shipping Operations', 'usces'); ?></td>
266 </tr>
267 <tr>
268 <th><?php _e('Next month', 'usces'); ?><br /><?php echo sprintf(__('%2$s/%1$s', 'usces'),$nextyy,$nextmm); ?></th>
269 <td>
270 <table cellspacing="0" id="calendar2" class="calendar">
271 <tr>
272 <th class="cal"><div onclick="cangeWday2('calendar2', '0');"><font color="#FF3300"><?php _e('Sun', 'usces'); ?></font></div></th>
273 <th class="cal"><div onclick="cangeWday2('calendar2', '1');"><?php _e('Mon', 'usces'); ?></div></th>
274 <th class="cal"><div onclick="cangeWday2('calendar2', '2');"><?php _e('Tue', 'usces'); ?></div></th>
275 <th class="cal"><div onclick="cangeWday2('calendar2', '3');"><?php _e('Wed', 'usces'); ?></div></th>
276 <th class="cal"><div onclick="cangeWday2('calendar2', '4');"><?php _e('Thu', 'usces'); ?></div></th>
277 <th class="cal"><div onclick="cangeWday2('calendar2', '5');"><?php _e('Fri', 'usces'); ?></div></th>
278 <th class="cal"><div onclick="cangeWday2('calendar2', '6');"><?php _e('Sat', 'usces'); ?></div></th>
279 </tr>
280 <?php for ($i = 0; $i < $cal2->getRow(); $i++) : ?>
281 <tr>
282 <?php for ($d = 0; $d <= 6; $d++) :
283 $mday = $cal2->getDateText($i, $d);
284 if ($mday != "") {
285 $business = $this->options['business_days'][$nextyy][$nextmm][$mday];
286 $color = ($business == 1) ? '#DFFFDD' : '#FFAA55;color:#FFFFFF;font-weight:bold;'; ?>
287 <td class="cal" style="background-color:<?php echo $color; ?>"><div onclick="cangeBus('calendar2', <?php echo ($i + 1); ?>, <?php echo $d; ?>);"><?php echo $mday; ?></div>
288 <input name="business_days[<?php echo $nextyy; ?>][<?php echo $nextmm; ?>][<?php echo $mday; ?>]" id="calendar2_<?php echo ($i+1); ?>_<?php echo $d; ?>" type="hidden" value="<?php echo $business; ?>"></td>
289 <?php } else { ?>
290 <td>&nbsp;</td>
291 <?php } ?>
292 <?php endfor; ?>
293 </tr>
294 <?php endfor; ?>
295 </table>
296 </td>
297 <td>&nbsp;</td>
298 </tr>
299 <tr>
300 <th><?php _e('Month after next month', 'usces'); ?><br /><?php echo sprintf(__('%2$s/%1$s', 'usces'),$lateryy,$latermm); ?></th>
301 <td>
302 <table cellspacing="0" id="calendar3" class="calendar">
303 <tr>
304 <th class="cal"><div onclick="cangeWday3('calendar3', '0');"><font color="#FF3300"><?php _e('Sun', 'usces'); ?></font></div></th>
305 <th class="cal"><div onclick="cangeWday3('calendar3', '1');"><?php _e('Mon', 'usces'); ?></div></th>
306 <th class="cal"><div onclick="cangeWday3('calendar3', '2');"><?php _e('Tue', 'usces'); ?></div></th>
307 <th class="cal"><div onclick="cangeWday3('calendar3', '3');"><?php _e('Wed', 'usces'); ?></div></th>
308 <th class="cal"><div onclick="cangeWday3('calendar3', '4');"><?php _e('Thu', 'usces'); ?></div></th>
309 <th class="cal"><div onclick="cangeWday3('calendar3', '5');"><?php _e('Fri', 'usces'); ?></div></th>
310 <th class="cal"><div onclick="cangeWday3('calendar3', '6');"><?php _e('Sat', 'usces'); ?></div></th>
311 </tr>
312 <?php for ($i = 0; $i < $cal3->getRow(); $i++) : ?>
313 <tr>
314 <?php for ($d = 0; $d <= 6; $d++) :
315 $mday = $cal3->getDateText($i, $d);
316 if ($mday != "") {
317 $business = $this->options['business_days'][$lateryy][$latermm][$mday];
318 //20110131ysk start
319 //if(empty($business)) $business = '0';
320 if($business != 0) $business = 1;
321 //20110131ysk end
322 $color = ($business == 1) ? '#DFFFDD' : '#FFAA55;color:#FFFFFF;font-weight:bold;'; ?>
323 <td class="cal" style="background-color:<?php echo $color; ?>"><div onclick="cangeBus('calendar3', <?php echo ($i + 1); ?>, <?php echo $d; ?>);"><?php echo $mday; ?></div>
324 <input name="business_days[<?php echo $lateryy; ?>][<?php echo $latermm; ?>][<?php echo $mday; ?>]" id="calendar3_<?php echo ($i+1); ?>_<?php echo $d; ?>" type="hidden" value="<?php echo $business; ?>"></td>
325 <?php } else { ?>
326 <td>&nbsp;</td>
327 <?php } ?>
328 <?php endfor; ?>
329 </tr>
330 <?php endfor; ?>
331 </table>
332 </td>
333 <td>&nbsp;</td>
334 </tr>
335 </table>
336 <hr size="1" color="#CCCCCC" />
337 <div id="ex_shipping_charge" class="explanation"></div>
338 </div>
339 </div><!--postbox-->
340 <?php do_action( 'usces_action_admin_schedule3' ); ?>
341
342
343 </div><!--poststuff-->
344 <input name="usces_option_update" type="submit" class="button" value="<?php _e('change decision','usces'); ?>" />
345 </form>
346 </div><!--usces_admin-->
347 </div><!--wrap-->