Index: trunk/ippMonitor/raw/czartool_labels.php
===================================================================
--- trunk/ippMonitor/raw/czartool_labels.php	(revision 41178)
+++ trunk/ippMonitor/raw/czartool_labels.php	(revision 41192)
@@ -236,4 +236,6 @@
 echo "<tr><td>ippMonitor SVN version</td>
           <td>"; include 'version.php'; echo "</td></tr>"; 
+echo "<tr><td>Current PHP version: </td>
+          <td>" . phpversion(); echo "</td></tr>";
 echo "<tr><td>Current nightly science status</td>
           <td>$nsStatus</td></tr>"; 
@@ -1556,5 +1558,5 @@
 #
 ###########################################################################
-function createSummitDataTable($projectdb) {
+function createSummitDataTable2($projectdb) {
 
     // timer start
@@ -1565,110 +1567,8 @@
 
     // function begin
-    $date = date("Y-m-d");
-    $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'";
-
-    $qry = $projectdb->query($sql);
-    if (dberror($qry)) {
-        echo "<b>error reading newExp table</b><br>\n";
-        echo "<br><small><b> table query : $sql </b></small><br>\n";
-        menu_end();
-    }
-
-    // set up the table
-    global $table;
-    echo $table;
-    echo "<tr>";
-    createTableTitle("Data status > $date", 4);
-    echo "<tr>";
-    createTableColumnHeader("Exposure type");
-    createTableColumnHeader("At summit");
-    createTableColumnHeader("Registered at MHPCC");
-    createTableColumnHeader("Summit (Drop/Null)");
-
-    $msg = "No science images taken since $date";
-
-    // list the results
-    while ($qry->fetchInto($expType)) {
-
-        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 
-                WHERE dateobs > '$date' AND exp_type = '$expType[0]'";
-             //   AND state != 'drop' AND state is not null AND fault != 1042";
-        $qry2 = $projectdb->query($sql);
-        $qry2->fetchInto($summit);
-
-        $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 
-                WHERE summitExp.dateobs > '$date' AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";
-        $qry2 = $projectdb->query($sql);
-        $qry2->fetchInto($mhpcc);
-
-        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 
-                WHERE dateobs > '$date' AND exp_type = '$expType[0]' AND (state = 'drop' OR state is null)";
-        $qry2 = $projectdb->query($sql);
-        $qry2->fetchInto($dropped);
-
-
-        #Query with 30 minutes delay to check during the night if any exposures are missing.
-        $datehour = gmdate("Y-m-d H:i:s");
-        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 
-                WHERE dateobs > '$date' AND dateobs <= date_sub('$datehour', interval 30 minute) 
-                AND exp_type = '$expType[0]' AND (state != 'drop' OR state is null) and fault != 1042";
-
-        $qry2 = $projectdb->query($sql);
-        $qry2->fetchInto($summitdelay);
-
-        $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 
-                WHERE summitExp.dateobs > '$date' AND summitExp.dateobs <= date_sub('$datehour', interval 30 minute) 
-                AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";
-        $qry2 = $projectdb->query($sql);
-        $qry2->fetchInto($mhpccdelay);
-
-        echo "<tr>";
-
-        $DLdiff = $summit[0] - $mhpcc[0];
-        if ($DLdiff == 0) $error = 0;
-        else $error = 1;
-
-        $delayDLdiff = $summitdelay[0] - $mhpccdelay[0];
-        if ($delayDLdiff == 0) $errordelay = 0;
-        else $errordelay = 1;
-
-        echo "<td>$expType[0]</td>";
-        echo "<td>$summit[0]</td>";
-        if ($delayDLdiff==0) {
-           createFormattedTableCell("", "", $mhpcc[0], $error, 0);
-        } else {
-           $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\"  color=\"red\">$mhpcc[0] ($delayDLdiff)</font>";
-           echo "<td>$DLStatus</td>";
-        }
-
-        echo "<td>$dropped[0]</td>";
-
-        echo "</tr>";
-    }
-
-    // timer finished
-    echo "<tr><th colspan=4>";
-    $time = microtime();
-    $time = explode(' ', $time);
-    $time = $time[1] + $time[0];
-    $finish = $time;
-    $total_time = round(($finish - $start), 3);
-    echo "loading in $total_time seconds.";
-    $start= $finish;
-    echo "</th></tr>";
-    echo "</table><br>";
-}
-
-
-function createSummitDataTable2($projectdb) {
-
-    // timer start
-    $time = microtime();
-    $time = explode(' ', $time);
-    $time = $time[1] + $time[0];
-    $start = $time;
-
-    // function begin
-    $date = date("Y-m-d");
+    $date = gmdate("Y-m-d");
+    $datem1 = gmdate("Y-m-d",strtotime ( "-1 day") );
+    $datetime = gmdate("H:i:s");
+
     // set up the table
     global $table;
@@ -1676,5 +1576,5 @@
     echo $table;
     echo "<tr>";
-    createTableTitle("Data status > $date", 4);
+    createTableTitle("Data status tonight $date (UT) <br> current time $datetime", 4);
     echo "<tr>";
     createTableColumnHeader("Exp_type at summit");
@@ -1684,5 +1584,5 @@
     $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp 
             LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name 
-            WHERE summitExp.dateobs > '$date' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state";
+            WHERE summitExp.dateobs like '$date%' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state";
     $qry = $projectdb->query($sql);
     while ($qry->fetchInto($tmp)) {
@@ -1705,4 +1605,27 @@
     }
 
+    echo "<tr><th colspan=4>Last night $datem1 (UT)";
+    $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp 
+            LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name 
+            WHERE summitExp.dateobs like '$datem1%' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state";
+    $qry = $projectdb->query($sql);
+    while ($qry->fetchInto($tmp)) {
+        if ($tmp[1] == NULL) { 
+          echo  "<tr><td>$tmp[0]<td> null <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$tmp[3]";
+        }
+        else {
+          if ($tmp[1] == 'run') { 
+            echo  "<tr><td>$tmp[0]<td> loading <td> null <td bgcolor=$columnHeaderColor> <font color=\"red\">$tmp[3]"; 
+          }
+          else {
+            if ($tmp[2] == NULL) { 
+              echo  "<tr><td>$tmp[0] <td> $tmp[1] <td> loading <td bgcolor=$columnHeaderColor> <font color=\"blue\">$tmp[3]";
+            }
+            else {
+              echo  "<tr><td>$tmp[0]<td> $tmp[1] <td> downloaded <td> $tmp[3]";
+            }
+          }
+        }
+    }
     // timer finished
     echo "<tr><th colspan=4>";
@@ -1717,4 +1640,111 @@
     echo "</table><br>";
 }
+////////////////////////////////////////////////////////////////////////////////
+///                         no needed functions                              ///
+////////////////////////////////////////////////////////////////////////////////
+//function createSummitDataTable($projectdb) {
+//
+//    // timer start
+//    $time = microtime();
+//    $time = explode(' ', $time);
+//    $time = $time[1] + $time[0];
+//    $start = $time;
+//
+//    // function begin
+//    $date = date("Y-m-d");
+//    $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'";
+//
+//    $qry = $projectdb->query($sql);
+//    if (dberror($qry)) {
+//        echo "<b>error reading newExp table</b><br>\n";
+//        echo "<br><small><b> table query : $sql </b></small><br>\n";
+//        menu_end();
+//    }
+//
+//    // set up the table
+//    global $table;
+//    echo $table;
+//    echo "<tr>";
+//    createTableTitle("Data status > $date", 4);
+//    echo "<tr>";
+//    createTableColumnHeader("Exposure type");
+//    createTableColumnHeader("At summit");
+//    createTableColumnHeader("Registered at MHPCC");
+//    createTableColumnHeader("Summit (Drop/Null)");
+//
+//    $msg = "No science images taken since $date";
+//
+//    // list the results
+//    while ($qry->fetchInto($expType)) {
+//
+//        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 
+//                WHERE dateobs > '$date' AND exp_type = '$expType[0]'";
+//             //   AND state != 'drop' AND state is not null AND fault != 1042";
+//        $qry2 = $projectdb->query($sql);
+//        $qry2->fetchInto($summit);
+//
+//        $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 
+//                WHERE summitExp.dateobs > '$date' AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";
+//        $qry2 = $projectdb->query($sql);
+//        $qry2->fetchInto($mhpcc);
+//
+//        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 
+//                WHERE dateobs > '$date' AND exp_type = '$expType[0]' AND (state = 'drop' OR state is null)";
+//        $qry2 = $projectdb->query($sql);
+//        $qry2->fetchInto($dropped);
+//
+//
+//        #Query with 30 minutes delay to check during the night if any exposures are missing.
+//        $datehour = gmdate("Y-m-d H:i:s");
+//        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 
+//                WHERE dateobs > '$date' AND dateobs <= date_sub('$datehour', interval 30 minute) 
+//                AND exp_type = '$expType[0]' AND (state != 'drop' OR state is null) and fault != 1042";
+//
+//        $qry2 = $projectdb->query($sql);
+//        $qry2->fetchInto($summitdelay);
+//
+//        $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 
+//                WHERE summitExp.dateobs > '$date' AND summitExp.dateobs <= date_sub('$datehour', interval 30 minute) 
+//                AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";
+//        $qry2 = $projectdb->query($sql);
+//        $qry2->fetchInto($mhpccdelay);
+//
+//        echo "<tr>";
+//
+//        $DLdiff = $summit[0] - $mhpcc[0];
+//        if ($DLdiff == 0) $error = 0;
+//        else $error = 1;
+//
+//        $delayDLdiff = $summitdelay[0] - $mhpccdelay[0];
+//        if ($delayDLdiff == 0) $errordelay = 0;
+//        else $errordelay = 1;
+//
+//        echo "<td>$expType[0]</td>";
+//        echo "<td>$summit[0]</td>";
+//        if ($delayDLdiff==0) {
+//           createFormattedTableCell("", "", $mhpcc[0], $error, 0);
+//        } else {
+//           $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\"  color=\"red\">$mhpcc[0] ($delayDLdiff)</font>";
+//           echo "<td>$DLStatus</td>";
+//        }
+//
+//        echo "<td>$dropped[0]</td>";
+//
+//        echo "</tr>";
+//    }
+//
+//    // timer finished
+//    echo "<tr><th colspan=4>";
+//    $time = microtime();
+//    $time = explode(' ', $time);
+//    $time = $time[1] + $time[0];
+//    $finish = $time;
+//    $total_time = round(($finish - $start), 3);
+//    echo "loading in $total_time seconds.";
+//    $start= $finish;
+//    echo "</th></tr>";
+//    echo "</table><br>";
+//}
+
 ?>
 
