1 | <?php
|
---|
2 | {
|
---|
3 | function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup)
|
---|
4 | {
|
---|
5 | $fromtable="Sequences";
|
---|
6 |
|
---|
7 | $groups = 0;
|
---|
8 | foreach ($checkgroup as $element)
|
---|
9 | if ($element==-1)
|
---|
10 | $groups++;
|
---|
11 |
|
---|
12 | $statusgroups = 0;
|
---|
13 | foreach ($checkstatusgroup as $element)
|
---|
14 | if ($element==-1)
|
---|
15 | $statusgroups++;
|
---|
16 |
|
---|
17 | $query0 = "SELECT ";
|
---|
18 |
|
---|
19 | if ($groups>0)
|
---|
20 | {
|
---|
21 | foreach ($checkgroup as $key => $element)
|
---|
22 | if ($element==-1)
|
---|
23 | $query0 .= $key . " as '" . $alias[$key] . "' " . ", ";
|
---|
24 | //--------------------------------------------------
|
---|
25 | $query0 .= "SUM(fRunTime)/3600 as '" . $alias["SUM(fRunTime)/3600"] . "', ";
|
---|
26 | //--------------------------------------------------
|
---|
27 | $query0 .= " SUM(fNumEvents) as '" . $alias["SUM(fNumEvents)"] . "', ";
|
---|
28 | $query0 .= " Min(fZenithDistanceMin) as '" . $alias["Min(fZenithDistanceMin)"] . "', ";
|
---|
29 | $query0 .= " Max(fZenithDistanceMax) as '" . $alias["Max(fZenithDistanceMax)"] . "', ";
|
---|
30 | $query0 .= " COUNT(*) as 'Sequence' ";
|
---|
31 | }
|
---|
32 | else
|
---|
33 | {
|
---|
34 | if ($statusgroups>0)
|
---|
35 | {
|
---|
36 | foreach ($checkstatusgroup as $key => $element)
|
---|
37 | if ($element==-1)
|
---|
38 | $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
|
---|
39 |
|
---|
40 | $query0 .= " count(*) as 'Sequence'";
|
---|
41 |
|
---|
42 | }
|
---|
43 | else
|
---|
44 | {
|
---|
45 | if (!empty($_GET["fSendTxt"]))
|
---|
46 | $query0 .= " " . $fromtable . ".fSequenceFirst as '" . $alias["fSequenceFirst"] . "' ";
|
---|
47 | else
|
---|
48 | {
|
---|
49 | $query0 .= " CONCAT('<A&ws;HREF=\"runinfo.php?', 'fRunStart=On', '&fZenithDistance=On', '&fRunMin=', Sequences.fSequenceFirst, '&fMeanTriggerRate=On', '&fRunTypeName=On', '&fRunMax=', fSequenceLast, '&fNumEvents=On', '&fSourceName=On&', 'fExcludedFDAKEY=1', '&fSequenceFirst=On', '&fRawFileAvail=On', '&fCCFileAvail=On', '&fCaCoFileAvail=On', '&fNumResults=500\">', Sequences.fSequenceFirst, '</A>') ";
|
---|
50 | $query0 .= " as " . $alias["fSequenceFirst"];
|
---|
51 | if (!empty($_GET["fLinks"]))
|
---|
52 | {
|
---|
53 | $query0 .= ", CONCAT('<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), 'callisto', LPAD(CONCAT(Sequences.fSequenceFirst , '.html'), 13,'0') , '\">cl</A>'";
|
---|
54 | $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), '\">c</A>'";
|
---|
55 | $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/star/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), 'star', LPAD(CONCAT(Sequences.fSequenceFirst , '.html'), 13,'0') , '\">sl</A>'";
|
---|
56 | $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/star/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), '\">s</A>'";
|
---|
57 | $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/sequences/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/sequence', LPAD(CONCAT(Sequences.fSequenceFirst , '.txt'), 12,'0') , '\">', 'f </A>') ";
|
---|
58 | $query0 .= " as 'Links'";
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|
62 | foreach ($_GET as $key => $element)
|
---|
63 | if ($_GET[$key]=="On")
|
---|
64 | if ($key!="fLinks" && $key!="fOff" && $key!="fOnlyOff")
|
---|
65 | if (empty($checkwhere[$key]) || $checkwhere[$key]==0)
|
---|
66 | $query0 .= ", " . $key . " as '" . $alias[$key] . "' ";
|
---|
67 | }
|
---|
68 | }
|
---|
69 |
|
---|
70 | $query0 .= " FROM " . $fromtable;
|
---|
71 |
|
---|
72 | $query0 .= " LEFT JOIN SequenceProcessStatus ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
|
---|
73 | $query0 .= " LEFT JOIN Calibration ON Sequences.fSequenceFirst=Calibration.fSequenceFirst ";
|
---|
74 | $query0 .= " LEFT JOIN Star ON Sequences.fSequenceFirst=Star.fSequenceFirst ";
|
---|
75 |
|
---|
76 | foreach ($_GET as $key => $element)
|
---|
77 | if (($_GET[$key]=="On" || $groups>0))// && !empty(GetJoin($fromtable,$key)))
|
---|
78 | $query0 .= GetJoin($fromtable,$key);
|
---|
79 |
|
---|
80 | if ($_GET["fOff"]=="Off")
|
---|
81 | {
|
---|
82 | if (strpos($query0, " WHERE ")==FALSE)
|
---|
83 | $query0 .= " WHERE ";
|
---|
84 | else
|
---|
85 | $query0 .= " AND ";
|
---|
86 |
|
---|
87 | $query0 .= " NOT (fSourceName like '%Off%')";
|
---|
88 | }
|
---|
89 |
|
---|
90 | if ($_GET["fOnlyOff"]=="On")
|
---|
91 | {
|
---|
92 | if (strpos($query0, " WHERE ")==FALSE)
|
---|
93 | $query0 .= " WHERE ";
|
---|
94 | else
|
---|
95 | $query0 .= " AND ";
|
---|
96 |
|
---|
97 | $query0 .= " fSourceName like '%Off%'";
|
---|
98 | }
|
---|
99 |
|
---|
100 | foreach ($checkwhere as $key => $element)
|
---|
101 | {
|
---|
102 | if (empty($element) || $element<=0)
|
---|
103 | continue;
|
---|
104 |
|
---|
105 | if (strpos($query0, " WHERE ")==FALSE)
|
---|
106 | $query0 .= " WHERE ";
|
---|
107 | else
|
---|
108 | if ($element!=-1)
|
---|
109 | if (strrpos($query0, " AND ")!=strlen($query0)-5)
|
---|
110 | $query0 .= " AND ";
|
---|
111 |
|
---|
112 | if ($element!=-1)
|
---|
113 | $query0 .= GetCheck($fromtable, $key) . "=" . $element;
|
---|
114 | }
|
---|
115 |
|
---|
116 | if (strpos($query0, " WHERE ")==FALSE)
|
---|
117 | $query0 .= " WHERE ";
|
---|
118 | else
|
---|
119 | $query0 .= " AND ";
|
---|
120 |
|
---|
121 | $query0 .= StatusQuery("fStar");
|
---|
122 |
|
---|
123 | if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
|
---|
124 | $query0 .= "Sequences.fSequenceFirst BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " ";
|
---|
125 | else
|
---|
126 | $query0 = substr($query0, 0, -4);
|
---|
127 |
|
---|
128 | /*
|
---|
129 | if (!empty($_GET["fDate"]))
|
---|
130 | $query0 .= " AND fRunStart REGEXP \"^" . $_GET["fDate"] . "\" ";
|
---|
131 | */
|
---|
132 |
|
---|
133 | if (!empty($_GET["fSourceN"]))
|
---|
134 | $query0 .= " AND fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" ";
|
---|
135 |
|
---|
136 | if (!empty($_GET["fStartDate"]))
|
---|
137 | {
|
---|
138 | if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
|
---|
139 | $query0 .= " AND ";
|
---|
140 |
|
---|
141 | $startdate=substr($_GET["fStartDate"], 0, 10);
|
---|
142 | if ($startdate=="0000-00-00")
|
---|
143 | $query0 .=" fRunStart >= '" . $startdate . " 00:00:00' ";
|
---|
144 | else
|
---|
145 | $query0 .= " fRunStart >= ADDDATE('" . $startdate . " 13:00:00', INTERVAL -1 DAY) ";
|
---|
146 | }
|
---|
147 |
|
---|
148 | if (!empty($_GET["fStopDate"]))
|
---|
149 | {
|
---|
150 | if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
|
---|
151 | $query0 .= " AND ";
|
---|
152 |
|
---|
153 | $stopdate=substr($_GET["fStopDate"], 0, 10);
|
---|
154 | $query0 .= " fRunStart < '" . $stopdate . " 13:00:00' ";
|
---|
155 | }
|
---|
156 |
|
---|
157 | if (!empty($_GET["fStarStart"]))
|
---|
158 | {
|
---|
159 | if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
|
---|
160 | $query0 .= " AND ";
|
---|
161 |
|
---|
162 | $starstart=substr($_GET["fStarStart"], 0, 10);
|
---|
163 | $query0 .=" fStar >= '" . $starstart . " 00:00:00' ";
|
---|
164 | }
|
---|
165 |
|
---|
166 | if (!empty($_GET["fStarStop"]))
|
---|
167 | {
|
---|
168 | if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
|
---|
169 | $query0 .= " AND ";
|
---|
170 |
|
---|
171 | $starstop=substr($_GET["fStarStop"], 0, 10);
|
---|
172 | $query0 .= " fStar < '" . $starstop . " 00:00:00' ";
|
---|
173 | }
|
---|
174 |
|
---|
175 | if ($groups>0)
|
---|
176 | {
|
---|
177 | $query0 .= " GROUP BY ";
|
---|
178 | $num = $groups;
|
---|
179 | foreach ($checkgroup as $key => $element)
|
---|
180 | if ($element==-1)
|
---|
181 | {
|
---|
182 | $query0 .= GetCheck($fromtable,$key);
|
---|
183 | if ($num-->1)
|
---|
184 | $query0 .= ", ";
|
---|
185 | }
|
---|
186 | }
|
---|
187 |
|
---|
188 | if ($statusgroups>0)
|
---|
189 | {
|
---|
190 | $query0 .= " GROUP BY ";
|
---|
191 | $num = $statusgroups;
|
---|
192 | foreach ($checkstatusgroup as $key => $element)
|
---|
193 | if ($element==-1)
|
---|
194 | {
|
---|
195 | $query0 .= $alias[$key];
|
---|
196 | if ($num-->1)
|
---|
197 | $query0 .= ", ";
|
---|
198 | }
|
---|
199 | }
|
---|
200 |
|
---|
201 | if (!empty($_GET["fSortBy"]))
|
---|
202 | {
|
---|
203 | $val=substr($_GET["fSortBy"], 0, -1);
|
---|
204 | $query0 .= " ORDER BY " . GetTable($fromtable,$val) . " ";
|
---|
205 | if (substr($_GET["fSortBy"], -1)=="-")
|
---|
206 | $query0 .= "DESC";
|
---|
207 | }
|
---|
208 |
|
---|
209 | if (empty($_GET["fSortBy"]) && $groups==0 && $statusgroups==0)
|
---|
210 | $query0 .= "ORDER BY Sequences.fSequenceFirst ASC ";
|
---|
211 |
|
---|
212 | if (empty($_GET["fNumStart"]))
|
---|
213 | $_GET["fNumStart"]=0;
|
---|
214 |
|
---|
215 | if (empty($_GET["fSendTxt"]))
|
---|
216 | $query0 .= " LIMIT " . $_GET["fNumStart"] . ", " . $_GET["fNumResults"];
|
---|
217 |
|
---|
218 | return $query0;
|
---|
219 | }
|
---|
220 |
|
---|
221 | function InitGet($_GET)
|
---|
222 | {
|
---|
223 | // Find out whether it is the first call to the php script
|
---|
224 | $first = empty($_GET["fRunMin"]) && empty($_GET["fRunMax"]);
|
---|
225 |
|
---|
226 | if (empty($_GET["fNumResults"]))
|
---|
227 | $_GET["fNumResults"]="50";
|
---|
228 |
|
---|
229 | if (empty($_GET["fLastUpdate"]))
|
---|
230 | $_GET["fLastUpdate"]="Off";
|
---|
231 |
|
---|
232 | if (empty($_GET["fNumEvents"]))
|
---|
233 | $_GET["fNumEvents"]="Off";
|
---|
234 |
|
---|
235 | if (empty($_GET["fRunStart"]))
|
---|
236 | $_GET["fRunStart"]=$first?"On":"";
|
---|
237 |
|
---|
238 | if (empty($_GET["fRunTime/60"]))
|
---|
239 | $_GET["fRunTime/60"]=$first?"On":"";
|
---|
240 |
|
---|
241 | if (empty($_GET["fSequenceLast"]))
|
---|
242 | $_GET["fSequenceLast"]="Off";
|
---|
243 |
|
---|
244 | if (empty($_GET["fLinks"]))
|
---|
245 | $_GET["fLinks"]=$first?"On":"";
|
---|
246 |
|
---|
247 | if (empty($_GET["fOff"]))
|
---|
248 | $_GET["fOff"]=$first?"On":"Off";
|
---|
249 |
|
---|
250 | if (empty($_GET["fOnlyOff"]))
|
---|
251 | $_GET["fOnlyOff"]=$first?"Off":"";
|
---|
252 |
|
---|
253 | if (empty($_GET["fArrTimeLimitMean"]))
|
---|
254 | $_GET["fArrTimeLimitMean"]="";
|
---|
255 |
|
---|
256 | if (empty($_GET["fArrTimeLimitRms"]))
|
---|
257 | $_GET["fArrTimeLimitRms"]="";
|
---|
258 |
|
---|
259 | if (empty($_GET["fPedRmsInLimitMean"]))
|
---|
260 | $_GET["fPedRmsInLimitMean"]="";
|
---|
261 |
|
---|
262 | if (empty($_GET["fPedRmsInLimitRms"]))
|
---|
263 | $_GET["fPedRmsInLimitRms"]="";
|
---|
264 |
|
---|
265 | if (empty($_GET["fMuonRateLimitMean"]))
|
---|
266 | $_GET["fMuonRateLimitMean"]="";
|
---|
267 |
|
---|
268 | if (empty($_GET["fMuonRateLimitRms"]))
|
---|
269 | $_GET["fMuonRateLimitRms"]="";
|
---|
270 |
|
---|
271 | if (empty($_GET["fImgRateLimitMean"]))
|
---|
272 | $_GET["fImgRateLimitMean"]="";
|
---|
273 |
|
---|
274 | if (empty($_GET["fImgRateLimitRms"]))
|
---|
275 | $_GET["fImgRateLimitRms"]="";
|
---|
276 |
|
---|
277 | if (empty($_GET["fPSFLimitMean"]))
|
---|
278 | $_GET["fPSFLimitMean"]="";
|
---|
279 |
|
---|
280 | if (empty($_GET["fPSFLimitRms"]))
|
---|
281 | $_GET["fPSFLimitRms"]="";
|
---|
282 |
|
---|
283 | if (empty($_GET["fUnsInLimitMean"]))
|
---|
284 | $_GET["fUnsInLimitMean"]="";
|
---|
285 |
|
---|
286 | if (empty($_GET["fZdMinLimitMean"]))
|
---|
287 | $_GET["fZdMinLimitMean"]="";
|
---|
288 |
|
---|
289 | if (empty($_GET["fZdMaxLimitMean"]))
|
---|
290 | $_GET["fZdMaxLimitMean"]="";
|
---|
291 |
|
---|
292 | if (empty($_GET["fAzimuthMin"]))
|
---|
293 | $_GET["fAzimuthMin"]="Off";
|
---|
294 |
|
---|
295 | if (empty($_GET["fAzimuthMax"]))
|
---|
296 | $_GET["fAzimuthMax"]="Off";
|
---|
297 |
|
---|
298 | if (empty($_GET["fZenithDistanceMin"]))
|
---|
299 | $_GET["fZenithDistanceMin"]=$first?"On":"";
|
---|
300 |
|
---|
301 | if (empty($_GET["fZenithDistanceMax"]))
|
---|
302 | $_GET["fZenithDistanceMax"]=$first?"On":"";
|
---|
303 |
|
---|
304 | if (empty($_GET["fSourceName"]))
|
---|
305 | $_GET["fSourceName"]="On";
|
---|
306 |
|
---|
307 | if (empty($_GET["fManuallyChangedName"]))
|
---|
308 | $_GET["fManuallyChangedName"]="Off";
|
---|
309 |
|
---|
310 | if (empty($_GET["fLightConditionsName"]))
|
---|
311 | $_GET["fLightConditionsName"]=$first?"On":"";
|
---|
312 |
|
---|
313 | if (empty($_GET["fStar"]))
|
---|
314 | $_GET["fStar"]="Off";
|
---|
315 |
|
---|
316 | if (empty($_GET["fStarStatus"]))
|
---|
317 | $_GET["fStarStatus"]=$first?"1":"";
|
---|
318 |
|
---|
319 | if (empty($_GET["fUnreliableInner"]))
|
---|
320 | $_GET["fUnreliableInner"]="Off";
|
---|
321 |
|
---|
322 | if (empty($_GET["fUnsuitableOuter"]))
|
---|
323 | $_GET["fUnsuitableOuter"]="Off";
|
---|
324 |
|
---|
325 | if (empty($_GET["fUnreliableOuter"]))
|
---|
326 | $_GET["fUnreliableOuter"]="Off";
|
---|
327 |
|
---|
328 | if (empty($_GET["fUnsuitableInner"]))
|
---|
329 | $_GET["fUnsuitableInner"]=$first?"On":"";
|
---|
330 |
|
---|
331 | if (empty($_GET["fIsolatedInner"]))
|
---|
332 | $_GET["fIsolatedInner"]="Off";
|
---|
333 |
|
---|
334 | if (empty($_GET["fIsolatedOuter"]))
|
---|
335 | $_GET["fIsolatedOuter"]="Off";
|
---|
336 |
|
---|
337 | if (empty($_GET["fMeanPedRmsInner"]))
|
---|
338 | $_GET["fMeanPedRmsInner"]=$first?"On":"";
|
---|
339 |
|
---|
340 | if (empty($_GET["fMeanPedRmsOuter"]))
|
---|
341 | $_GET["fMeanPedRmsOuter"]="Off";
|
---|
342 |
|
---|
343 | if (empty($_GET["fIsolatedMaxCluster"]))
|
---|
344 | $_GET["fIsolatedMaxCluster"]="Off";
|
---|
345 |
|
---|
346 | if (empty($_GET["fArrTimeMeanInner"]))
|
---|
347 | $_GET["fArrTimeMeanInner"]="Off";
|
---|
348 |
|
---|
349 | if (empty($_GET["fArrTimeMeanOuter"]))
|
---|
350 | $_GET["fArrTimeMeanOuter"]="Off";
|
---|
351 |
|
---|
352 | if (empty($_GET["fArrTimeRmsInner"]))
|
---|
353 | $_GET["fArrTimeRmsInner"]=$first?"On":"";
|
---|
354 |
|
---|
355 | if (empty($_GET["fArrTimeRmsOuter"]))
|
---|
356 | $_GET["fArrTimeRmsOuter"]="Off";
|
---|
357 |
|
---|
358 | if (empty($_GET["fConvFactorInner"]))
|
---|
359 | $_GET["fConvFactorInner"]=$first?"On":"";
|
---|
360 |
|
---|
361 | if (empty($_GET["fConvFactorOuter"]))
|
---|
362 | $_GET["fConvFactorOuter"]="Off";
|
---|
363 |
|
---|
364 | if (empty($_GET["fMeanNumberIslands"]))
|
---|
365 | $_GET["fMeanNumberIslands"]="Off";
|
---|
366 |
|
---|
367 | if (empty($_GET["fPSF"]))
|
---|
368 | $_GET["fPSF"]=$first?"On":"";
|
---|
369 |
|
---|
370 | if (empty($_GET["fRatio"]))
|
---|
371 | $_GET["fRatio"]="Off";
|
---|
372 |
|
---|
373 | if (empty($_GET["fMuonNumber"]))
|
---|
374 | $_GET["fMuonNumber"]="Off";
|
---|
375 |
|
---|
376 | if (empty($_GET["fEffOnTime"]))
|
---|
377 | $_GET["fEffOnTime"]="Off";
|
---|
378 |
|
---|
379 | if (empty($_GET["fMuonRate"]))
|
---|
380 | $_GET["fMuonRate"]=$first?"On":"";
|
---|
381 |
|
---|
382 | if (empty($_GET["fDataRate"]))
|
---|
383 | $_GET["fDataRate"]=$first?"On":"";
|
---|
384 |
|
---|
385 | if (empty($_GET["fMaxHumidity"]))
|
---|
386 | $_GET["fMaxHumidity"]="Off";
|
---|
387 |
|
---|
388 | }
|
---|
389 |
|
---|
390 | function PrintForm($_GET, $db, $limits, $rms, $alias)
|
---|
391 | {
|
---|
392 | printf("<center>\n");
|
---|
393 | printf("<form action=\"findoffdata.php\" METHOD=\"GET\">\n");
|
---|
394 |
|
---|
395 | printf(" <table>\n");
|
---|
396 | printf(" <tr><td align='center'>\n");
|
---|
397 |
|
---|
398 |
|
---|
399 | printf(" <table>\n");
|
---|
400 | printf(" <tr>\n");
|
---|
401 |
|
---|
402 | CheckBox("fRunStart", "Start time");
|
---|
403 | CheckBox("fSequenceLast", "Last run");
|
---|
404 | CheckBox("fZenithDistanceMin", "Zd min");
|
---|
405 | CheckBox("fZenithDistanceMax", "Zd max");
|
---|
406 |
|
---|
407 | printf(" </tr><tr>\n");
|
---|
408 |
|
---|
409 | CheckBox("fNumEvents", "Num of events");
|
---|
410 | CheckBox("fRunTime/60", "Duration");
|
---|
411 | CheckBox("fAzimuthMin", "Azimuth min");
|
---|
412 | CheckBox("fAzimuthMax", "Azimuth max");
|
---|
413 | // CheckBox("fLinks", "Links");
|
---|
414 | /*
|
---|
415 | printf(" </tr></table>\n");
|
---|
416 | printf(" <p>\n");
|
---|
417 | printf(" <table>\n");
|
---|
418 | printf(" <tr>\n");
|
---|
419 | */
|
---|
420 |
|
---|
421 | printf(" </tr><tr>\n");
|
---|
422 |
|
---|
423 | CheckBox("fUnsuitableInner", "Unsuitable inner");
|
---|
424 | CheckBox("fUnsuitableOuter", "Unsuitable outer");
|
---|
425 | CheckBox("fUnreliableInner", "Unreliable inner");
|
---|
426 | CheckBox("fUnreliableOuter", "Unreliable outer");
|
---|
427 |
|
---|
428 | printf(" </tr><tr>\n");
|
---|
429 |
|
---|
430 | CheckBox("fIsolatedInner", "Isolated inner");
|
---|
431 | CheckBox("fIsolatedOuter", "Isolated outer");
|
---|
432 | CheckBox("fIsolatedMaxCluster", "IsolatedMaxCl.");
|
---|
433 |
|
---|
434 | printf(" </tr><tr>\n");
|
---|
435 |
|
---|
436 | CheckBox("fArrTimeMeanInner", "ArrTimeMean in");
|
---|
437 | CheckBox("fArrTimeMeanOuter", "ArrTimeMean out");
|
---|
438 | CheckBox("fArrTimeRmsInner", "ArrTimeRms in");
|
---|
439 | CheckBox("fArrTimeRmsOuter", "ArrTimeRms out");
|
---|
440 |
|
---|
441 | printf(" </tr><tr>\n");
|
---|
442 |
|
---|
443 | CheckBox("fConvFactorInner", "Conv inner ");
|
---|
444 | CheckBox("fConvFactorOuter", "Conv outer ");
|
---|
445 | CheckBox("fMeanPedRmsInner", "MeanPedRms in");
|
---|
446 | CheckBox("fMeanPedRmsOuter", "MeanPedRms out");
|
---|
447 |
|
---|
448 | /*
|
---|
449 | printf(" </tr></table>\n");
|
---|
450 | printf(" <p>\n");
|
---|
451 |
|
---|
452 | printf(" <table>\n");
|
---|
453 | printf(" <tr>\n");
|
---|
454 | */
|
---|
455 |
|
---|
456 | printf(" </tr><tr>\n");
|
---|
457 |
|
---|
458 | CheckBox("fMeanNumberIslands", "MeanNumIslands");
|
---|
459 | CheckBox("fPSF", "PSF");
|
---|
460 | CheckBox("fRatio", "Ratio");
|
---|
461 | CheckBox("fMuonRate", "MuonRate");
|
---|
462 |
|
---|
463 | printf(" </tr><tr>\n");
|
---|
464 |
|
---|
465 | CheckBox("fMuonNumber", "MuonNumber");
|
---|
466 | CheckBox("fEffOnTime", "EffOnTime");
|
---|
467 | CheckBox("fMaxHumidity", "MaxHumidity");
|
---|
468 | CheckBox("fDataRate", "CleanedEvtRate");
|
---|
469 |
|
---|
470 | printf(" </tr>\n");
|
---|
471 | printf(" </table>\n");
|
---|
472 | printf(" <p>\n");
|
---|
473 |
|
---|
474 | printf(" <table><tr><td>\n");
|
---|
475 |
|
---|
476 | PrintPullDown($db, "Source", "fSourceName", "fSourceKEY", "Source Name");
|
---|
477 | printf(" </td><td>\n");
|
---|
478 | PrintPullDown($db, "LightConditions", "fLightConditionsName", "fLightConditionsKEY", "Light Conditions");
|
---|
479 | printf(" </td><td>\n");
|
---|
480 | PrintPullDown($db, "ManuallyChanged", "fManuallyChangedName", "fManuallyChangedKEY", "Manually changed");
|
---|
481 | printf(" </td><td>\n");
|
---|
482 | PrintStatusMenu("fStar", "Star");
|
---|
483 |
|
---|
484 | printf("</td></tr> </table>\n");
|
---|
485 | printf(" <p>\n");
|
---|
486 |
|
---|
487 | printf(" </td><td valign='top'>\n");
|
---|
488 |
|
---|
489 | printf(" <table>\n");
|
---|
490 | printf(" <tr><th colspan='3'>Limits</th><tr>\n");
|
---|
491 | printf(" <tr><td>Name </td><td> Mean </td><td> Rms </td></tr>\n");
|
---|
492 | PrintLimitsMenu($limits, $rms, $alias);
|
---|
493 | printf(" </td></tr></table>\n");
|
---|
494 |
|
---|
495 | printf(" </td></tr><tr><td colspan='2' align='center'>\n");
|
---|
496 |
|
---|
497 | printf(" <p>\n");
|
---|
498 |
|
---|
499 | printf(" <table>\n");
|
---|
500 | printf(" <tr><td>\n");
|
---|
501 |
|
---|
502 | if (empty($_GET["fStarStart"]))
|
---|
503 | $starmin = GetMin("fStar", "SequenceProcessStatus", $db);
|
---|
504 | else
|
---|
505 | $starmin = $_GET["fStarStart"];
|
---|
506 |
|
---|
507 | if (empty($_GET["fStarStop"]))
|
---|
508 | $starmax = GetMax("fStar", "SequenceProcessStatus", $db);
|
---|
509 | else
|
---|
510 | $starmax = $_GET["fStarStop"];
|
---|
511 |
|
---|
512 | printf("StarDone (yyyy-mm-dd) from <input name=\"fStarStart\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\">\n", $starmin);
|
---|
513 | printf("to <input name=\"fStarStop\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\"> \n", $starmax);
|
---|
514 | printf(" </td>\n");
|
---|
515 | CheckBox("fLinks", "Links");
|
---|
516 | CheckBox("fOff", "incl. offsources");
|
---|
517 | CheckBox("fOnlyOff", "only offsources");
|
---|
518 |
|
---|
519 | printf(" </tr>\n");
|
---|
520 | printf(" </table>\n");
|
---|
521 | printf(" <p>\n");
|
---|
522 |
|
---|
523 | if (empty($_GET["fStartDate"]))
|
---|
524 | $timemin = GetMin("fRunStart", "Sequences", $db);
|
---|
525 | else
|
---|
526 | $timemin = $_GET["fStartDate"];
|
---|
527 |
|
---|
528 | if (empty($_GET["fStopDate"]))
|
---|
529 | $timemax = GetMax("fRunStart", "Sequences", $db);
|
---|
530 | else
|
---|
531 | $timemax = $_GET["fStopDate"];
|
---|
532 |
|
---|
533 | printf("Night (yyyy-mm-dd) from <input name=\"fStartDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\">\n", $timemin);
|
---|
534 | printf("to <input name=\"fStopDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\"> \n", $timemax);
|
---|
535 |
|
---|
536 | if (empty($_GET["fRunMin"]))
|
---|
537 | $min = GetMin("fSequenceFirst", "Sequences", $db);
|
---|
538 | else
|
---|
539 | $min = $_GET["fRunMin"];
|
---|
540 |
|
---|
541 | if (empty($_GET["fRunMax"]))
|
---|
542 | $max = GetMax("fSequenceFirst", "Sequences", $db);
|
---|
543 | else
|
---|
544 | $max = $_GET["fRunMax"];
|
---|
545 |
|
---|
546 | /*
|
---|
547 | printf("Date (yyyy-mm-dd) <input name=\"fDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"");
|
---|
548 | if (!empty($_GET["fDate"]))
|
---|
549 | printf("%s", $_GET["fDate"]);
|
---|
550 | printf("\"> \n");
|
---|
551 | */
|
---|
552 |
|
---|
553 | printf("Sequences from <input name=\"fRunMin\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\">\n", $min);
|
---|
554 | printf("to <input name=\"fRunMax\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\"> \n", $max);
|
---|
555 |
|
---|
556 | printf(" <P>\n");
|
---|
557 |
|
---|
558 | printf("Source (<A HREF=\"regexp.html\">regexp</A>) <input name=\"fSourceN\" type=\"text\" size=\"15\" maxlength=\"15\" value=\"");
|
---|
559 | if (!empty($_GET["fSourceN"]))
|
---|
560 | printf("%s", $_GET["fSourceN"]);
|
---|
561 | printf("\"> \n");
|
---|
562 |
|
---|
563 | printf(" Results:\n");
|
---|
564 | printf(" <select name=\"fNumResults\">\n");
|
---|
565 |
|
---|
566 | $numres = array("10", "20", "50", "100", "200", "500");
|
---|
567 | foreach ($numres as $element)
|
---|
568 | {
|
---|
569 | if ($element==$_GET["fNumResults"])
|
---|
570 | printf("<option value=\"%s\" selected>%3s</option>\n", $element, $element);
|
---|
571 | else
|
---|
572 | printf("<option value=\"%s\">%3s</option>\n", $element, $element);
|
---|
573 | }
|
---|
574 | printf(" </select>\n");
|
---|
575 | printf(" \n");
|
---|
576 |
|
---|
577 | ini_set("mysql.trace_mode", "Off");
|
---|
578 | ini_set("display_errors", "Off");
|
---|
579 |
|
---|
580 | printf("<input class='Width' type='submit' value='Query Table'> \n");
|
---|
581 | printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"findoffdata.php\"'> \n");
|
---|
582 | if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
|
---|
583 | printf("<input class='Width' type='button' value='Get .txt' onClick='self.location.href=\"%s&fSendTxt=1\"'> \n", $_SERVER["REQUEST_URI"]);
|
---|
584 | if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
|
---|
585 | printf("<input class='Width' type='button' value='Print' onClick='self.location.href=\"%s&fPrintTable=1\"'> \n", $_SERVER["REQUEST_URI"]);
|
---|
586 | printf("</form>\n");
|
---|
587 | printf("</center>\n");
|
---|
588 |
|
---|
589 |
|
---|
590 | printf(" </td></tr> </table>\n");
|
---|
591 |
|
---|
592 | printf("</td>\n");
|
---|
593 | printf("</tr>\n");
|
---|
594 |
|
---|
595 |
|
---|
596 | printf("<tr class='Block'>\n");
|
---|
597 | printf("<td>\n");
|
---|
598 | }
|
---|
599 |
|
---|
600 | function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms)
|
---|
601 | {
|
---|
602 | $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
|
---|
603 | if ($db_id==FALSE)
|
---|
604 | {
|
---|
605 | printf("mysql_connect returned the following error: %s\n", mysql_error());
|
---|
606 | die("");
|
---|
607 | }
|
---|
608 | mysql_select_db($db);
|
---|
609 |
|
---|
610 | $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup);
|
---|
611 |
|
---|
612 | $result0 = mysql_query($query0, $db_id);
|
---|
613 |
|
---|
614 | if ($result0)
|
---|
615 | {
|
---|
616 | if ($html=="1" || $html=="2")
|
---|
617 | PrintMagicTable($result0, $alias, $rightalign, $limits, $rms, $_GET);
|
---|
618 | else
|
---|
619 | PrintText($result0);
|
---|
620 |
|
---|
621 | mysql_free_result($result0);
|
---|
622 | }
|
---|
623 | mysql_close($db_id);
|
---|
624 |
|
---|
625 | if ($html=="1")
|
---|
626 | printf("<U><B>submitted query:</B></U><BR>%s<BR>", htmlspecialchars($query0));
|
---|
627 | }
|
---|
628 |
|
---|
629 | include ("include.php");
|
---|
630 | include ("db.php");
|
---|
631 | include ("magicdefs.php");
|
---|
632 |
|
---|
633 | ini_set("display_errors", "On");
|
---|
634 | ini_set("mysql.trace_mode", "On");
|
---|
635 |
|
---|
636 | if (!empty($_GET["fSendTxt"]))
|
---|
637 | {
|
---|
638 | header("Content-type: application/octet");
|
---|
639 | header("Content-Disposition: attachment; filename=query-result.txt");
|
---|
640 |
|
---|
641 | PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms);
|
---|
642 | }
|
---|
643 | else
|
---|
644 | {
|
---|
645 | echo (file_get_contents("index-header.html"));
|
---|
646 |
|
---|
647 | $environment = sizeof($_GET);
|
---|
648 |
|
---|
649 | InitGet($_GET);
|
---|
650 | if (empty($_GET["fPrintTable"]))
|
---|
651 | PrintForm($_GET, $db, $limits, $rms, $alias);
|
---|
652 |
|
---|
653 | if ($environment==0)
|
---|
654 | printf("No query submitted yet.<BR>");
|
---|
655 | else
|
---|
656 | {
|
---|
657 | if (empty($_GET["fPrintTable"]))
|
---|
658 | PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms);
|
---|
659 | else
|
---|
660 | PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms);
|
---|
661 | }
|
---|
662 |
|
---|
663 | echo (file_get_contents("index-footer.html"));
|
---|
664 | }
|
---|
665 |
|
---|
666 | ini_set("display_errors", "Off");
|
---|
667 | ini_set("mysql.trace_mode", "Off");
|
---|
668 | }
|
---|
669 | ?>
|
---|