source: trunk/MagicSoft/Mars/datacenter/db/sequence.php@ 7484

Last change on this file since 7484 was 7484, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 25.2 KB
Line 
1<?php
2{
3 function CreateQuery($_GET)
4 {
5 $query0 = "SELECT ";
6 //main (0-18)
7 $query0 .= " Sequences.fSequenceFirst, fSequenceLast, ";//0,1
8 $query0 .= " fSourceName, fProjectName, ";//2,3
9 $query0 .= " fRunStart, fRunTime, fNumEvents, ";//4,5,6
10 $query0 .= " fZenithDistanceMin, fZenithDistanceMax, ";//7,8
11 $query0 .= " fAzimuthMin, fAzimuthMax, ";//9,10
12 $query0 .= " fHvSettingsName, fDiscriminatorThresholdTableName, ";//11,12
13 $query0 .= " fL1TriggerTableName, fL2TriggerTableName, ";//13,14
14 $query0 .= " fTriggerDelayTableName, fTestFlagName, ";//15,16
15 $query0 .= " fLightConditionsName, fManuallyChangedName, ";//17,18
16 //steps (19-24)
17 $query0 .= " fSequenceFileWritten, fAllFilesAvail, ";//19,20
18 $query0 .= " fCallisto, fFillCallisto, ";//21,22
19 $query0 .= " fStar, fFillStar, ";//23,24
20 //calibration (25-39)
21 $query0 .= " fUnsuitableInner, fUnsuitableOuter, ";//25,26
22 $query0 .= " fUnreliableInner, fUnreliableOuter, ";//27,28
23 $query0 .= " fIsolatedInner, fIsolatedOuter, fIsolatedMaxCluster, ";//29,30,31
24 $query0 .= " fArrTimeMeanInner, fArrTimeMeanOuter, ";//32,33
25 $query0 .= " fArrTimeRmsInner, fArrTimeRmsOuter, ";//34,35
26 $query0 .= " fConvFactorInner, fConvFactorOuter, ";//36,37
27 $query0 .= " fMeanPedRmsInner, fMeanPedRmsOuter, ";//38,39
28 //myon,star (40-47)
29 $query0 .= " fPSF, fRatio, fMuonRate, ";//40,41,42
30 $query0 .= " fMuonNumber, fEffOnTime, fDataRate, ";//43,44,45
31 $query0 .= " fMaxHumidity, fMeanNumberIslands, ";//46,47
32 $query0 .= " CONCAT('<a 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') , '\">cal-log</A>') as 'CalLink', ";//48
33 $query0 .= " CONCAT('<a 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') , '\">star-log</A>') as 'StarLink', ";//49
34 $query0 .= " CONCAT('<a 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') , '\">', 'sequ-file</a>') as 'SequLink' ";//50
35
36 $query0 .= " FROM Sequences ";
37
38 $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY ";
39 $query0 .= " LEFT JOIN Project ON Sequences.fProjectKEY=Project.fProjectKEY ";
40 $query0 .= " LEFT JOIN HvSettings ON Sequences.fHvSettingsKEY=HvSettings.fHvSettingsKEY ";
41 $query0 .= " LEFT JOIN DiscriminatorThresholdTable ON Sequences.fDiscriminatorThresholdTableKEY=DiscriminatorThresholdTable.fDiscriminatorThresholdTableKEY ";
42 $query0 .= " LEFT JOIN L1TriggerTable ON Sequences.fL1TriggerTableKEY=L1TriggerTable.fL1TriggerTableKEY ";
43 $query0 .= " LEFT JOIN L2TriggerTable ON Sequences.fL2TriggerTableKEY=L2TriggerTable.fL2TriggerTableKEY ";
44 $query0 .= " LEFT JOIN TriggerDelayTable ON Sequences.fTriggerDelayTableKEY=TriggerDelayTable.fTriggerDelayTableKEY ";
45 $query0 .= " LEFT JOIN TestFlag ON Sequences.fTestFlagKEY=TestFlag.fTestFlagKEY ";
46 $query0 .= " LEFT JOIN LightConditions ON Sequences.fLightConditionsKEY=LightConditions.fLightConditionsKEY ";
47 $query0 .= " LEFT JOIN ManuallyChanged ON Sequences.fManuallyChangedKEY=ManuallyChanged.fManuallyChangedKEY ";
48 $query0 .= " LEFT JOIN SequenceProcessStatus ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
49 $query0 .= " LEFT JOIN Calibration ON Sequences.fSequenceFirst=Calibration.fSequenceFirst ";
50 $query0 .= " LEFT JOIN Star ON Sequences.fSequenceFirst=Star.fSequenceFirst ";
51
52 $query0 .= " WHERE Sequences.fSequenceFirst between " . $_GET["fRunMin"] . " and " . $_GET["fRunMax"] ;
53 if (!empty($_GET["fSequenceNo"]))
54 $query0 .= " AND Sequences.fSequenceFirst='" . $_GET["fSequenceNo"] . "'";
55 $query0 .= " AND fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" ";
56 $query0 .= " ORDER BY Sequences.fSequenceFirst ";
57
58 return $query0;
59 }
60
61 function InitGet($_GET)
62 {
63 // Find out whether it is the first call to the php script
64 $first = empty($_GET["fRunMin"]) && empty($_GET["fRunMax"]);
65
66 if (empty($_GET["fNumResults"]))
67 $_GET["fNumResults"]="20";
68
69 if (empty($_GET["fAll"]))
70 $_GET["fAll"]=$first?"On":"";
71
72 }
73
74 function PrintForm($_GET, $db)
75 {
76 printf("<center>\n");
77 printf("<form action=\"sequence.php\" METHOD=\"GET\">\n");
78
79 printf("Sequ#&nbsp;<input name=\"fSequenceNo\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"");
80 if (!empty($_GET["fSequenceNo"]))
81 printf("%s", $_GET["fSequenceNo"]);
82 printf("\">&nbsp;&nbsp;&nbsp;\n");
83// printf("Sequence&nbsp;&nbsp;<input name=\"fSequence\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"\">&nbsp;&nbsp;\n");
84
85 if (empty($_GET["fRunMin"]))
86 $min = GetMin("fSequenceFirst", "Sequences", $db);
87 else
88 $min = $_GET["fRunMin"];
89
90 if (empty($_GET["fRunMax"]))
91 $max = GetMax("fSequenceFirst", "Sequences", $db);
92 else
93 $max = $_GET["fRunMax"];
94
95 printf("Sequences&nbsp;from&nbsp;<input name=\"fRunMin\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\">\n", $min);
96 printf("to&nbsp;<input name=\"fRunMax\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\">&nbsp;&nbsp;&nbsp;\n", $max);
97
98 if ($_GET["fAll"]=="On")
99 $checked = "checked";
100 else
101 $checked = "";
102 printf("<input type=\"checkbox\" name=\"fAll\" value=\"On\" %s>all information\n", $checked);
103
104 printf(" <P>\n");
105
106 printf("Source&nbsp;(<A HREF=\"regexp.html\">regexp</A>)&nbsp;<input name=\"fSourceN\" type=\"text\" size=\"15\" maxlength=\"15\" value=\"");
107 if (!empty($_GET["fSourceN"]))
108 printf("%s", $_GET["fSourceN"]);
109 printf("\">&nbsp;&nbsp;&nbsp;\n");
110
111
112 ini_set("mysql.trace_mode", "Off");
113 ini_set("display_errors", "Off");
114
115 printf("<input class='Width' type='submit' value='Query Table'>&nbsp;&nbsp;&nbsp;\n");
116 printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"sequence.php\"'>&nbsp;&nbsp;&nbsp;\n");
117// if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
118// printf("<input class='Width' type='button' value='Get .txt' onClick='self.location.href=\"%s&fSendTxt=1\"'>&nbsp;&nbsp;&nbsp;\n", $_SERVER["REQUEST_URI"]);
119 if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
120 printf("<input class='Width' type='button' value='Print' onClick='self.location.href=\"%s&fPrintTable=1\"'>&nbsp;&nbsp;&nbsp;\n", $_SERVER["REQUEST_URI"]);
121 printf("</form>\n");
122 printf("</center>\n");
123 printf("</td>\n");
124 printf("</tr>\n");
125 printf("<tr class='Block'>\n");
126 printf("<td>\n");
127 }
128
129 function GetStatus($step)
130 {
131 if (is_null($step))
132 return "<font color='#FF0000'>not done</font>";
133 else
134 {
135 if (strpos($step, "1970-01-01 00:00:00")==FALSE)
136 return "done";
137 else
138 return "not to be done";
139 }
140 return "there is an error -> tell Dani";
141 }
142
143 function GetCulm($azmin, $azmax)
144 {
145 $cul1=0;
146 $cul2=180;
147 if (($azmin < $cul1 && $azmax > $cul1) || ($azmin < $cul2 && $azmax > $cul2))
148 return "<font color='#FF0000'>yes</font>";
149 else
150 return "no";
151 }
152
153 function QueryRuns($type, $sequ, $db_id, $db)
154 {
155 $query1 = "SELECT fRunNumber, fCalibrationScriptName FROM RunData ";
156 $query1 .= " LEFT JOIN RunType ON RunData.fRunTypeKEY=RunType.fRunTypeKEY ";
157 $query1 .= " LEFT JOIN CalibrationScript ON RunData.fCalibrationScriptKEY=CalibrationScript.fCalibrationScriptKEY ";
158 $query1 .= " WHERE fSequenceFirst=" . $sequ . " AND fRunTypeName='" . $type . "'";
159
160 mysql_select_db($db);
161 $runs = mysql_query($query1, $db_id);
162 $numruns = mysql_num_rows($runs);
163 $calscript=mysql_result($runs, 0, 1);
164 printf(" <td align='left'>");
165 for ($i=0 ; $i<$numruns ; $i++)
166 {
167 $run=mysql_result($runs, $i, 0);
168 if ($i!=0)
169 printf(", ");
170 printf(" %s ", $run);
171 }
172 printf(" </td>\n");
173 printf(" <td> %s ", $calscript);
174 printf(" </td>\n");
175 }
176
177 function QueryMissingFiles($column, $sequ, $db_id, $db)
178 {
179 $query2 = "SELECT RunData.fRunNumber FROM RunData ";
180 $query2 .= " LEFT JOIN RunProcessStatus ON RunData.fRunNumber=RunProcessStatus.fRunNumber ";
181 $query2 .= " WHERE fSequenceFirst=" . $sequ . " AND IsNull(" . $column . ")";
182
183 mysql_select_db($db);
184 $files = mysql_query($query2, $db_id);
185 $numfiles = mysql_num_rows($files);
186 printf(" <td align='left'>");
187 for ($i=0 ; $i<$numfiles ; $i++)
188 {
189 $file=mysql_result($files, $i, 0);
190 if ($i!=0)
191 printf(", ");
192 printf(" %s ", $file);
193 }
194 printf(" </td>\n");
195 }
196
197
198 function PrintSequenceInfo($result0, $db_id, $db)
199 {
200 $numres = mysql_num_rows($result0);
201
202 printf("<center>");
203 printf("<table BORDER=\"0\">\n");
204 printf("<tr><td>");
205 printf("# of Sequences: %d ", $numres);
206 printf("</td></tr>");
207
208 for ($i=0 ; $i<$numres ; $i++)
209 {
210 $firstrun=mysql_result($result0, $i, 0);
211 $lastrun=mysql_result($result0, $i, 1);
212 $source=mysql_result($result0, $i, 2);
213 $project=mysql_result($result0, $i, 3);
214 $starttime=mysql_result($result0, $i, 4);
215 $duration=mysql_result($result0, $i, 5);
216 $numevents=mysql_result($result0, $i, 6);
217 $zdmin=mysql_result($result0, $i, 7);
218 $zdmax=mysql_result($result0, $i, 8);
219 $azmin=mysql_result($result0, $i, 9);
220 $azmax=mysql_result($result0, $i, 10);
221 $hv=mysql_result($result0, $i, 11);
222 $dt=mysql_result($result0, $i, 12);
223 $l1tt=mysql_result($result0, $i, 13);
224 $l2tt=mysql_result($result0, $i, 14);
225 $td=mysql_result($result0, $i, 15);
226 $testflag=mysql_result($result0, $i, 16);
227 $lightcond=mysql_result($result0, $i, 17);
228 $manuallychanged=mysql_result($result0, $i, 18);
229 $sequfile=mysql_result($result0, $i, 19);
230 $filesavail=mysql_result($result0, $i, 20);
231 $callisto=mysql_result($result0, $i, 21);
232 $star=mysql_result($result0, $i, 22);
233 $fillcallisto=mysql_result($result0, $i, 23);
234 $fillstar=mysql_result($result0, $i, 24);
235 $unsi=mysql_result($result0, $i, 25);
236 $unso=mysql_result($result0, $i, 26);
237 $unri=mysql_result($result0, $i, 27);
238 $unro=mysql_result($result0, $i, 28);
239 $isoi=mysql_result($result0, $i, 29);
240 $isoo=mysql_result($result0, $i, 30);
241 $imc=mysql_result($result0, $i, 31);
242 $arrtimei=mysql_result($result0, $i, 32);
243 $arrtimeo=mysql_result($result0, $i, 33);
244 $arrtimermsi=mysql_result($result0, $i, 34);
245 $arrtimermso=mysql_result($result0, $i, 35);
246 $convi=mysql_result($result0, $i, 36);
247 $convo=mysql_result($result0, $i, 37);
248 $meanpedrmsi=mysql_result($result0, $i, 38);
249 $meanpedrmso=mysql_result($result0, $i, 39);
250 $psf=mysql_result($result0, $i, 40);
251 $ratio=mysql_result($result0, $i, 41);
252 $muonrate=mysql_result($result0, $i, 42);
253 $muonnum=mysql_result($result0, $i, 43);
254 $effontime=mysql_result($result0, $i, 44);
255 $datarate=mysql_result($result0, $i, 45);
256 $maxhum=mysql_result($result0, $i, 46);
257 $meannumislands=mysql_result($result0, $i, 47);
258 $callink=mysql_result($result0, $i, 48);
259 $starlink=mysql_result($result0, $i, 49);
260 $sequlink=mysql_result($result0, $i, 50);
261
262 printf("<tr><td>");
263
264 printf(" <table BORDER=\"1\">");
265 printf(" <tr BGCOLOR='#C0C0C0'>\n");
266 printf(" <th><u>Sequence#:</u> %s </th>", $firstrun);
267 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='left'>\n");
268 printf(" <th> %s, %s, zd: %s&deg;-%s&deg;, %.2fmin ",
269 $source, $starttime, $zdmin, $zdmax, $duration/60);
270 if (!is_null($star))
271 printf(", <font color='green'>image files available</font> ");
272 printf(" </td>\n");
273 printf(" </tr><tr>\n");
274 printf(" <td>\n");
275
276 printf("</td></tr><tr><td>\n");
277
278 printf(" <table BORDER=\"1\">");
279 printf(" <tr BGCOLOR='#C0C0C0'>\n");
280 printf(" <th colspan=\"4\">conditions</th>");
281 printf(" <th colspan=\"3\">muon parameter</th>\n");
282 printf(" </tr><tr BGCOLOR='#E0E0E0'>\n");
283 printf(" <td>light</td>\n");
284 printf(" <td>max hum</td>\n");
285 printf(" <td>zd</td>\n");
286 printf(" <td>culmination</td>");
287 if (!is_null($fillstar))
288 {
289 printf(" <td>muon rate</td>\n");
290 printf(" <td>ratio</td>\n");
291 printf(" <td>psf</td>\n");
292 }
293 printf(" </tr><tr BGCOLOR='#E0E0E0' align='right'>");
294 printf(" <td>%s</td>\n", $lightcond);
295 printf(" <td>%s %%</td>\n", $maxhum);
296 printf(" <td>%s&deg;-%s&deg;</td>\n", $zdmin, $zdmax);
297 printf(" <td>%s</td>\n", GetCulm($azmin, $azmax));
298 if (!is_null($fillstar))
299 {
300 printf(" <td> %sHz </td>\n", $muonrate);
301 printf(" <td> %s </td>\n", $ratio);
302 printf(" <td> %smm </td>\n", $psf);
303 }
304 printf(" </tr></table>");
305
306
307 if ($_GET["fAll"]=="On")
308 {
309 printf("</td></tr><tr><td>\n");
310 printf("</td></tr><tr><td>\n");
311
312 printf(" <table BORDER=\"1\">");
313 printf(" <tr BGCOLOR='#C0C0C0'>\n");
314 printf(" <th colspan=\"6\">general information</th>");
315 printf(" </tr>\n");
316 printf(" <tr BGCOLOR='#E0E0E0'>\n");
317 printf(" <td>source name</td>\n");
318 printf(" <td># events</td>\n");
319 printf(" <td>project name</td>\n");
320 printf(" <td>light conditions</td>\n");
321 printf(" <td>manually changed</td>\n");
322 printf(" <td>test flag</td>");
323 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
324 printf(" <td> %s </td>\n", $source);
325 printf(" <td> %s </td>\n", $numevents);
326 printf(" <td> %s </td>\n", $project);
327 printf(" <td> %s </td>\n", $lightcond);
328 printf(" <td> %s </td>\n", $manuallychanged);
329 printf(" <td> %s </td>\n", $testflag);
330 printf(" </tr></table>");
331
332 printf("</td></tr><tr><td>\n");
333
334 printf(" <table BORDER=\"1\">");
335 printf(" <tr BGCOLOR='#C0C0C0'>\n");
336 printf(" <th colspan=\"5\">trigger & camera</th>");
337 printf(" </tr>\n");
338 printf(" <tr BGCOLOR='#E0E0E0'>\n");
339 printf(" <td>l1 trigger</td>\n");
340 printf(" <td>l2 trigger</td>\n");
341 printf(" <td>trigger delay</td>\n");
342 printf(" <td>HvSettings</td>\n");
343 printf(" <td>DT</td>");
344 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
345 printf(" <td> %s </td>\n", $l1tt);
346 printf(" <td> %s </td>\n", $l2tt);
347 printf(" <td> %s </td>\n", $td);
348 printf(" <td> %s </td>\n", $hv);
349 printf(" <td> %s </td>\n", $dt);
350 printf(" </tr></table>");
351
352 printf("</td></tr><tr><td>\n");
353
354 printf(" <table BORDER=\"1\">");
355 printf(" <tr BGCOLOR='#C0C0C0'>\n");
356 printf(" <th colspan=\"6\">steps</th>");
357 printf(" </tr>\n");
358 printf(" <tr BGCOLOR='#E0E0E0' align='center'>\n");
359 printf(" <td>sequencefile</td>\n");
360 printf(" <td>files avail</td>\n");
361 printf(" <td>callisto</td>\n");
362 printf(" <td>fillcal</td>\n");
363 printf(" <td>star</td>");
364 printf(" <td>fillstar</td>");
365 printf(" </tr><tr BGCOLOR='#E0E0E0' align='right'>");
366 printf(" <td> %s </td>\n", GetStatus($sequfile));
367 printf(" <td> %s </td>\n", GetStatus($filesavail));
368 printf(" <td> %s </td>\n", GetStatus($callisto));
369 printf(" <td> %s </td>\n", GetStatus($fillcallisto));
370 printf(" <td> %s </td>\n", GetStatus($star));
371 printf(" <td> %s </td>\n", GetStatus($fillstar));
372 printf(" </tr>\n");
373 printf(" <tr BGCOLOR='#E0E0E0' align='center'>\n");
374 printf(" <td>%s</td>\n", $sequlink);
375 printf(" <td><br></td>\n");
376 printf(" <td>%s</td>\n", $callink);
377 printf(" <td><br></td>\n");
378 printf(" <td>%s</td>", $starlink);
379 printf(" <td><br></td>");
380 printf(" </tr></table>");
381
382 printf("</td></tr><tr><td>\n");
383
384 if (!is_null($fillcallisto))
385 {
386 printf(" <table BORDER=\"1\">");
387 printf(" <tr BGCOLOR='#D0D0D0'>");
388 printf(" <th BGCOLOR='#C0C0C0'>calibration (<a href=\"reference.html\">ref</a>)</th>\n");
389 printf(" <td>inner</td>\n");
390 printf(" <td>outer</td>");
391 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
392 printf(" <td>unsuitable pixel</td>\n");
393 printf(" <td align='right'> %s </td>\n", $unsi);
394 printf(" <td align='right'> %s </td>\n", $unso);
395 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
396 printf(" <td>unreliable pixel</td>\n");
397 printf(" <td align='right'> %s </td>\n", $unri);
398 printf(" <td align='right'> %s </td>\n", $unro);
399 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
400 printf(" <td>isolated pixel</td>\n");
401 printf(" <td align='right'> %s </td>\n", $isoi);
402 printf(" <td align='right'> %s </td>\n", $isoo);
403 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
404 printf(" <td>isolated max cluster</td>\n");
405 printf(" <td colspan=\"2\" align='right'> %s </td>\n", $imc);
406 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
407 printf(" <td>arrival time</td>\n");
408 printf(" <td align='right'> %s &plusmn; %s </td>\n", $arrtimei, $arrtimermsi);
409 printf(" <td align='right'> %s &plusmn; %s </td>\n", $arrtimeo, $arrtimermso);
410 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
411 printf(" <td>conversion factor</td>\n");
412 printf(" <td align='right'> %s </td>\n", $convi);
413 printf(" <td align='right'> %s </td>\n", $convo);
414 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
415 printf(" <td>mean ped rms</td>\n");
416 printf(" <td align='right'> %s </td>\n", $meanpedrmsi);
417 printf(" <td align='right'> %s </td>\n", $meanpedrmso);
418 printf(" </tr>");
419 printf(" </table>");
420
421 printf("</td></tr><tr><td>\n");
422 }
423
424 if (!is_null($fillstar))
425 {
426 printf(" <table BORDER=\"1\">");
427 printf(" <tr BGCOLOR='#C0C0C0'>");
428 printf(" <th colspan=\"7\">star</th>\n");
429 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
430 printf(" <td># islands</td>\n");
431 printf(" <td># muons</td>\n");
432 printf(" <td>effontime</td>\n");
433 printf(" <td>datarate</td>\n");
434 printf(" <td>muon rate</td>\n");
435 printf(" <td>ratio</td>\n");
436 printf(" <td>psf</td>\n");
437 printf(" <tr BGCOLOR='#E0E0E0' ALIGN='right'>");
438 printf(" <td> %s </td>\n", $meannumislands);
439 printf(" <td> %s </td>\n", $muonnum);
440 printf(" <td> %ss </td>\n", $effontime);
441 printf(" <td> %sHz </td>\n", $datarate);
442 printf(" <td> %sHz </td>\n", $muonrate);
443 printf(" <td> %s </td>\n", $ratio);
444 printf(" <td> %smm </td>\n", $psf);
445 printf(" </tr>");
446 printf(" </table>");
447 }
448
449 printf(" <table BORDER=\"1\">");
450 printf(" <tr BGCOLOR='#C0C0C0'>");
451 printf(" <th><A HREF=\"runinfo.php?fRunStart=On&fZenithDistance=On&fRunMin=%s&fMeanTriggerRate=On&fRunTypeName=On&fRunMax=%s&fNumEvents=On&fSourceName=On&fExcludedFDAKEY=1&fSequenceFirst=On&fRawFileAvail=On&fCCFileAvail=On&fCaCoFileAvail=On&fNumResults=500\">runs</A></th>", $firstrun, $lastrun);
452 printf(" <td>runs</td>\n");
453 printf(" <td>calscript</td>\n");
454 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
455 printf(" <td>dataruns</td>\n");
456 QueryRuns("Data", $firstrun, $db_id, $db);
457 printf(" </tr><tr BGCOLOR='#E0E0E0' ALIGN='center'>");
458 printf(" <td>pedruns</td>\n");
459 QueryRuns("Pedestal", $firstrun, $db_id, $db);
460 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
461 printf(" <td>calruns</td>\n");
462 QueryRuns("Calibration", $firstrun, $db_id, $db);
463 printf(" </tr>");
464 printf(" </table>");
465
466 if (is_null($filesavail))
467 {
468 printf(" <table BORDER=\"1\">");
469 printf(" <tr BGCOLOR='#C0C0C0'>");
470 printf(" <th>missing files</th>");
471 printf(" <td>run# of missing files</td>\n");
472 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
473 printf(" <td>rawfiles</td>\n");
474 QueryMissingFiles("fRawFileAvail", $firstrun, $db_id, $db);
475 printf(" </tr><tr BGCOLOR='#E0E0E0' ALIGN='center'>");
476 printf(" <td>ccfiles</td>\n");
477 QueryMissingFiles("fCCFileAvail", $firstrun, $db_id, $db);
478 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
479 printf(" <td>cacofiles</td>\n");
480 QueryMissingFiles("fCaCoFileAvail", $firstrun, $db_id, $db);
481 printf(" </tr>");
482 printf(" </table>");
483 }
484
485
486 }
487 printf(" </table>");
488 printf("</td></tr><tr><td><br></td></tr>");
489
490 }
491 printf("</table>\n");
492
493 printf("</center>\n");
494 printf("</tr><tr class='Block'><td>\n");
495 }
496
497 function PrintPage($html, $db)
498 {
499 $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
500 if ($db_id==FALSE)
501 {
502 printf("mysql_connect returned the following error: %s\n", mysql_error());
503 die("");
504 }
505 mysql_select_db($db);
506
507 $query0 = CreateQuery($_GET);
508
509 $result0 = mysql_query($query0, $db_id);
510
511 if ($result0)
512 {
513 if ($html=="1" || $html=="2")
514 PrintSequenceInfo($result0, $db_id, $db);
515 else
516 PrintText($result0);
517
518 mysql_free_result($result0);
519 }
520 mysql_close($db_id);
521
522 if ($html=="1")
523 printf("<U><B>submitted query:</B></U><BR>%s<BR>", htmlspecialchars($query0));
524 }
525
526 include ("include.php");
527 include ("db.php");
528
529 ini_set("display_errors", "On");
530 ini_set("mysql.trace_mode", "On");
531
532 if (!empty($_GET["fSendTxt"]))
533 {
534 header("Content-type: application/octet");
535 header("Content-Disposition: attachment; filename=query-result.txt");
536
537 PrintPage("0", $db);
538 }
539 else
540 {
541 echo (file_get_contents("index-header.html"));
542
543 $environment = sizeof($_GET);
544
545 InitGet($_GET);
546 if (empty($_GET["fPrintTable"]))
547 PrintForm($_GET, $db);
548
549 if ($environment==0)
550 printf("No query submitted yet.<BR>");
551 else
552 {
553 if (empty($_GET["fPrintTable"]))
554 PrintPage("1", $db);
555 else
556 PrintPage("2", $db);
557 }
558
559 echo (file_get_contents("index-footer.html"));
560 }
561
562 ini_set("display_errors", "Off");
563 ini_set("mysql.trace_mode", "Off");
564}
565?>
Note: See TracBrowser for help on using the repository browser.