Changeset 9249 for trunk/MagicSoft/Mars/datacenter/db/sequinfo-aio.php
- Timestamp:
- 01/23/09 17:27:58 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/db/sequinfo-aio.php
r9175 r9249 17 17 $query0 = "SELECT "; 18 18 19 if ($groups>0) 20 { 21 foreach ($checkgroup as $key => $element) 22 if ($element==-1) 23 $query0 .= $key . " as '" . $alias[$key] . "' " . ", "; 19 if ($groups>0 || ((!empty($_GET["fGroupByDate"])) && !$_GET["fGroupByDate"]==0) || $statusgroups>0) 20 { 21 if ($groups>0) 22 foreach ($checkgroup as $key => $element) 23 if ($element==-1) 24 $query0 .= $key . " as '" . $alias[$key] . "' " . ", "; 25 26 if ((!empty($_GET["fGroupByDate"])) && !$_GET["fGroupByDate"]==0) 27 { 28 $query0 .= " DATE_FORMAT(ADDDATE(fRunStart,Interval 12 hour), '"; 29 switch($_GET["fGroupByDate"]) 30 { 31 case "Year": 32 $query0 .= "%Y "; 33 break; 34 case "Month": 35 $query0 .= "%Y-%m "; 36 break; 37 case "Night": 38 $query0 .= "%Y-%m-%d "; 39 break; 40 } 41 $query0 .= "') AS GroupByDate, "; 42 } 43 24 44 //-------------------------------------------------- 25 45 $query0 .= "SUM(fRunTime)/3600 as '" . $alias["SUM(fRunTime)/3600"] . "', "; … … 29 49 $query0 .= " Max(fZenithDistanceMax) as '" . $alias["Max(fZenithDistanceMax)"] . "', "; 30 50 $query0 .= " COUNT(*) as '# Sequ' "; 31 } 32 else 33 { 51 34 52 if ($statusgroups>0) 35 53 { 36 54 foreach ($checkstatusgroup as $key => $element) 37 55 if ($element==-1) 38 $query0 .= " (if(IsNull(" . $key . "), if(isnull(fStartTime), 'not done', if(isnull(fFailedTime),if(isnull(" . $needs[$key] . "),'not done',if(date_sub(Now(),interval 12 hour) < fStartTime,'running','crashed')),if(isnull(" . $needs[$key] . "),'not done','failed'))) ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "',";56 $query0 .= ", (if(IsNull(" . $key . "), if(isnull(fStartTime), 'not done', if(isnull(fFailedTime),if(isnull(" . $needs[$key] . "),'not done',if(date_sub(Now(),interval 12 hour) < fStartTime,'running','crashed')),if(isnull(" . $needs[$key] . "),'not done','failed'))) ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "' "; 39 57 // $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', "; 40 58 41 $query0 .= " COUNT(*) as '# Sequ'";59 $query0 .= ", COUNT(*) as '# Sequ'"; 42 60 43 61 } 62 } 63 else 64 { 65 if (!empty($_GET["fSendTxt"])) 66 $query0 .= " " . $fromtable . ".fSequenceFirst as '" . $alias["fSequenceFirst"] . "' "; 44 67 else 45 68 { 46 if (!empty($_GET["fSendTxt"])) 47 $query0 .= " " . $fromtable . ".fSequenceFirst as '" . $alias["fSequenceFirst"] . "' "; 48 else 69 //old version using fRunMin, fRunMax 70 //$query0 .= " CONCAT('<A&ws;HREF=\"runinfo-aio.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>') "; 71 //new version using fSequenceNo 72 $query0 .= " CONCAT('<A&ws;HREF=\"runinfo-aio.php?', 'fRunStart=On', '&fZenithDistance=On', '&fSequenceNo=', Sequences.fSequenceFirst, '&fMeanTriggerRate=On', '&fTest=On', '&fRunTypeName=On', '&fNumEvents=On', '&fSourceName=On&', 'fExcludedFDAKEY=1', '&fSequenceFirst=On', '&fRawFileAvail=On', '&fCCFileAvail=On', '&fCaCoFileAvail=On', '&fNumResults=500\">', 'M', Sequences.fTelescopeNumber, ':', LPAD(Sequences.fSequenceFirst, 8, ' '), '</A>') "; 73 //$query0 .= " as " . $alias["fSequenceFirst"]; 74 $query0 .= " as 'Tel:Sequ'"; 75 if (!empty($_GET["fLinks"])) 49 76 { 50 //old version using fRunMin, fRunMax 51 //$query0 .= " CONCAT('<A&ws;HREF=\"runinfo-aio.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>') "; 52 //new version using fSequenceNo 53 $query0 .= " CONCAT('<A&ws;HREF=\"runinfo-aio.php?', 'fRunStart=On', '&fZenithDistance=On', '&fSequenceNo=', Sequences.fSequenceFirst, '&fMeanTriggerRate=On', '&fTest=On', '&fRunTypeName=On', '&fNumEvents=On', '&fSourceName=On&', 'fExcludedFDAKEY=1', '&fSequenceFirst=On', '&fRawFileAvail=On', '&fCCFileAvail=On', '&fCaCoFileAvail=On', '&fNumResults=500\">', 'M', Sequences.fTelescopeNumber, ':', LPAD(Sequences.fSequenceFirst, 8, ' '), '</A>') "; 54 // $query0 .= " as " . $alias["fSequenceFirst"]; 55 $query0 .= " as 'Tel:Sequ'"; 56 if (!empty($_GET["fLinks"])) 57 { 58 $query0 .= ", CONCAT('<A&ws;HREF=\"tabs.php?t=calib&n=', fSequenceFirst, '\">cal</A>'"; 59 $query0 .= ", ' <A&ws;HREF=\"tabs.php?t=signal&n=', fSequenceFirst, '\">sig</A>'"; 60 $query0 .= ", ' <A&ws;HREF=\"tabs.php?t=star&n=', fSequenceFirst, '\">star</A>'"; 61 $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>' "; 62 // $query0 .= ", ' <A&ws;HREF=\"sequence.php?fSequenceNo=', Sequences.fSequenceFirst , '&fAll=On\">i</A>'"; 63 $query0 .= ", ' <A&ws;HREF=\"queryrbk.php?fNight=', date_format(adddate(fRunStart, interval +13 HOUR), '%Y-%m-%d') , '&fDate=2\">rbk</A>') "; 64 // $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>'"; 65 // $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>'"; 66 // $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>'"; 67 // $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>'"; 68 // $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>' "; 69 // $query0 .= ", ' <A&ws;HREF=\"sequence.php?fSequenceNo=', Sequences.fSequenceFirst , '&fAll=On\">i</A>'"; 70 // $query0 .= ", ' <A&ws;HREF=\"queryrbk.php?fNight=', date_format(adddate(fRunStart, interval +13 HOUR), '%Y-%m-%d') , '&fDate=2\">rbk</A>') "; 71 $query0 .= " as 'Links'"; 72 } 77 $query0 .= ", CONCAT('<A&ws;HREF=\"tabs.php?t=calib&n=', fSequenceFirst, '\">cal</A>'"; 78 $query0 .= ", ' <A&ws;HREF=\"tabs.php?t=signal&n=', fSequenceFirst, '\">sig</A>'"; 79 $query0 .= ", ' <A&ws;HREF=\"tabs.php?t=star&n=', fSequenceFirst, '\">star</A>'"; 80 $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>' "; 81 //$query0 .= ", ' <A&ws;HREF=\"sequence.php?fSequenceNo=', Sequences.fSequenceFirst , '&fAll=On\">i</A>'"; 82 $query0 .= ", ' <A&ws;HREF=\"queryrbk.php?fNight=', date_format(adddate(fRunStart, interval +13 HOUR), '%Y-%m-%d') , '&fDate=2\">rbk</A>') "; 83 //$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>'"; 84 //$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>'"; 85 //$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>'"; 86 //$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>'"; 87 //$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>' "; 88 //$query0 .= ", ' <A&ws;HREF=\"sequence.php?fSequenceNo=', Sequences.fSequenceFirst , '&fAll=On\">i</A>'"; 89 //$query0 .= ", ' <A&ws;HREF=\"queryrbk.php?fNight=', date_format(adddate(fRunStart, interval +13 HOUR), '%Y-%m-%d') , '&fDate=2\">rbk</A>') "; 90 $query0 .= " as 'Links'"; 73 91 } 74 75 foreach ($_GET as $key => $element)76 if ($_GET[$key]=="On")77 if ($key!="fLinks" && $key!="fOff" && $key!="fOnlyOff" && $key!="fOnlySum")78 if (empty($checkwhere[$key]) || $checkwhere[$key]==0)79 $query0 .= ", " . $key . " as '" . $alias[$key] . "' ";80 92 } 93 94 foreach ($_GET as $key => $element) 95 if ($_GET[$key]=="On") 96 if ($key!="fLinks" && $key!="fOff" && $key!="fOnlyOff" && $key!="fOnlySum") 97 if (empty($checkwhere[$key]) || $checkwhere[$key]==0) 98 $query0 .= ", " . $key . " as '" . $alias[$key] . "' "; 81 99 } 82 100 … … 219 237 } 220 238 239 if ((!empty($_GET["fGroupByDate"])) && !$_GET["fGroupByDate"]==0) 240 if (strpos($query0, " GROUP BY ")==FALSE) 241 $query0 .= " GROUP BY GroupByDate "; 242 else 243 $query0 .= ", GroupByDate "; 244 221 245 if ($statusgroups>0) 222 246 { 223 $query0 .= " GROUP BY "; 247 // $query0 .= " GROUP BY "; 248 if (strpos($query0, " GROUP BY ")==FALSE) 249 $query0 .= " GROUP BY "; 250 else 251 $query0 .= ", "; 224 252 $num = $statusgroups; 225 253 foreach ($checkstatusgroup as $key => $element) … … 332 360 printf("<p>"); 333 361 PrintSourceMenu($host,$user,$pw,$db); 362 PrintGroupByDateMenu(); 363 printf("<p>"); 334 364 PrintNightRangeMenu($host,$user,$pw,$db, "Sequences"); 335 365 printf("<p>");
Note:
See TracChangeset
for help on using the changeset viewer.