| 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 . " 23:59:59' ";
|
|---|
| 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["fDiscriminatorThresholdTableName"]))
|
|---|
| 314 | $_GET["fDiscriminatorThresholdTableName"]="Off";
|
|---|
| 315 |
|
|---|
| 316 | if (empty($_GET["fStar"]))
|
|---|
| 317 | $_GET["fStar"]="Off";
|
|---|
| 318 |
|
|---|
| 319 | if (empty($_GET["fStarStatus"]))
|
|---|
| 320 | $_GET["fStarStatus"]=$first?"1":"";
|
|---|
| 321 |
|
|---|
| 322 | if (empty($_GET["fUnreliableInner"]))
|
|---|
| 323 | $_GET["fUnreliableInner"]="Off";
|
|---|
| 324 |
|
|---|
| 325 | if (empty($_GET["fUnsuitableOuter"]))
|
|---|
| 326 | $_GET["fUnsuitableOuter"]="Off";
|
|---|
| 327 |
|
|---|
| 328 | if (empty($_GET["fUnreliableOuter"]))
|
|---|
| 329 | $_GET["fUnreliableOuter"]="Off";
|
|---|
| 330 |
|
|---|
| 331 | if (empty($_GET["fUnsuitableInner"]))
|
|---|
| 332 | $_GET["fUnsuitableInner"]=$first?"On":"";
|
|---|
| 333 |
|
|---|
| 334 | if (empty($_GET["fIsolatedInner"]))
|
|---|
| 335 | $_GET["fIsolatedInner"]="Off";
|
|---|
| 336 |
|
|---|
| 337 | if (empty($_GET["fIsolatedOuter"]))
|
|---|
| 338 | $_GET["fIsolatedOuter"]="Off";
|
|---|
| 339 |
|
|---|
| 340 | if (empty($_GET["fMeanPedRmsInner"]))
|
|---|
| 341 | $_GET["fMeanPedRmsInner"]=$first?"On":"";
|
|---|
| 342 |
|
|---|
| 343 | if (empty($_GET["fMeanPedRmsOuter"]))
|
|---|
| 344 | $_GET["fMeanPedRmsOuter"]="Off";
|
|---|
| 345 |
|
|---|
| 346 | if (empty($_GET["fIsolatedMaxCluster"]))
|
|---|
| 347 | $_GET["fIsolatedMaxCluster"]="Off";
|
|---|
| 348 |
|
|---|
| 349 | if (empty($_GET["fArrTimeMeanInner"]))
|
|---|
| 350 | $_GET["fArrTimeMeanInner"]="Off";
|
|---|
| 351 |
|
|---|
| 352 | if (empty($_GET["fArrTimeMeanOuter"]))
|
|---|
| 353 | $_GET["fArrTimeMeanOuter"]="Off";
|
|---|
| 354 |
|
|---|
| 355 | if (empty($_GET["fArrTimeRmsInner"]))
|
|---|
| 356 | $_GET["fArrTimeRmsInner"]=$first?"On":"";
|
|---|
| 357 |
|
|---|
| 358 | if (empty($_GET["fArrTimeRmsOuter"]))
|
|---|
| 359 | $_GET["fArrTimeRmsOuter"]="Off";
|
|---|
| 360 |
|
|---|
| 361 | if (empty($_GET["fConvFactorInner"]))
|
|---|
| 362 | $_GET["fConvFactorInner"]=$first?"On":"";
|
|---|
| 363 |
|
|---|
| 364 | if (empty($_GET["fConvFactorOuter"]))
|
|---|
| 365 | $_GET["fConvFactorOuter"]="Off";
|
|---|
| 366 |
|
|---|
| 367 | if (empty($_GET["fMeanNumberIslands"]))
|
|---|
| 368 | $_GET["fMeanNumberIslands"]="Off";
|
|---|
| 369 |
|
|---|
| 370 | if (empty($_GET["fPSF"]))
|
|---|
| 371 | $_GET["fPSF"]=$first?"On":"";
|
|---|
| 372 |
|
|---|
| 373 | if (empty($_GET["fRatio"]))
|
|---|
| 374 | $_GET["fRatio"]="Off";
|
|---|
| 375 |
|
|---|
| 376 | if (empty($_GET["fMuonNumber"]))
|
|---|
| 377 | $_GET["fMuonNumber"]="Off";
|
|---|
| 378 |
|
|---|
| 379 | if (empty($_GET["fEffOnTime"]))
|
|---|
| 380 | $_GET["fEffOnTime"]="Off";
|
|---|
| 381 |
|
|---|
| 382 | if (empty($_GET["fMuonRate"]))
|
|---|
| 383 | $_GET["fMuonRate"]=$first?"On":"";
|
|---|
| 384 |
|
|---|
| 385 | if (empty($_GET["fDataRate"]))
|
|---|
| 386 | $_GET["fDataRate"]=$first?"On":"";
|
|---|
| 387 |
|
|---|
| 388 | if (empty($_GET["fMaxHumidity"]))
|
|---|
| 389 | $_GET["fMaxHumidity"]="Off";
|
|---|
| 390 |
|
|---|
| 391 | }
|
|---|
| 392 |
|
|---|
| 393 | function PrintForm($_GET, $db, $limits, $rms, $alias)
|
|---|
| 394 | {
|
|---|
| 395 | printf("<center>\n");
|
|---|
| 396 | printf("<form action=\"findoffdata.php\" METHOD=\"GET\">\n");
|
|---|
| 397 |
|
|---|
| 398 | printf(" <table>\n");
|
|---|
| 399 | printf(" <tr><td align='center'>\n");
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 | printf(" <table>\n");
|
|---|
| 403 | printf(" <tr>\n");
|
|---|
| 404 |
|
|---|
| 405 | CheckBox("fRunStart", "Start time");
|
|---|
| 406 | CheckBox("fSequenceLast", "Last run");
|
|---|
| 407 | CheckBox("fZenithDistanceMin", "Zd min");
|
|---|
| 408 | CheckBox("fZenithDistanceMax", "Zd max");
|
|---|
| 409 |
|
|---|
| 410 | printf(" </tr><tr>\n");
|
|---|
| 411 |
|
|---|
| 412 | CheckBox("fNumEvents", "Num of events");
|
|---|
| 413 | CheckBox("fRunTime/60", "Duration");
|
|---|
| 414 | CheckBox("fAzimuthMin", "Azimuth min");
|
|---|
| 415 | CheckBox("fAzimuthMax", "Azimuth max");
|
|---|
| 416 | // CheckBox("fLinks", "Links");
|
|---|
| 417 | /*
|
|---|
| 418 | printf(" </tr></table>\n");
|
|---|
| 419 | printf(" <p>\n");
|
|---|
| 420 | printf(" <table>\n");
|
|---|
| 421 | printf(" <tr>\n");
|
|---|
| 422 | */
|
|---|
| 423 |
|
|---|
| 424 | printf(" </tr><tr>\n");
|
|---|
| 425 |
|
|---|
| 426 | CheckBox("fUnsuitableInner", "Unsuitable inner");
|
|---|
| 427 | CheckBox("fUnsuitableOuter", "Unsuitable outer");
|
|---|
| 428 | CheckBox("fUnreliableInner", "Unreliable inner");
|
|---|
| 429 | CheckBox("fUnreliableOuter", "Unreliable outer");
|
|---|
| 430 |
|
|---|
| 431 | printf(" </tr><tr>\n");
|
|---|
| 432 |
|
|---|
| 433 | CheckBox("fIsolatedInner", "Isolated inner");
|
|---|
| 434 | CheckBox("fIsolatedOuter", "Isolated outer");
|
|---|
| 435 | CheckBox("fIsolatedMaxCluster", "IsolatedMaxCl.");
|
|---|
| 436 |
|
|---|
| 437 | printf(" </tr><tr>\n");
|
|---|
| 438 |
|
|---|
| 439 | CheckBox("fArrTimeMeanInner", "ArrTimeMean in");
|
|---|
| 440 | CheckBox("fArrTimeMeanOuter", "ArrTimeMean out");
|
|---|
| 441 | CheckBox("fArrTimeRmsInner", "ArrTimeRms in");
|
|---|
| 442 | CheckBox("fArrTimeRmsOuter", "ArrTimeRms out");
|
|---|
| 443 |
|
|---|
| 444 | printf(" </tr><tr>\n");
|
|---|
| 445 |
|
|---|
| 446 | CheckBox("fConvFactorInner", "Conv inner ");
|
|---|
| 447 | CheckBox("fConvFactorOuter", "Conv outer ");
|
|---|
| 448 | CheckBox("fMeanPedRmsInner", "MeanPedRms in");
|
|---|
| 449 | CheckBox("fMeanPedRmsOuter", "MeanPedRms out");
|
|---|
| 450 |
|
|---|
| 451 | /*
|
|---|
| 452 | printf(" </tr></table>\n");
|
|---|
| 453 | printf(" <p>\n");
|
|---|
| 454 |
|
|---|
| 455 | printf(" <table>\n");
|
|---|
| 456 | printf(" <tr>\n");
|
|---|
| 457 | */
|
|---|
| 458 |
|
|---|
| 459 | printf(" </tr><tr>\n");
|
|---|
| 460 |
|
|---|
| 461 | CheckBox("fMeanNumberIslands", "MeanNumIslands");
|
|---|
| 462 | CheckBox("fPSF", "PSF");
|
|---|
| 463 | CheckBox("fRatio", "Ratio");
|
|---|
| 464 | CheckBox("fMuonRate", "MuonRate");
|
|---|
| 465 |
|
|---|
| 466 | printf(" </tr><tr>\n");
|
|---|
| 467 |
|
|---|
| 468 | CheckBox("fMuonNumber", "MuonNumber");
|
|---|
| 469 | CheckBox("fEffOnTime", "EffOnTime");
|
|---|
| 470 | CheckBox("fMaxHumidity", "MaxHumidity");
|
|---|
| 471 | CheckBox("fDataRate", "CleanedEvtRate");
|
|---|
| 472 |
|
|---|
| 473 | printf(" </tr>\n");
|
|---|
| 474 | printf(" </table>\n");
|
|---|
| 475 | printf(" <p>\n");
|
|---|
| 476 |
|
|---|
| 477 | printf(" <table><tr><td>\n");
|
|---|
| 478 |
|
|---|
| 479 | PrintPullDown($db, "Source", "fSourceName", "fSourceKEY", "Source Name");
|
|---|
| 480 | printf(" </td><td>\n");
|
|---|
| 481 | PrintPullDown($db, "LightConditions", "fLightConditionsName", "fLightConditionsKEY", "Light Conditions");
|
|---|
| 482 | printf(" </td><td>\n");
|
|---|
| 483 | PrintPullDown($db, "DiscriminatorThresholdTable", "fDiscriminatorThresholdTableName", "fDiscriminatorThresholdTableKEY", "DT Table");
|
|---|
| 484 | printf(" </td></tr><tr><td>\n");
|
|---|
| 485 | PrintPullDown($db, "ManuallyChanged", "fManuallyChangedName", "fManuallyChangedKEY", "Manually changed");
|
|---|
| 486 | printf(" </td><td>\n");
|
|---|
| 487 | PrintStatusMenu("fStar", "Star");
|
|---|
| 488 |
|
|---|
| 489 | printf("</td></tr> </table>\n");
|
|---|
| 490 | printf(" <p>\n");
|
|---|
| 491 |
|
|---|
| 492 | printf(" </td><td valign='top'>\n");
|
|---|
| 493 |
|
|---|
| 494 | printf(" <table>\n");
|
|---|
| 495 | printf(" <tr><th colspan='3'>Limits</th><tr>\n");
|
|---|
| 496 | printf(" <tr><td>Name </td><td> Mean </td><td> Rms </td></tr>\n");
|
|---|
| 497 | PrintLimitsMenu($limits, $rms, $alias);
|
|---|
| 498 | printf(" </td></tr></table>\n");
|
|---|
| 499 |
|
|---|
| 500 | printf(" </td></tr><tr><td colspan='2' align='center'>\n");
|
|---|
| 501 |
|
|---|
| 502 | printf(" <p>\n");
|
|---|
| 503 |
|
|---|
| 504 | printf(" <table>\n");
|
|---|
| 505 | printf(" <tr><td>\n");
|
|---|
| 506 |
|
|---|
| 507 | if (empty($_GET["fStarStart"]))
|
|---|
| 508 | $starmin = GetMin("fStar", "SequenceProcessStatus", $db);
|
|---|
| 509 | else
|
|---|
| 510 | $starmin = $_GET["fStarStart"];
|
|---|
| 511 |
|
|---|
| 512 | if (empty($_GET["fStarStop"]))
|
|---|
| 513 | $starmax = GetMax("fStar", "SequenceProcessStatus", $db);
|
|---|
| 514 | else
|
|---|
| 515 | $starmax = $_GET["fStarStop"];
|
|---|
| 516 |
|
|---|
| 517 | printf("StarDone (yyyy-mm-dd) from <input name=\"fStarStart\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\">\n", $starmin);
|
|---|
| 518 | printf("to <input name=\"fStarStop\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\"> \n", $starmax);
|
|---|
| 519 | printf(" </td>\n");
|
|---|
| 520 | CheckBox("fLinks", "Links");
|
|---|
| 521 | CheckBox("fOff", "incl. offsources");
|
|---|
| 522 | CheckBox("fOnlyOff", "only offsources");
|
|---|
| 523 |
|
|---|
| 524 | printf(" </tr>\n");
|
|---|
| 525 | printf(" </table>\n");
|
|---|
| 526 | printf(" <p>\n");
|
|---|
| 527 |
|
|---|
| 528 | if (empty($_GET["fStartDate"]))
|
|---|
| 529 | $timemin = GetMin("fRunStart", "Sequences", $db);
|
|---|
| 530 | else
|
|---|
| 531 | $timemin = $_GET["fStartDate"];
|
|---|
| 532 |
|
|---|
| 533 | if (empty($_GET["fStopDate"]))
|
|---|
| 534 | $timemax = GetMax("fRunStart", "Sequences", $db);
|
|---|
| 535 | else
|
|---|
| 536 | $timemax = $_GET["fStopDate"];
|
|---|
| 537 |
|
|---|
| 538 | printf("Night (yyyy-mm-dd) from <input name=\"fStartDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\">\n", $timemin);
|
|---|
| 539 | printf("to <input name=\"fStopDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\"> \n", $timemax);
|
|---|
| 540 |
|
|---|
| 541 | if (empty($_GET["fRunMin"]))
|
|---|
| 542 | $min = GetMin("fSequenceFirst", "Sequences", $db);
|
|---|
| 543 | else
|
|---|
| 544 | $min = $_GET["fRunMin"];
|
|---|
| 545 |
|
|---|
| 546 | if (empty($_GET["fRunMax"]))
|
|---|
| 547 | $max = GetMax("fSequenceFirst", "Sequences", $db);
|
|---|
| 548 | else
|
|---|
| 549 | $max = $_GET["fRunMax"];
|
|---|
| 550 |
|
|---|
| 551 | /*
|
|---|
| 552 | printf("Date (yyyy-mm-dd) <input name=\"fDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"");
|
|---|
| 553 | if (!empty($_GET["fDate"]))
|
|---|
| 554 | printf("%s", $_GET["fDate"]);
|
|---|
| 555 | printf("\"> \n");
|
|---|
| 556 | */
|
|---|
| 557 |
|
|---|
| 558 | printf("Sequences from <input name=\"fRunMin\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\">\n", $min);
|
|---|
| 559 | printf("to <input name=\"fRunMax\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\"> \n", $max);
|
|---|
| 560 |
|
|---|
| 561 | printf(" <P>\n");
|
|---|
| 562 |
|
|---|
| 563 | printf("Source (<A HREF=\"regexp.html\">regexp</A>) <input name=\"fSourceN\" type=\"text\" size=\"15\" maxlength=\"15\" value=\"");
|
|---|
| 564 | if (!empty($_GET["fSourceN"]))
|
|---|
| 565 | printf("%s", $_GET["fSourceN"]);
|
|---|
| 566 | printf("\"> \n");
|
|---|
| 567 |
|
|---|
| 568 | printf(" Results:\n");
|
|---|
| 569 | printf(" <select name=\"fNumResults\">\n");
|
|---|
| 570 |
|
|---|
| 571 | $numres = array("10", "20", "50", "100", "200", "500");
|
|---|
| 572 | foreach ($numres as $element)
|
|---|
| 573 | {
|
|---|
| 574 | if ($element==$_GET["fNumResults"])
|
|---|
| 575 | printf("<option value=\"%s\" selected>%3s</option>\n", $element, $element);
|
|---|
| 576 | else
|
|---|
| 577 | printf("<option value=\"%s\">%3s</option>\n", $element, $element);
|
|---|
| 578 | }
|
|---|
| 579 | printf(" </select>\n");
|
|---|
| 580 | printf(" \n");
|
|---|
| 581 |
|
|---|
| 582 | ini_set("mysql.trace_mode", "Off");
|
|---|
| 583 | ini_set("display_errors", "Off");
|
|---|
| 584 |
|
|---|
| 585 | printf("<input class='Width' type='submit' value='Query Table'> \n");
|
|---|
| 586 | printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"findoffdata.php\"'> \n");
|
|---|
| 587 | if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
|
|---|
| 588 | printf("<input class='Width' type='button' value='Get .txt' onClick='self.location.href=\"%s&fSendTxt=1\"'> \n", $_SERVER["REQUEST_URI"]);
|
|---|
| 589 | if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
|
|---|
| 590 | printf("<input class='Width' type='button' value='Print' onClick='self.location.href=\"%s&fPrintTable=1\"'> \n", $_SERVER["REQUEST_URI"]);
|
|---|
| 591 | printf("</form>\n");
|
|---|
| 592 | printf("</center>\n");
|
|---|
| 593 |
|
|---|
| 594 |
|
|---|
| 595 | printf(" </td></tr> </table>\n");
|
|---|
| 596 |
|
|---|
| 597 | printf("</td>\n");
|
|---|
| 598 | printf("</tr>\n");
|
|---|
| 599 |
|
|---|
| 600 |
|
|---|
| 601 | printf("<tr class='Block'>\n");
|
|---|
| 602 | printf("<td>\n");
|
|---|
| 603 | }
|
|---|
| 604 |
|
|---|
| 605 | function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms)
|
|---|
| 606 | {
|
|---|
| 607 | $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
|
|---|
| 608 | if ($db_id==FALSE)
|
|---|
| 609 | {
|
|---|
| 610 | printf("mysql_connect returned the following error: %s\n", mysql_error());
|
|---|
| 611 | die("");
|
|---|
| 612 | }
|
|---|
| 613 | mysql_select_db($db);
|
|---|
| 614 |
|
|---|
| 615 | $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup);
|
|---|
| 616 |
|
|---|
| 617 | $result0 = mysql_query($query0, $db_id);
|
|---|
| 618 |
|
|---|
| 619 | if ($result0)
|
|---|
| 620 | {
|
|---|
| 621 | if ($html=="1" || $html=="2")
|
|---|
| 622 | PrintMagicTable($result0, $alias, $rightalign, $limits, $rms, $_GET);
|
|---|
| 623 | else
|
|---|
| 624 | PrintText($result0);
|
|---|
| 625 |
|
|---|
| 626 | mysql_free_result($result0);
|
|---|
| 627 | }
|
|---|
| 628 | mysql_close($db_id);
|
|---|
| 629 |
|
|---|
| 630 | if ($html=="1")
|
|---|
| 631 | printf("<U><B>submitted query:</B></U><BR>%s<BR>", htmlspecialchars($query0));
|
|---|
| 632 | }
|
|---|
| 633 |
|
|---|
| 634 | include ("include.php");
|
|---|
| 635 | include ("db.php");
|
|---|
| 636 | include ("magicdefs.php");
|
|---|
| 637 |
|
|---|
| 638 | ini_set("display_errors", "On");
|
|---|
| 639 | ini_set("mysql.trace_mode", "On");
|
|---|
| 640 |
|
|---|
| 641 | if (!empty($_GET["fSendTxt"]))
|
|---|
| 642 | {
|
|---|
| 643 | header("Content-type: application/octet");
|
|---|
| 644 | header("Content-Disposition: attachment; filename=query-result.txt");
|
|---|
| 645 |
|
|---|
| 646 | PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms);
|
|---|
| 647 | }
|
|---|
| 648 | else
|
|---|
| 649 | {
|
|---|
| 650 | echo (file_get_contents("index-header.html"));
|
|---|
| 651 |
|
|---|
| 652 | $environment = sizeof($_GET);
|
|---|
| 653 |
|
|---|
| 654 | InitGet($_GET);
|
|---|
| 655 | if (empty($_GET["fPrintTable"]))
|
|---|
| 656 | PrintForm($_GET, $db, $limits, $rms, $alias);
|
|---|
| 657 |
|
|---|
| 658 | if ($environment==0)
|
|---|
| 659 | printf("No query submitted yet.<BR>");
|
|---|
| 660 | else
|
|---|
| 661 | {
|
|---|
| 662 | if (empty($_GET["fPrintTable"]))
|
|---|
| 663 | PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms);
|
|---|
| 664 | else
|
|---|
| 665 | PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms);
|
|---|
| 666 | }
|
|---|
| 667 |
|
|---|
| 668 | echo (file_get_contents("index-footer.html"));
|
|---|
| 669 | }
|
|---|
| 670 |
|
|---|
| 671 | ini_set("display_errors", "Off");
|
|---|
| 672 | ini_set("mysql.trace_mode", "Off");
|
|---|
| 673 | }
|
|---|
| 674 | ?>
|
|---|