+ // Determine which day to display.
+ // This is either from a previous button though a _POST[] variable
+ // or the last day in the log table by default.
+
+ if (empty($_POST['logday']))
+ {
+ $res = pg_exec($this->database, "SELECT date_trunc('day',object_timestamp) FROM log
+ WHERE objectid='". $_GET['oid'] ."'
+ ORDER BY object_timestamp DESC LIMIT 1");
+
+ $last_time = pg_fetch_object($res, 0);
+ $logday = strtotime($last_time->date_trunc);
+ }
+ else
+ {
+ $logday = $_POST['logday'];
+ }
+
+ // Make buttons to request the previous and the next day of logs.
+
+ echo "<form method='POST'>";
+ echo "<input type='submit' value='<<'>";
+ echo "<input type='hidden' name='logday' value='" . ($logday - 24 * 60 * 60) . "'>";
+ echo "</form>";
+
+ echo "<h3>" . date('F d, Y', $logday) ."</h3>";
+
+ echo "<form method='POST'>";
+ echo "<input type='submit' value='>>'>";
+ echo "<input type='hidden' name='logday' value='" . ($logday + 24 * 60 * 60) . "'>";
+ echo "</form>";
+
+ // Show the log for one day only.
+