Changeset 9249 for trunk/MagicSoft/Mars/datacenter/db/runinfo-aio.php
- Timestamp:
- 01/23/09 17:27:58 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/MagicSoft/Mars/datacenter/db/runinfo-aio.php ¶
r9150 r9249 17 17 $query0 = "SELECT "; 18 18 19 if ($groups>0 )19 if ($groups>0 || ((!empty($_GET["fGroupByDate"])) && !$_GET["fGroupByDate"]==0) || $statusgroups>0) 20 20 { 21 21 foreach ($checkgroup as $key => $element) 22 22 if ($element==-1) 23 23 $query0 .= $key . " as '" . $alias[$key] . "' " . ", "; 24 25 if ((!empty($_GET["fGroupByDate"])) && !$_GET["fGroupByDate"]==0) 26 { 27 $query0 .= " DATE_FORMAT(ADDDATE(fRunStart,Interval 12 hour), '"; 28 switch($_GET["fGroupByDate"]) 29 { 30 case "Year": 31 $query0 .= "%Y "; 32 break; 33 case "Month": 34 $query0 .= "%Y-%m "; 35 break; 36 case "Night": 37 $query0 .= "%Y-%m-%d "; 38 break; 39 } 40 $query0 .= "') AS GroupByDate, "; 41 } 42 24 43 //-------------------------------------------------- 25 44 //$query0 .= " TIMEDIFF(fRunStop, fRunStart), "; … … 33 52 $query0 .= " Max(fZenithDistance) as '" . $alias["Max(fZenithDistance)"] . "', "; 34 53 $query0 .= " COUNT(*) as '# Runs' "; 35 } 36 else 37 { 54 38 55 if ($statusgroups>0) 39 56 { 40 57 foreach ($checkstatusgroup as $key => $element) 41 58 if ($element==-1) 42 $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] . "',";59 $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] . "' "; 43 60 // $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', "; 44 61 45 $query0 .= " count(*) as'# Runs'";62 $query0 .= ", COUNT(*) AS '# Runs'"; 46 63 47 64 } 48 else 65 } 66 else 67 { 68 //$query0 .= " RunData.fRunNumber as 'Run#' "; 69 //$query0 .= " Concat(RunData.fTelescopeNumber,':', RunData.fRunNumber,':', RunData.fFileNumber) as 'Run' "; 70 $query0 .= " Concat('M', RunData.fTelescopeNumber,':', LPAD(RunData.fRunNumber,8, ' '),'/', LPAD(RunData.fFileNumber, 3, ' ')) as 'Tel:Run/File' "; 71 72 if (empty($_GET["fSendTxt"]) && !empty($_GET["fLinks"])) 49 73 { 50 // $query0 .= " RunData.fRunNumber as 'Run#' "; 51 // $query0 .= " Concat(RunData.fTelescopeNumber,':', RunData.fRunNumber,':', RunData.fFileNumber) as 'Run' "; 52 $query0 .= " Concat('M', RunData.fTelescopeNumber,':', LPAD(RunData.fRunNumber,8, ' '),'/', LPAD(RunData.fFileNumber, 3, ' ')) as 'Tel:Run/File' "; 53 54 if (empty($_GET["fSendTxt"]) && !empty($_GET["fLinks"])) 55 { 56 $query0 .= ", CONCAT('<A&ws;HREF=\"queryrbk.php?fNight=', date_format(adddate(fRunStart, interval +13 HOUR), '%Y-%m-%d') , '&fDate=2\">rbk</A>') "; 57 $query0 .= " as 'Links'"; 58 } 59 60 foreach ($_GET as $key => $element) 61 if ($key!="fLinks" && $_GET[$key]=="On" && $key!="fTest") 62 if (empty($checkwhere[$key]) || $checkwhere[$key]==0) 63 $query0 .= ", " . $key . " as '" . $alias[$key] . "' "; 74 $query0 .= ", CONCAT('<A&ws;HREF=\"queryrbk.php?fNight=', date_format(adddate(fRunStart, interval +13 HOUR), '%Y-%m-%d') , '&fDate=2\">rbk</A>') "; 75 $query0 .= " as 'Links'"; 64 76 } 77 78 foreach ($_GET as $key => $element) 79 if ($key!="fLinks" && $_GET[$key]=="On" && $key!="fTest") 80 if (empty($checkwhere[$key]) || $checkwhere[$key]==0) 81 $query0 .= ", " . $key . " as '" . $alias[$key] . "' "; 65 82 } 66 83 … … 165 182 } 166 183 184 if ((!empty($_GET["fGroupByDate"])) && !$_GET["fGroupByDate"]==0) 185 if (strpos($query0, " GROUP BY ")==FALSE) 186 $query0 .= " GROUP BY GroupByDate "; 187 else 188 $query0 .= ", GroupByDate "; 189 167 190 if ($statusgroups>0) 168 191 { 169 $query0 .= " GROUP BY "; 192 if (strpos($query0, " GROUP BY ")==FALSE) 193 $query0 .= " GROUP BY "; 194 else 195 $query0 .= ", "; 170 196 $num = $statusgroups; 171 197 foreach ($checkstatusgroup as $key => $element) … … 264 290 printf(" <P>\n"); 265 291 PrintSourceMenu($host,$user,$pw,$db); 292 PrintGroupByDateMenu(); 266 293 printf("<p>"); 267 294 printf("</div>");
Note:
See TracChangeset
for help on using the changeset viewer.