source: schedule/Module/calendar.php@ 16174

Last change on this file since 16174 was 16174, checked in by tanio, 12 years ago
File size: 9.0 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 <?php
31 $sqlSched=mysql_query("SELECT*FROM schedule");
32 $SchedCnt=mysql_num_rows($sqlSched);
33 $cntr=1;
34 while($rowSched=mysql_fetch_array($sqlSched))
35 {
36 $timestamp=strtotime($rowSched['fStart']);
37 if($SchedCnt==$cntr)
38 {
39 echo date("Ymd",$timestamp);?>:{klass: "highlight"}<?php
40 }
41 else
42 {
43 echo date("Ymd",$timestamp);?>:{klass: "highlight"},<?php
44 }
45 $cntr++;
46 ?>
47
48 // 20130507: { klass: "highlight", tooltip: "%Y/%m/%d (%A)<br />That was yesterday" },
49 // 20130508: { klass: "highlight", tooltip: "And this is TODAY" }
50 <?php
51 }
52 ?>
53 };
54
55 function getDateInfo(date, wantsClassName) {
56 var as_number = Calendar.dateToInt(date);
57 return DATE_INFO[as_number];
58 };
59 var CAL = Calendar.setup({
60 cont: "cont",
61 // weekNumbers: true,
62 selectionType: Calendar.SEL_MULTIPLE,
63 showTime: 24,
64 //fdow : 1,
65 dateInfo:getDateInfo
66 // titleFormat: "%B %Y"
67 })
68 </script>
69 </td>
70
71 <tr>
72 <td>
73 <script type="text/javascript">//<![CDATA[
74 CAL.addEventListener("onSelect", function(){
75 var day =this.selection.print("%d").join("\n");
76 var month =this.selection.print("%m").join("\n");
77 var year =this.selection.print("%Y").join("\n");
78 var xml;
79 var Time = [[]];
80 var DataValue = [[]];
81 var Time1 = [];
82 var TimeColon = [];
83 var MinTime = [];
84 var HourTime = [];
85 var DataVal = [];
86 var source=['Crab','Mrk 501','Mrk 421'];
87 var options = {
88 chart: {
89 renderTo: 'container'
90 /* display to div Graph*/
91
92 },
93
94 xAxis: {
95 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"]
96 },
97 series:[], /* array of Data */
98
99 remove:function()
100 {
101 return false;
102 },
103
104 exporting: { /*--------------------*/
105 buttons: { /* */
106 exportButton: { /* Export */
107 menuItems: null, /* to */
108 onclick: function() { /* PNG.file */
109 this.exportChart(); /*--------------------*/
110 }
111 }
112 }
113 },
114 plotOptions : {
115
116 series : {
117 lineWidth: 3,
118
119 marker : {
120 enabled:false
121 }
122 }
123 }
124 };
125
126 var chart = new Highcharts.Chart(options);
127 function loaddata()
128 {
129 for(var i=0; i<source.length;i++)
130 {
131
132 if(window.XMLHttpRequest)
133 {
134 xml=new XMLHttpRequest();
135 }
136 else
137 {
138 xml=new ActiveXObject("Microsoft.XMLHTTP");
139 }
140 xml.onreadystatechange = function()
141 {
142 if(xml.readyState==4 && xml.status ==200)
143 {
144 var lines=xml.responseText.split("\n");
145 for(var row=0;row<lines.length;row++)
146 {
147 var splitted=lines[row].split(',');
148 Time1[row]=splitted[0];
149 for(var SplittedTime=0;SplittedTime<Time1.length;SplittedTime++)
150 {
151 var SplitTime=Time1[SplittedTime].split(':');
152 TimeColon[SplittedTime]=SplitTime[0];
153 MinTime[SplittedTime]=(parseInt(SplitTime[1]/60*100)||parseInt("0"));
154 for(var TimeT=0;TimeT<TimeColon.length;TimeT++)
155 {
156 var SplittedT=TimeColon[TimeT].split('T');
157 HourTime[TimeT]=(parseFloat(SplittedT[1])||parseInt('0'));
158 }
159 }
160 DataVal[row]=(parseFloat(splitted[4])||parseInt('0'));
161 //document.getElementById('data').innerHTML=DataValue;
162
163 for(var Data=0; Data<DataVal.length;Data++)
164 {
165 if(DataVal[Data]==0)
166 {
167
168 }
169 else
170 DataValue.push(parseFloat(DataVal[Data]));
171 }
172
173
174 for(var ConTime=1;ConTime<HourTime.length-1;ConTime++)
175 {
176 if(HourTime[ConTime]==0)
177 {
178 if(MinTime[ConTime]==8)
179 {
180 Time.push(HourTime[ConTime]+24+'.'+'.08');
181 }
182 else
183 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]);
184 }
185 else if(HourTime[ConTime]==1)
186 {
187 if(MinTime[ConTime]==8)
188 {
189 Time.push(HourTime[ConTime]+24+'.'+'.08');
190 }
191 else
192 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]);
193 }
194 else if(HourTime[ConTime]==2)
195 {
196 if(MinTime[ConTime]==8)
197 {
198 Time.push(HourTime[ConTime]+24+'.'+'.08');
199 }
200 else
201 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]);
202 }
203 else if(HourTime[ConTime]==3)
204 {
205 if(MinTime[ConTime]==8)
206 {
207 Time.push(HourTime[ConTime]+24+'.'+'.08');
208 }
209 else
210 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]);
211 }
212 else if(HourTime[ConTime]==4)
213 {
214 if(MinTime[ConTime]==8)
215 {
216 Time.push(HourTime[ConTime]+24+'.'+'.08');
217 }
218 else
219 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]);
220 }
221 else if(HourTime[ConTime]==5)
222 {
223 if(MinTime[ConTime]==8)
224 {
225 Time.push(HourTime[ConTime]+24+'.'+'.08');
226 }
227 else
228 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]);
229 }
230 else if(HourTime[ConTime]==6)
231 {
232 if(MinTime[ConTime]==8)
233 {
234 Time.push(HourTime[ConTime]+24+'.'+'.08');
235 }
236 else
237 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]);
238 }
239 else
240 Time.push(HourTime[ConTime]+'.'+MinTime[ConTime]);
241
242 }
243
244 //GrapData(Data,Time);
245
246 }
247
248
249 }
250 }
251 xml.open("GET","http://www.fact-project.org/smartfact/index.php?source="+escape(source[i])+"&time="+year+"-"+month+"-"+day,true);
252 xml.send();
253
254
255 }
256 loadGraph(DataValue,Time);
257 }
258 function loadGraph(x,y)
259 {
260 for(var src=0;src<i;src++)
261 {
262 chart.addSeries({name:source[src], data:[]}); // created a series of data and add name of displayed source
263 for(var DataCnt=0;DataCnt<x[src].length;DataCnt++)
264 {
265
266 chart.series[src].addPoint({ // series[0] means index of zero in data;
267 x:x[src][DataCnt], // Time
268 y:y[src][DataCnt] // Value
269 })
270 document.getElementById('data').innerHTML=x;
271
272 }
273
274 }
275 }
276 loadGraph();
277 $('#Graph').load('chart.php?day='+day+"&month="+month+"&year="+year);
278
279 });
280
281 //]]></script>
282
283 </td>
284 </tr>
285
286 </table>
287 </td>
288 </tr>
289 </table>
290
291 </body>
292</html>
293
294
Note: See TracBrowser for help on using the repository browser.