Add analytics
[bus.git] / busui / owa / modules / base / templates / report_period_filters.tpl
maxious 1 <!-- DEPRICATED -->
2
3 <TABLE>
4
5 <TR>
6 <TH>Site</TH>
7 <TH>Reporting Period</TH>
8 </TR>
9
10 <TR>
11 <TD valign="top">
12 <form action="" method="GET">
13 <SELECT name="sites" onchange='OnChange(this.form.sites, "site_id");' <? if (count($sites) == 1):?>DISABLED<?endif;?>>
14
15 <?foreach ($sites as $site => $value):?>
16 <OPTION VALUE="<?php echo $value['site_id'];?>" <?php if ($params['site_id'] == $value['site_id']): echo 'selected'; endif; ?>><?php echo $value['name'];?></OPTION>
17 <?endforeach;?>
18 <OPTION VALUE="" <?php if (empty($params['site_id'])): echo 'selected'; endif; ?>>All Sites</OPTION>
19
20 </SELECT>
21 </FORM>
22 </TD>
23
24 <TD valign="top">
25 <TABLE cellpadding="0" cellspacing="0">
26 <TR>
27 <TD valign="top">
28 <input type="radio" name="period_type" id="set_periods" onclick='choosePeriodType("set_periods_form");' <? if (array_key_exists($params['period'], $reporting_periods)):?>CHECKED<?endif;?>>
29 </TD>
30 <TH valign="top">Time Period: </th>
31 <TD valign="top"><form action="" method="GET" name="set_periods_form">
32 <SELECT name="period" onchange='OnChange(this.form.period, "period");' <? if (!array_key_exists($params['period'], $reporting_periods)):?>DISABLED<?endif;?>>
33 <? foreach ($reporting_periods as $reporting_period => $value):?>
34 <OPTION VALUE="<?php echo $reporting_period;?>" <?php if ($params['period'] == $reporting_period): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>
35 <?endforeach;?>
36 </SELECT>
37 </FORM>
38 </TD>
39 </TR>
40 <TR>
41
42 <td valign="top">
43 <input type="radio" name="period_type" id="date_periods" onclick='choosePeriodType("date_periods_form");' <? if (array_key_exists($params['period'], $date_reporting_periods)):?>CHECKED<?endif;?>>
44 </TD>
45 <TH valign="top">Date Period:</TH>
46 <TD valign="top">
47 <form action="" method="GET" name="date_periods_form" >
48 <SELECT name="period" onchange='dateFormReveal(this.form.period);' <?php if (!array_key_exists($params['period'], $date_reporting_periods)):?>DISABLED<?php endif;?>>
49 <?php foreach ($date_reporting_periods as $date_reporting_period => $value):?>
50 <OPTION VALUE="<?php echo $date_reporting_period;?>" <?php if ($params['period'] == $date_reporting_period): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>
51 <?php endforeach;?>
52 </SELECT>
53 </FORM>
54 </TD>
55 </TR>
56 </TABLE>
57
58 </TD>
59
60 <TD valign="top">
61
62 <div id="day_container" class="<?if ($params['period'] != 'day'): echo 'invisible'; endif;?>">
63 <table>
64 <form action="" method="GET" name="day" id="day">
65 <TR>
66 <TH>Month</TH>
67 <TH>Day</TH>
68 <TH>Year</TH>
69 </TR>
70 <TR>
71 <TD>
72 <SELECT name="month">
73 <?php foreach ($months as $month => $value):?>
74 <OPTION VALUE="<?php echo $month;?>" <?php if ($params['month'] == $month): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>
75 <?php endforeach;?>
76 </SELECT>
77 </TD>
78 <TD>
79 <SELECT name="day">
80 <?php foreach ($days as $day):?>
81 <OPTION VALUE="<?php echo $day;?>" <?php if ($params['day'] == $day): echo 'selected'; endif; ?>><?php echo $day;?></OPTION>
82 <?php endforeach;?>
83 </SELECT>
84
85 </TD>
86 <TD>
87 <SELECT name="year">
88 <?php foreach ($years as $year):?>
89 <OPTION VALUE="<?php echo $year;?>" <?php if ($params['year'] == $year): echo 'selected'; endif; ?>><?php echo $year;?></OPTION>
90 <?php endforeach;?>
91 </SELECT>
92 </TD>
93 <TD><input type="hidden" name="period" value="day"><input type="button" name="date_submit" value="Go" onclick='changeDate("day");'></TD>
94 </TR>
95 </form>
96 </table>
97 </div>
98
99 <div id="month_container" class="<?if ($params['period'] != 'month'): echo 'invisible'; endif;?>">
100 <table>
101 <form action="" method="GET" name="month" id="month">
102 <TR>
103 <TH>Month</TH>
104 <TH>Year</TH>
105 </TR>
106 <TR>
107 <TD>
108 <SELECT name="month">
109 <?php foreach ($months as $month => $value):?>
110 <OPTION VALUE="<?php echo $month;?>" <?php if ($params['month'] == $month): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>
111 <?php endforeach;?>
112 </SELECT>
113 </TD>
114 <TD>
115 <SELECT name="year">
116 <?php foreach ($years as $year):?>
117 <OPTION VALUE="<?php echo $year;?>" <?php if ($params['year'] == $year): echo 'selected'; endif; ?>><?php echo $year;?></OPTION>
118 <?php endforeach;?>
119 </SELECT>
120 </TD>
121 <TD><input type="hidden" name="period" value="month"><input type="button" name="date_submit" value="Go" onclick='changeDate("month");'></TD>
122 </TR>
123 </form>
124 </table>
125 </div>
126
127 <div id="year_container" class="<?if ($params['period'] != 'year'): echo 'invisible'; endif;?>">
128 <table>
129 <form action="" method="GET" name="" id="year">
130 <TR>
131 <TH>Year</TH>
132 </TR>
133 <TR>
134 <TD>
135 <SELECT name="year">
136 <?php foreach ($years as $year):?>
137 <OPTION VALUE="<?php echo $year;?>" <?php if ($params['year'] == $year): echo 'selected'; endif; ?>><?php echo $year;?></OPTION>
138 <?php endforeach;?>
139 </SELECT>
140 </TD>
141 <TD><input type="hidden" name="period" value="year"><input type="button" name="date_submit" value="Go" onclick='changeDate("year");'></TD>
142 </TR>
143 </form>
144 </table>
145 </div>
146
147 <div id="date_range_container" class="<?if ($params['period'] != 'date_range'): echo 'invisible'; endif;?>">
148 <table>
149 <form action="" method="GET" name="" id="date_range">
150
151 <TR>
152 <TH>Start Month</TH>
153 <TH>Start Day</TH>
154 <TH>Start Year</TH>
155 <TH></TH>
156 <TH>End Month</TH>
157 <TH>End Day</TH>
158 <TH>End Year</TH>
159 </TR>
160 <TR>
161 <TD>
162 <SELECT name="month">
163 <?php foreach ($months as $month => $value):?>
164 <OPTION VALUE="<?php echo $month;?>" <?php if ($params['month'] == $month): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>
165 <?php endforeach;?>
166 </SELECT>
167 </TD>
168 <TD>
169 <SELECT name="day">
170 <?php foreach ($days as $day):?>
171 <OPTION VALUE="<?php echo $day;?>" <?php if ($params['day'] == $day): echo 'selected'; endif; ?>><?php echo $day;?></OPTION>
172 <?php endforeach;?>
173 </SELECT>
174
175 </TD>
176 <TD>
177 <SELECT name="year">
178 <?php foreach ($years as $year):?>
179 <OPTION VALUE="<?php echo $year;?>" <?php if ($params['year'] == $year): echo 'selected'; endif; ?>><?php echo $year;?></OPTION>
180 <?php endforeach;?>
181 </SELECT>
182 </TD>
183
184 <TD> to </TD>
185
186 <TD>
187 <SELECT name="month2">
188 <?php foreach ($months as $month => $value):?>
189 <OPTION VALUE="<?php echo $month;?>" <?php if ($params['month2'] == $month): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>
190 <?php endforeach;?>
191 </SELECT>
192 </TD>
193 <TD>
194 <SELECT name="day2">
195 <?php foreach ($days as $day):?>
196 <OPTION VALUE="<?php echo $day;?>" <?php if ($params['day2'] == $day): echo 'selected'; endif; ?>><?php echo $day;?></OPTION>
197 <?php endforeach;?>
198 </SELECT>
199
200 </TD>
201 <TD>
202 <SELECT name="year2">
203 <?php foreach ($years as $year):?>
204 <OPTION VALUE="<?php echo $year;?>" <?php if ($params['year2'] == $year): echo 'selected'; endif; ?>><?php echo $year;?></OPTION>
205 <?php endforeach;?>
206 </SELECT>
207 </TD>
208
209
210 <TD><input type="hidden" name="period" value="date_range"><input type="button" name="date_submit" value="Go" onclick='changeDate("date_range");'></TD>
211 </TR>
212
213
214 </form>
215 </table>
216 </div>
217
218 </TD>
219
220 </TR>
221 </TABLE>
222 <?//print_r($params);?>
223 <SCRIPT>
224 <!--
225
226 var params = new Object()
227
228 <?php foreach ($params as $k => $v):?>
229 params["<?php echo $k;?>"] = "<?php echo $v;?>";
230 <?php endforeach;?>
231
232 var baseURL = '<?php echo $this->makeLink();?>'
233
234 function OnChange(dropdown, change_param) {
235
236 var getParam = change_param
237 var myindex = dropdown.selectedIndex
238 var SelValue = dropdown.options[myindex].value
239
240 params[getParam] = SelValue;
241
242 delete params["month"];
243 delete params["day"];
244 delete params["year"];
245 delete params["month2"];
246 delete params["day2"];
247 delete params["year2"];
248
249 get_string = owa_makeQueryString(params);
250
251 top.location.href = baseURL + get_string;
252
253 return true;
254 }
255
256 function changeDate(form_name) {
257
258 var f = document.getElementById(form_name);
259
260 delete params["month"];
261 delete params["day"];
262 delete params["year"];
263 delete params["month2"];
264 delete params["day2"];
265 delete params["year2"];
266
267 if (form_name == 'day') {
268 params["month"] = f.month.value;
269 params["day"] = f.day.value;
270 params["year"] = f.year.value;
271
272 }
273
274 if (form_name == 'month') {
275 params["month"] = f.month.value;
276 params["year"] = f.year.value;
277 }
278
279 if (form_name == 'year') {
280 params["year"] = f.year.value;
281 }
282
283 if (form_name == 'date_range') {
284 params["month"] = f.month.value;
285 params["day"] = f.day.value;
286 params["year"] = f.year.value;
287 params["month2"] = f.month2.value;
288 params["day2"] = f.day2.value;
289 params["year2"] = f.year2.value;
290 }
291
292 params["period"] = f.period.value;
293
294 get_string = owa_makeQueryString(params);
295
296 top.location.href = baseURL + get_string;
297
298 return true;
299
300 }
301
302 function owa_makeQueryString(params) {
303
304 var get_string = ""
305
306 for(param in params) { // print out the params
307 get_string = get_string + '&owa_' + param + "=" + params[param];
308 }
309
310 return get_string;
311
312 }
313
314 function dateFormReveal(element_name) {
315
316 var div_container = element_name.value + '_container'
317
318 document.getElementById('day_container').className = "invisible";
319 document.getElementById('month_container').className = "invisible";
320 document.getElementById('year_container').className = "invisible";
321 document.getElementById('date_range_container').className = "invisible";
322
323 document.getElementById(div_container).className = "visible";
324
325 return true;
326 }
327
328 function choosePeriodType(form_name) {
329
330
331 document.set_periods_form.period.disabled = true;
332 document.date_periods_form.period.disabled = true;
333 document.forms[form_name].period.disabled = false;
334
335 if (form_name == 'date_periods_form') {
336
337 element_name = document.forms[form_name].period;
338
339 dateFormReveal(element_name);
340
341 }
342
343 if (form_name == 'set_periods_form') {
344
345 element_name = document.forms[form_name].period;
346
347 document.getElementById('day_container').className = "invisible";
348 document.getElementById('month_container').className = "invisible";
349 document.getElementById('year_container').className = "invisible";
350 document.getElementById('date_range_container').className = "invisible";
351
352 //dateFormReveal(element_name);
353
354 }
355
356
357 return true;
358 }
359
360 //-->
361 </SCRIPT>
362
363