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', '&fTest=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!="fTest")
|
---|
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($joins[$key]))
|
---|
78 | // $query0 .= $joins[$key];
|
---|
79 |
|
---|
80 | foreach ($_GET as $key => $element)
|
---|
81 | if (($_GET[$key]=="On" || $groups>0))// && !empty(GetJoin($fromtable,$key)))
|
---|
82 | $query0 .= GetJoin($fromtable,$key);
|
---|
83 |
|
---|
84 | if ($_GET["fTest"]!="On")
|
---|
85 | {
|
---|
86 | if ($_GET["fSource"]!="On")
|
---|
87 | $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY ";
|
---|
88 | $query0 .= " WHERE fTest='no'";
|
---|
89 | }
|
---|
90 |
|
---|
91 | foreach ($checkwhere as $key => $element)
|
---|
92 | {
|
---|
93 | if (empty($element) || $element<=0)
|
---|
94 | continue;
|
---|
95 |
|
---|
96 | if (strpos($query0, " WHERE ")==FALSE)
|
---|
97 | $query0 .= " WHERE ";
|
---|
98 | else
|
---|
99 | if ($element!=-1)
|
---|
100 | if (strrpos($query0, " AND ")!=strlen($query0)-5)
|
---|
101 | $query0 .= " AND ";
|
---|
102 |
|
---|
103 | if ($element!=-1)
|
---|
104 | $query0 .= GetCheck($fromtable, $key) . "=" . $element;
|
---|
105 | }
|
---|
106 |
|
---|
107 | if (strpos($query0, " WHERE ")==FALSE)
|
---|
108 | $query0 .= " WHERE ";
|
---|
109 | else
|
---|
110 | $query0 .= " AND ";
|
---|
111 |
|
---|
112 | $query0 .= StatusQuery("fSequenceFileWritten");
|
---|
113 | $query0 .= StatusQuery("fAllFilesAvail");
|
---|
114 | $query0 .= StatusQuery("fCallisto");
|
---|
115 | $query0 .= StatusQuery("fFillCallisto");
|
---|
116 | $query0 .= StatusQuery("fStar");
|
---|
117 | $query0 .= StatusQuery("fFillStar");
|
---|
118 |
|
---|
119 | if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
|
---|
120 | $query0 .= "Sequences.fSequenceFirst BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " ";
|
---|
121 | else
|
---|
122 | $query0 = substr($query0, 0, -4);
|
---|
123 |
|
---|
124 | /*
|
---|
125 | if (!empty($_GET["fDate"]))
|
---|
126 | $query0 .= " AND fRunStart REGEXP \"^" . $_GET["fDate"] . "\" ";
|
---|
127 | */
|
---|
128 |
|
---|
129 | if (!empty($_GET["fSourceN"]))
|
---|
130 | $query0 .= " AND fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" ";
|
---|
131 |
|
---|
132 | if (!empty($_GET["fStartDate"]))
|
---|
133 | {
|
---|
134 | if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
|
---|
135 | $query0 .= " AND ";
|
---|
136 |
|
---|
137 | $startdate=substr($_GET["fStartDate"], 0, 10);
|
---|
138 | if ($startdate=="0000-00-00")
|
---|
139 | $query0 .=" fRunStart >= '" . $startdate . " 00:00:00' ";
|
---|
140 | else
|
---|
141 | $query0 .= " fRunStart >= ADDDATE('" . $startdate . " 13:00:00', INTERVAL -1 DAY) ";
|
---|
142 | }
|
---|
143 |
|
---|
144 | if (!empty($_GET["fStopDate"]))
|
---|
145 | {
|
---|
146 | if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
|
---|
147 | $query0 .= " AND ";
|
---|
148 |
|
---|
149 | $stopdate=substr($_GET["fStopDate"], 0, 10);
|
---|
150 | $query0 .= " fRunStart < '" . $stopdate . " 13:00:00' ";
|
---|
151 | }
|
---|
152 |
|
---|
153 | if ($groups>0)
|
---|
154 | {
|
---|
155 | $query0 .= " GROUP BY ";
|
---|
156 | $num = $groups;
|
---|
157 | foreach ($checkgroup as $key => $element)
|
---|
158 | if ($element==-1)
|
---|
159 | {
|
---|
160 | $query0 .= GetCheck($fromtable,$key);
|
---|
161 | if ($num-->1)
|
---|
162 | $query0 .= ", ";
|
---|
163 | }
|
---|
164 | }
|
---|
165 |
|
---|
166 | if ($statusgroups>0)
|
---|
167 | {
|
---|
168 | $query0 .= " GROUP BY ";
|
---|
169 | $num = $statusgroups;
|
---|
170 | foreach ($checkstatusgroup as $key => $element)
|
---|
171 | if ($element==-1)
|
---|
172 | {
|
---|
173 | $query0 .= $alias[$key];
|
---|
174 | if ($num-->1)
|
---|
175 | $query0 .= ", ";
|
---|
176 | }
|
---|
177 | }
|
---|
178 |
|
---|
179 | if (!empty($_GET["fSortBy"]))
|
---|
180 | {
|
---|
181 | $val=substr($_GET["fSortBy"], 0, -1);
|
---|
182 | $query0 .= " ORDER BY " . GetTable($fromtable,$val) . " ";
|
---|
183 | if (substr($_GET["fSortBy"], -1)=="-")
|
---|
184 | $query0 .= "DESC";
|
---|
185 | }
|
---|
186 |
|
---|
187 | if (empty($_GET["fSortBy"]) && $groups==0 && $statusgroups==0)
|
---|
188 | $query0 .= "ORDER BY Sequences.fSequenceFirst ASC ";
|
---|
189 |
|
---|
190 | if (empty($_GET["fNumStart"]))
|
---|
191 | $_GET["fNumStart"]=0;
|
---|
192 |
|
---|
193 | if (empty($_GET["fSendTxt"]))
|
---|
194 | $query0 .= " LIMIT " . $_GET["fNumStart"] . ", " . $_GET["fNumResults"];
|
---|
195 |
|
---|
196 | return $query0;
|
---|
197 | }
|
---|
198 |
|
---|
199 | function InitGet($_GET)
|
---|
200 | {
|
---|
201 | // Find out whether it is the first call to the php script
|
---|
202 | $first = empty($_GET["fRunMin"]) && empty($_GET["fRunMax"]);
|
---|
203 |
|
---|
204 | if (empty($_GET["fNumResults"]))
|
---|
205 | $_GET["fNumResults"]="20";
|
---|
206 |
|
---|
207 | if (empty($_GET["fLastUpdate"]))
|
---|
208 | $_GET["fLastUpdate"]="Off";
|
---|
209 |
|
---|
210 | if (empty($_GET["fNumEvents"]))
|
---|
211 | $_GET["fNumEvents"]=$first?"On":"";
|
---|
212 |
|
---|
213 | if (empty($_GET["fRunStart"]))
|
---|
214 | $_GET["fRunStart"]=$first?"On":"";
|
---|
215 |
|
---|
216 | if (empty($_GET["fRunTime/60"]))
|
---|
217 | $_GET["fRunTime/60"]=$first?"On":"";
|
---|
218 |
|
---|
219 | if (empty($_GET["fSequenceLast"]))
|
---|
220 | $_GET["fSequenceLast"]=$first?"On":"";
|
---|
221 |
|
---|
222 | if (empty($_GET["fLinks"]))
|
---|
223 | $_GET["fLinks"]=$first?"On":"";
|
---|
224 |
|
---|
225 | if (empty($_GET["fTest"]))
|
---|
226 | $_GET["fTest"]=$first?"On":"";
|
---|
227 |
|
---|
228 | if (empty($_GET["fAzimuthMin"]))
|
---|
229 | $_GET["fAzimuthMin"]="Off";
|
---|
230 |
|
---|
231 | if (empty($_GET["fAzimuthMax"]))
|
---|
232 | $_GET["fAzimuthMax"]="Off";
|
---|
233 |
|
---|
234 | if (empty($_GET["fZenithDistanceMin"]))
|
---|
235 | $_GET["fZenithDistanceMin"]=$first?"On":"";
|
---|
236 |
|
---|
237 | if (empty($_GET["fZenithDistanceMax"]))
|
---|
238 | $_GET["fZenithDistanceMax"]="Off";
|
---|
239 |
|
---|
240 | if (empty($_GET["fManuallyChangedName"]))
|
---|
241 | $_GET["fManuallyChangedName"]="Off";
|
---|
242 |
|
---|
243 | if (empty($_GET["fSourceName"]))
|
---|
244 | $_GET["fSourceName"]=$first?"On":"";
|
---|
245 |
|
---|
246 | if (empty($_GET["fProjectName"]))
|
---|
247 | $_GET["fProjectName"]="Off";
|
---|
248 |
|
---|
249 | if (empty($_GET["fL1TriggerTableName"]))
|
---|
250 | $_GET["fL1TriggerTableName"]="Off";
|
---|
251 |
|
---|
252 | if (empty($_GET["fL2TriggerTableName"]))
|
---|
253 | $_GET["fL2TriggerTableName"]="Off";
|
---|
254 |
|
---|
255 | if (empty($_GET["fHvSettingsName"]))
|
---|
256 | $_GET["fHvSettingsName"]="Off";
|
---|
257 |
|
---|
258 | if (empty($_GET["fDiscriminatorThresholdTableName"]))
|
---|
259 | $_GET["fDiscriminatorThresholdTableName"]="Off";
|
---|
260 |
|
---|
261 | if (empty($_GET["fTriggerDelayTableName"]))
|
---|
262 | $_GET["fTriggerDelayTableName"]="Off";
|
---|
263 |
|
---|
264 | if (empty($_GET["fLightConditionsName"]))
|
---|
265 | $_GET["fLightConditionsName"]="Off";
|
---|
266 |
|
---|
267 | if (empty($_GET["fTestFlagName"]))
|
---|
268 | $_GET["fTestFlagName"]="Off";
|
---|
269 |
|
---|
270 | if (empty($_GET["fSequenceFileWritten"]))
|
---|
271 | $_GET["fSequenceFileWritten"]="Off";
|
---|
272 |
|
---|
273 | if (empty($_GET["fSequenceFileWrittenStatus"]))
|
---|
274 | $_GET["fSequenceFileWrittenStatus"]="0";
|
---|
275 |
|
---|
276 | if (empty($_GET["fAllFilesAvail"]))
|
---|
277 | $_GET["fAllFilesAvail"]="Off";
|
---|
278 |
|
---|
279 | if (empty($_GET["fAllFilesAvailStatus"]))
|
---|
280 | $_GET["fAllFilesAvailStatus"]="0";
|
---|
281 |
|
---|
282 | if (empty($_GET["fCallisto"]))
|
---|
283 | $_GET["fCallisto"]="Off";
|
---|
284 |
|
---|
285 | if (empty($_GET["fCallistoStatus"]))
|
---|
286 | $_GET["fCallistoStatus"]="0";
|
---|
287 |
|
---|
288 | if (empty($_GET["fFillCallisto"]))
|
---|
289 | $_GET["fFillCallisto"]="Off";
|
---|
290 |
|
---|
291 | if (empty($_GET["fFillCallistoStatus"]))
|
---|
292 | $_GET["fFillCallistoStatus"]="0";
|
---|
293 |
|
---|
294 | if (empty($_GET["fStar"]))
|
---|
295 | $_GET["fStar"]=$first?"On":"";
|
---|
296 |
|
---|
297 | if (empty($_GET["fStarStatus"]))
|
---|
298 | $_GET["fStarStatus"]="0";
|
---|
299 |
|
---|
300 | if (empty($_GET["fFillStar"]))
|
---|
301 | $_GET["fFillStar"]="Off";
|
---|
302 |
|
---|
303 | if (empty($_GET["fFillStarStatus"]))
|
---|
304 | $_GET["fFillStarStatus"]="0";
|
---|
305 |
|
---|
306 | if (empty($_GET["fUnreliableInner"]))
|
---|
307 | $_GET["fUnreliableInner"]="Off";
|
---|
308 |
|
---|
309 | if (empty($_GET["fUnsuitableOuter"]))
|
---|
310 | $_GET["fUnsuitableOuter"]="Off";
|
---|
311 |
|
---|
312 | if (empty($_GET["fUnreliableOuter"]))
|
---|
313 | $_GET["fUnreliableOuter"]="Off";
|
---|
314 |
|
---|
315 | if (empty($_GET["fUnsuitableInner"]))
|
---|
316 | $_GET["fUnsuitableInner"]="Off";
|
---|
317 |
|
---|
318 | if (empty($_GET["fIsolatedInner"]))
|
---|
319 | $_GET["fIsolatedInner"]="Off";
|
---|
320 |
|
---|
321 | if (empty($_GET["fIsolatedOuter"]))
|
---|
322 | $_GET["fIsolatedOuter"]="Off";
|
---|
323 |
|
---|
324 | if (empty($_GET["fMeanPedRmsInner"]))
|
---|
325 | $_GET["fMeanPedRmsInner"]="Off";
|
---|
326 |
|
---|
327 | if (empty($_GET["fMeanPedRmsOuter"]))
|
---|
328 | $_GET["fMeanPedRmsOuter"]="Off";
|
---|
329 |
|
---|
330 | if (empty($_GET["fIsolatedMaxCluster"]))
|
---|
331 | $_GET["fIsolatedMaxCluster"]="Off";
|
---|
332 |
|
---|
333 | if (empty($_GET["fArrTimeMeanInner"]))
|
---|
334 | $_GET["fArrTimeMeanInner"]="Off";
|
---|
335 |
|
---|
336 | if (empty($_GET["fArrTimeMeanOuter"]))
|
---|
337 | $_GET["fArrTimeMeanOuter"]="Off";
|
---|
338 |
|
---|
339 | if (empty($_GET["fArrTimeRmsInner"]))
|
---|
340 | $_GET["fArrTimeRmsInner"]="Off";
|
---|
341 |
|
---|
342 | if (empty($_GET["fArrTimeRmsOuter"]))
|
---|
343 | $_GET["fArrTimeRmsOuter"]="Off";
|
---|
344 |
|
---|
345 | if (empty($_GET["fConvFactorInner"]))
|
---|
346 | $_GET["fConvFactorInner"]=$first?"On":"";
|
---|
347 |
|
---|
348 | if (empty($_GET["fConvFactorOuter"]))
|
---|
349 | $_GET["fConvFactorOuter"]=$first?"On":"";
|
---|
350 |
|
---|
351 | if (empty($_GET["fMeanNumberIslands"]))
|
---|
352 | $_GET["fMeanNumberIslands"]="Off";
|
---|
353 |
|
---|
354 | if (empty($_GET["fPSF"]))
|
---|
355 | $_GET["fPSF"]=$first?"On":"";
|
---|
356 |
|
---|
357 | if (empty($_GET["fRatio"]))
|
---|
358 | $_GET["fRatio"]=$first?"On":"";
|
---|
359 |
|
---|
360 | if (empty($_GET["fMuonNumber"]))
|
---|
361 | $_GET["fMuonNumber"]=$first?"On":"";
|
---|
362 |
|
---|
363 | if (empty($_GET["fEffOnTime"]))
|
---|
364 | $_GET["fEffOnTime"]="Off";
|
---|
365 |
|
---|
366 | if (empty($_GET["fMuonRate"]))
|
---|
367 | $_GET["fMuonRate"]="Off";
|
---|
368 |
|
---|
369 | if (empty($_GET["fDataRate"]))
|
---|
370 | $_GET["fDataRate"]="Off";
|
---|
371 |
|
---|
372 | if (empty($_GET["fMaxHumidity"]))
|
---|
373 | $_GET["fMaxHumidity"]="Off";
|
---|
374 |
|
---|
375 | }
|
---|
376 |
|
---|
377 | function PrintForm($_GET, $db)
|
---|
378 | {
|
---|
379 | printf("<center>\n");
|
---|
380 | printf("<form action=\"sequinfo.php\" METHOD=\"GET\">\n");
|
---|
381 | printf(" <table>\n");
|
---|
382 | printf(" <tr>\n");
|
---|
383 |
|
---|
384 | CheckBox("fRunStart", "Start time");
|
---|
385 | CheckBox("fAzimuthMin", "Azimuth min");
|
---|
386 | CheckBox("fAzimuthMax", "Azimuth max");
|
---|
387 | CheckBox("fZenithDistanceMin", "Zenith distance min");
|
---|
388 | CheckBox("fZenithDistanceMax", "Zenith distance max");
|
---|
389 |
|
---|
390 | printf(" </tr><tr>\n");
|
---|
391 |
|
---|
392 | CheckBox("fNumEvents", "Num of events");
|
---|
393 | CheckBox("fRunTime/60", "Duration");
|
---|
394 | CheckBox("fSequenceLast", "Last run");
|
---|
395 | CheckBox("fLinks", "Links");
|
---|
396 | CheckBox("fTest", "incl. TestSources");
|
---|
397 |
|
---|
398 | printf(" </tr></table>\n");
|
---|
399 | printf(" <p>\n");
|
---|
400 | printf(" <table><tr><td>\n");
|
---|
401 |
|
---|
402 | PrintStatusMenu("fSequenceFileWritten", "Sequfile");
|
---|
403 | printf(" </td><td>\n");
|
---|
404 | PrintStatusMenu("fAllFilesAvail", "Files avail");
|
---|
405 | printf(" </td><td>\n");
|
---|
406 | PrintStatusMenu("fCallisto", "Callisto");
|
---|
407 | printf(" </td><td>\n");
|
---|
408 | PrintStatusMenu("fStar", "Star");
|
---|
409 | printf(" </td><td>\n");
|
---|
410 | PrintStatusMenu("fFillCallisto", "Fillcallisto");
|
---|
411 | printf(" </td><td>\n");
|
---|
412 | PrintStatusMenu("fFillStar", "Fillstar");
|
---|
413 |
|
---|
414 | printf("</td></tr> </table>\n");
|
---|
415 | printf(" <p>\n");
|
---|
416 | printf(" <table>\n");
|
---|
417 | printf(" <tr>\n");
|
---|
418 |
|
---|
419 | CheckBox("fUnsuitableInner", "Unsuitable inner");
|
---|
420 | CheckBox("fUnsuitableOuter", "Unsuitable outer");
|
---|
421 | CheckBox("fUnreliableInner", "Unreliable inner");
|
---|
422 | CheckBox("fUnreliableOuter", "Unreliable outer");
|
---|
423 |
|
---|
424 | printf(" </tr><tr>\n");
|
---|
425 |
|
---|
426 | CheckBox("fIsolatedInner", "Isolated inner");
|
---|
427 | CheckBox("fIsolatedOuter", "Isolated outer");
|
---|
428 | CheckBox("fIsolatedMaxCluster", "IsolatedMaxCluster");
|
---|
429 |
|
---|
430 | printf(" </tr><tr>\n");
|
---|
431 |
|
---|
432 | CheckBox("fArrTimeMeanInner", "ArrTimeMean inner ");
|
---|
433 | CheckBox("fArrTimeMeanOuter", "ArrTimeMean outer ");
|
---|
434 | CheckBox("fArrTimeRmsInner", "ArrTimeRms inner ");
|
---|
435 | CheckBox("fArrTimeRmsOuter", "ArrTimeRms outer ");
|
---|
436 |
|
---|
437 | printf(" </tr><tr>\n");
|
---|
438 |
|
---|
439 | CheckBox("fConvFactorInner", "Conv inner ");
|
---|
440 | CheckBox("fConvFactorOuter", "Conv outer ");
|
---|
441 | CheckBox("fMeanPedRmsInner", "MeanPedRms inner");
|
---|
442 | CheckBox("fMeanPedRmsOuter", "MeanPedRms outer");
|
---|
443 |
|
---|
444 | printf(" </tr></table>\n");
|
---|
445 | printf(" <p>\n");
|
---|
446 |
|
---|
447 | printf(" <table>\n");
|
---|
448 | printf(" <tr>\n");
|
---|
449 |
|
---|
450 | CheckBox("fMeanNumberIslands", "MeanNumIslands");
|
---|
451 | CheckBox("fPSF", "PSF");
|
---|
452 | CheckBox("fRatio", "Ratio");
|
---|
453 | CheckBox("fMuonRate", "MuonRate");
|
---|
454 |
|
---|
455 | printf(" </tr><tr>\n");
|
---|
456 |
|
---|
457 | CheckBox("fMuonNumber", "MuonNumber");
|
---|
458 | CheckBox("fEffOnTime", "EffOnTime");
|
---|
459 | CheckBox("fMaxHumidity", "MaxHumidity");
|
---|
460 | CheckBox("fDataRate", "CleanedEvtRate");
|
---|
461 |
|
---|
462 | printf(" </tr>\n");
|
---|
463 | printf(" </table>\n");
|
---|
464 | printf(" <p>\n");
|
---|
465 |
|
---|
466 | // pull down boxes
|
---|
467 |
|
---|
468 | printf(" <table>\n");
|
---|
469 | printf(" <tr><td>\n");
|
---|
470 | PrintPullDown($db, "Source", "fSourceName", "fSourceKEY", "Source Name");
|
---|
471 | printf(" </td><td>\n");
|
---|
472 | PrintPullDown($db, "L1TriggerTable", "fL1TriggerTableName", "fL1TriggerTableKEY", "L1Trigger Table");
|
---|
473 | printf(" </td><td>\n");
|
---|
474 | PrintPullDown($db, "L2TriggerTable", "fL2TriggerTableName", "fL2TriggerTableKEY", "L2Trigger Table");
|
---|
475 | printf(" </td><td>\n");
|
---|
476 | PrintPullDown($db, "TriggerDelayTable", "fTriggerDelayTableName", "fTriggerDelayTableKEY", "Trigger Delay Table");
|
---|
477 | printf(" </td></tr><tr><td>\n");
|
---|
478 | PrintPullDown($db, "LightConditions", "fLightConditionsName", "fLightConditionsKEY", "Light Conditions");
|
---|
479 | printf(" </td><td>\n");
|
---|
480 | PrintPullDown($db, "Project", "fProjectName", "fProjectKEY", "Project Name");
|
---|
481 | printf(" </td><td>\n");
|
---|
482 | PrintPullDown($db, "HvSettings", "fHvSettingsName", "fHvSettingsKEY", "HV Settings");
|
---|
483 | printf(" </td><td>\n");
|
---|
484 | PrintPullDown($db, "DiscriminatorThresholdTable", "fDiscriminatorThresholdTableName", "fDiscriminatorThresholdTableKEY", "DT Table");
|
---|
485 | printf(" </td></tr><tr><td>\n");
|
---|
486 | PrintPullDown($db, "ManuallyChanged", "fManuallyChangedName", "fManuallyChangedKEY", "Manually changed");
|
---|
487 | printf(" </td><td>\n");
|
---|
488 | PrintPullDown($db, "TestFlag", "fTestFlagName", "fTestFlagKEY", "Test Flag");
|
---|
489 | printf(" </td></tr>\n");
|
---|
490 | printf(" </table>\n");
|
---|
491 | printf(" <p>\n");
|
---|
492 |
|
---|
493 | if (empty($_GET["fStartDate"]))
|
---|
494 | $timemin = GetMin("fRunStart", "Sequences", $db);
|
---|
495 | else
|
---|
496 | $timemin = $_GET["fStartDate"];
|
---|
497 |
|
---|
498 | if (empty($_GET["fStopDate"]))
|
---|
499 | $timemax = GetMax("fRunStart", "Sequences", $db);
|
---|
500 | else
|
---|
501 | $timemax = $_GET["fStopDate"];
|
---|
502 |
|
---|
503 | printf("Night (yyyy-mm-dd) from <input name=\"fStartDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\">\n", $timemin);
|
---|
504 | printf("to <input name=\"fStopDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\"> \n", $timemax);
|
---|
505 |
|
---|
506 | if (empty($_GET["fRunMin"]))
|
---|
507 | $min = GetMin("fSequenceFirst", "Sequences", $db);
|
---|
508 | else
|
---|
509 | $min = $_GET["fRunMin"];
|
---|
510 |
|
---|
511 | if (empty($_GET["fRunMax"]))
|
---|
512 | $max = GetMax("fSequenceFirst", "Sequences", $db);
|
---|
513 | else
|
---|
514 | $max = $_GET["fRunMax"];
|
---|
515 |
|
---|
516 | /*
|
---|
517 | printf("Date (yyyy-mm-dd) <input name=\"fDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"");
|
---|
518 | if (!empty($_GET["fDate"]))
|
---|
519 | printf("%s", $_GET["fDate"]);
|
---|
520 | printf("\"> \n");
|
---|
521 | */
|
---|
522 |
|
---|
523 | printf("Sequences from <input name=\"fRunMin\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\">\n", $min);
|
---|
524 | printf("to <input name=\"fRunMax\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\"> \n", $max);
|
---|
525 |
|
---|
526 | printf(" <P>\n");
|
---|
527 |
|
---|
528 | printf("Source (<A HREF=\"regexp.html\">regexp</A>) <input name=\"fSourceN\" type=\"text\" size=\"15\" maxlength=\"15\" value=\"");
|
---|
529 | if (!empty($_GET["fSourceN"]))
|
---|
530 | printf("%s", $_GET["fSourceN"]);
|
---|
531 | printf("\"> \n");
|
---|
532 |
|
---|
533 | printf(" Results:\n");
|
---|
534 | printf(" <select name=\"fNumResults\">\n");
|
---|
535 |
|
---|
536 | $numres = array("10", "20", "50", "100", "200", "500");
|
---|
537 | foreach ($numres as $element)
|
---|
538 | {
|
---|
539 | if ($element==$_GET["fNumResults"])
|
---|
540 | printf("<option value=\"%s\" selected>%3s</option>\n", $element, $element);
|
---|
541 | else
|
---|
542 | printf("<option value=\"%s\">%3s</option>\n", $element, $element);
|
---|
543 | }
|
---|
544 | printf(" </select>\n");
|
---|
545 | printf(" \n");
|
---|
546 |
|
---|
547 | ini_set("mysql.trace_mode", "Off");
|
---|
548 | ini_set("display_errors", "Off");
|
---|
549 |
|
---|
550 | printf("<input class='Width' type='submit' value='Query Table'> \n");
|
---|
551 | printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"sequinfo.php\"'> \n");
|
---|
552 | if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
|
---|
553 | printf("<input class='Width' type='button' value='Get .txt' onClick='self.location.href=\"%s&fSendTxt=1\"'> \n", $_SERVER["REQUEST_URI"]);
|
---|
554 | if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
|
---|
555 | printf("<input class='Width' type='button' value='Print' onClick='self.location.href=\"%s&fPrintTable=1\"'> \n", $_SERVER["REQUEST_URI"]);
|
---|
556 | printf("</form>\n");
|
---|
557 | printf("</center>\n");
|
---|
558 | printf("</td>\n");
|
---|
559 | printf("</tr>\n");
|
---|
560 | printf("<tr class='Block'>\n");
|
---|
561 | printf("<td>\n");
|
---|
562 | }
|
---|
563 |
|
---|
564 | function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup)
|
---|
565 | {
|
---|
566 | $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
|
---|
567 | if ($db_id==FALSE)
|
---|
568 | {
|
---|
569 | printf("mysql_connect returned the following error: %s\n", mysql_error());
|
---|
570 | die("");
|
---|
571 | }
|
---|
572 | mysql_select_db($db);
|
---|
573 |
|
---|
574 | $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup);
|
---|
575 |
|
---|
576 | $result0 = mysql_query($query0, $db_id);
|
---|
577 |
|
---|
578 | if ($result0)
|
---|
579 | {
|
---|
580 | if ($html=="1" || $html=="2")
|
---|
581 | PrintMagicTable($result0, $alias, $rightalign, "", "", $_GET);
|
---|
582 | else
|
---|
583 | PrintText($result0);
|
---|
584 |
|
---|
585 | mysql_free_result($result0);
|
---|
586 | }
|
---|
587 | mysql_close($db_id);
|
---|
588 |
|
---|
589 | if ($html=="1")
|
---|
590 | printf("<U><B>submitted query:</B></U><BR>%s<BR>", htmlspecialchars($query0));
|
---|
591 | }
|
---|
592 |
|
---|
593 | include ("include.php");
|
---|
594 | include ("db.php");
|
---|
595 | include ("magicdefs.php");
|
---|
596 |
|
---|
597 | ini_set("display_errors", "On");
|
---|
598 | ini_set("mysql.trace_mode", "On");
|
---|
599 |
|
---|
600 | if (!empty($_GET["fSendTxt"]))
|
---|
601 | {
|
---|
602 | header("Content-type: application/octet");
|
---|
603 | header("Content-Disposition: attachment; filename=query-result.txt");
|
---|
604 |
|
---|
605 | PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
|
---|
606 | }
|
---|
607 | else
|
---|
608 | {
|
---|
609 | echo (file_get_contents("index-header.html"));
|
---|
610 |
|
---|
611 | $environment = sizeof($_GET);
|
---|
612 |
|
---|
613 | InitGet($_GET);
|
---|
614 | if (empty($_GET["fPrintTable"]))
|
---|
615 | PrintForm($_GET, $db);
|
---|
616 |
|
---|
617 | if ($environment==0)
|
---|
618 | printf("No query submitted yet.<BR>");
|
---|
619 | else
|
---|
620 | {
|
---|
621 | if (empty($_GET["fPrintTable"]))
|
---|
622 | PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
|
---|
623 | else
|
---|
624 | PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
|
---|
625 | }
|
---|
626 |
|
---|
627 | echo (file_get_contents("index-footer.html"));
|
---|
628 | }
|
---|
629 |
|
---|
630 | ini_set("display_errors", "Off");
|
---|
631 | ini_set("mysql.trace_mode", "Off");
|
---|
632 | }
|
---|
633 | ?>
|
---|