Improve page: sort months descendingly, don't emit table foot without head
authorJoey Schulze <joey@infodrom.org>
Mon, 10 Nov 2008 16:45:15 +0000 (16:45 +0000)
committerJoey Schulze <joey@infodrom.org>
Mon, 10 Nov 2008 16:45:15 +0000 (16:45 +0000)
src/InfoCon/stempel/status.wml
src/InfoCon/stempel/submenu.inc

index 3ce2887..9afdcfd 100644 (file)
@@ -18,7 +18,6 @@
                 $_POST["status"], $_POST["oid_".$idx]);
        $count++;
        $sth = pg_exec ($dbh, $query);
-echo '<br'.$query;
       }
     }
     return sprintf("<br>%d records updated.", $count);
@@ -89,8 +88,10 @@ echo '<br'.$query;
       printf($table_row, $color, $check.$d[0], min2hour($row['time']), $row['kurz'], $row['task']);
       $color = !$color;
     }
-    printf($table_sum, $color, min2hour($sum));
-    printf($table_foot, $fieldnr);
+    if (pg_num_rows($sth) > 0) {
+      printf($table_sum, $color, min2hour($sum));
+      printf($table_foot, $fieldnr);
+    }
   }
 
   $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
index e39a884..055aa75 100644 (file)
@@ -6,7 +6,7 @@
     global $dbh;
 
     $a = array();
-    $query = "SELECT DISTINCT substr(cast(start AS TEXT),0,8) FROM stempel ORDER BY substr(cast(start AS TEXT),0,8)";
+    $query = "SELECT DISTINCT substr(cast(start AS TEXT),0,8) FROM stempel ORDER BY substr(cast(start AS TEXT),0,8) DESC";
     $sth = pg_exec ($dbh, $query);
 
     while ($row = pg_fetch_array ($sth)) {