source: schedule/Module/calendar.php@ 16012

Last change on this file since 16012 was 16012, checked in by tanio, 11 years ago
File size: 8.8 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html>
3 <head>
4 <link type="text/css" rel="stylesheet" href="Module/src/css/jscal2.css" />
5 <link type="text/css" rel="stylesheet" href="Module/src/css/border-radius.css" />
6
7 <link id="skin-win2k" title="Win 2K" type="text/css" rel="alternate stylesheet" href="Module/src/css/win2k/win2k.css" />
8
9 <script src="js/highcharts.js"></script>
10 <script src="js/exporting.js"></script>
11
12 <script src="Module/src/js/jscal2.js"></script>
13 <script src="Module/src/js/unicode-letter.js"></script>
14
15 <script src="Module/src/js/lang/en.js"></script>
16<style type="text/css">
17 .highlight { color: #f00 !important; }
18 .highlight2 { color: #0f0 !important; font-weight: bold; }
19 </style>
20
21 </head>
22 <body style="background-color: #fff">
23
24 <table>
25 <tr>
26 <td valign="top" style="width: 30em;">
27 <div id="cont"></div>
28 <script type="text/javascript">
29 var DATE_INFO = {
30 20130507: { klass: "highlight", tooltip: "%Y/%m/%d (%A)<br />That was yesterday" },
31 20130508: { klass: "highlight", tooltip: "And this is TODAY" }
32 };
33
34 function getDateInfo(date, wantsClassName) {
35 var as_number = Calendar.dateToInt(date);
36 return DATE_INFO[as_number];
37 };
38 var CAL = Calendar.setup({
39 cont: "cont",
40 // weekNumbers: true,
41 selectionType: Calendar.SEL_MULTIPLE,
42 showTime: 24,
43 //fdow : 1,
44 dateInfo:getDateInfo
45 // titleFormat: "%B %Y"
46 })
47 </script>
48 </td>
49
50 <tr>
51 <td>
52 <script type="text/javascript">//<![CDATA[
53 $(document).ready(function(){
54
55 }),
56 CAL.addEventListener("onSelect", function(){
57 var day =this.selection.print("%d").join("\n");
58 var month =this.selection.print("%m").join("\n");
59 var year =this.selection.print("%Y").join("\n");
60 var newline = [];
61 var newdata;
62 var newtime;
63 var source=[];
64 source.push($('#box2View').text());
65 document.getElementById('data').innerHTML=$('#box2View').text();
66 for(var q = 0; q<source.length;q++)
67 {
68 var xmlhttp;
69 if (window.XMLHttpRequest)
70 {// code for IE7+, Firefox, Chrome, Opera, Safari
71 xmlhttp=new XMLHttpRequest();
72 }
73 else
74 {// code for IE6, IE5
75 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
76 }
77 xmlhttp.onreadystatechange=function()
78 {
79 if (xmlhttp.readyState==4 && xmlhttp.status==200)
80 {
81 var options = {
82 chart: {
83 renderTo: 'container' /* display to div Graph*/
84
85 },
86
87 xAxis: {
88 categories:["12PM","1PM","2PM","3PM","4PM","5PM","6PM","7PM","8PM","9PM","10PM","11PM","12AM","1AM","2AM","3AM","4AM","5AM","6AM","7AM","8AM","9AM","10AM","12PM"]
89 },
90 series:[{data:[]}], /* array of Data */
91
92 remove:function()
93 {
94 return false;
95 },
96
97 exporting: { /*--------------------*/
98 buttons: { /* */
99 exportButton: { /* Export */
100 menuItems: null, /* to */
101 onclick: function() { /* PNG.file */
102 this.exportChart(); /*--------------------*/
103 }
104 }
105 }
106 },
107 plotOptions : {
108
109 series : {
110
111
112 marker : {
113 enabled:false
114 }
115 }
116 }
117
118
119
120 };
121 var lines = xmlhttp.responseText.split('\n');
122 var arr;
123 var arrTime = [];
124 var Time = [];
125 var colon = [];
126 var Temp = [];
127 //var source = [];
128 for(var row=0;row<lines.length; row++)
129 {
130 var f = lines[row].split(',');
131 Time[row]=f[0];
132
133 for(var c=0;c<Time.length;c++)
134 {
135 var cst=Time[c].split(':');
136 colon[c]=cst[0];
137 Temp[c]=(parseInt(cst[1]/60*100)||parseFloat("0"));
138 for(var i=1;i<colon.length;i++)
139 {
140 var st=colon[i].split('T');
141 arrTime[i]=(parseFloat(st[1])||parseFloat("0"));
142 }
143 }
144 //arr[row]="["+f[4]+"]";
145 newline[row]=(parseFloat(f[4])||parseFloat("0"));
146 var s=[];
147 for(var c=0;c<newline.length;c++)
148 {
149 if(newline[c]==0)
150 {
151
152 }
153 else
154 s.push(parseFloat(newline[c]));
155 }
156 var finaldata=[];
157 var a=[];
158 for(var i=1;i<arrTime.length-1;i++)
159 {
160 if(arrTime[i]==0)
161 {
162 if(Temp[i]==8)
163 {
164 finaldata.push(arrTime[i]+24+'.08');
165 }
166 else
167 finaldata.push(arrTime[i]+24+'.'+Temp[i]);
168 }
169 else if(arrTime[i]==1)
170 {
171 if(Temp[i]==8)
172 {
173 finaldata.push(arrTime[i]+24+'.08');
174 }
175 else
176 finaldata.push(arrTime[i]+24+'.'+Temp[i]);
177 }
178 else if(arrTime[i]==2)
179 {
180 if(Temp[i]==8)
181 {
182 finaldata.push(arrTime[i]+24+'.08');
183 }
184 else
185 finaldata.push(arrTime[i]+24+'.'+Temp[i]);
186 }
187 else if(arrTime[i]==3)
188 {
189 if(Temp[i]==8)
190 {
191 finaldata.push(arrTime[i]+24+'.08');
192 }
193 else
194 finaldata.push(arrTime[i]+24+'.'+Temp[i]);
195 }
196 else if(arrTime[i]==4)
197 {
198 if(Temp[i]==8)
199 {
200 finaldata.push(arrTime[i]+24+'.08');
201 }
202 else
203 finaldata.push(arrTime[i]+24+'.'+Temp[i]);
204 }
205 else if(arrTime[i]==5)
206 {
207 if(Temp[i]==8)
208 {
209 finaldata.push(arrTime[i]+24+'.08');
210 }
211 else
212 finaldata.push(arrTime[i]+24+'.'+Temp[i]);
213 }
214 else if(arrTime[i]==6)
215 {
216 if(Temp[i]==8)
217 {
218 finaldata.push(arrTime[i]+24+'.08');
219 }
220 else
221 finaldata.push(arrTime[i]+24+'.'+Temp[i]);
222 }
223 else if(arrTime[i]==7)
224 {
225 if(Temp[i]==8)
226 {
227 finaldata.push(arrTime[i]+24+'.08');
228 }
229 else
230 finaldata.push(arrTime[i]+24+'.'+Temp[i]);
231 }
232 else if(arrTime[i]==8)
233 {
234 if(Temp[i]==8)
235 {
236 finaldata.push(arrTime[i]+24+'.08');
237 }
238 else
239 finaldata.push(arrTime[i]+24+'.'+Temp[i]);
240 }
241 else if(Temp[i]==8)
242 {
243
244 finaldata.push(arrTime[i]+'.08');
245
246 }
247 else
248 finaldata.push(arrTime[i]+'.'+Temp[i]);
249
250 }
251 for(var i=0;i<finaldata.length;i++)
252 {
253 a.push("["+parseFloat(finaldata[i])+"]");
254 }
255
256 }
257
258
259
260
261 var chart = new Highcharts.Chart(options);
262 newdata=s;
263
264
265 //document.getElementById('data').innerHTML=finaldata+"T"+s;
266 //document.getElementById('sourcelist').innerHTML=; //aki man edit kuya
267
268
269 /*options.series.push({
270
271 data:[parseFloat(finaldata),parseFloat(newdata1)]
272 });*/
273
274 for(var i=0;i<s.length;i++)
275 {
276
277 chart.series[0].addPoint({
278 x:finaldata[i],
279 y:newdata[i]
280 })
281
282 }
283
284
285
286
287 }
288 }
289
290 xmlhttp.open("GET","http://www.fact-project.org/smartfact/index.php?source="+escape(source[q])+"&time="+year+"-"+month+"-"+day,true);
291 xmlhttp.send();
292 $('#Graph').load('chart.php?day='+day+"&month="+month+"&year="+year);
293 }
294
295 });
296
297 //]]></script>
298 </td>
299 </tr>
300
301 </table>
302 </td>
303 </tr>
304 </table>
305
306 </body>
307</html>
308
309
Note: See TracBrowser for help on using the repository browser.