#include <infodrom.style>

<page func="Infodrom Oldenburg" title="Logbook">

<p>Public Logbook</p>

<table class="smallfont border" width=100% border=0 cellpadding=0 cellspacing=1>
<tr class="head">
<th width=20%>Datum</th>\
<th width=150%>Category</th>\
<th width=65%>Titel</th></tr>

<?
  $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
	       or die("Unable to connect to SQL server");

  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");

  $query = "SELECT id,teaser,category,created FROM logbook WHERE public=1 ORDER BY created DESC";
  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");

  $color = 0;
  for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
    $row = pg_fetch_array ($sth, $nr);
    $date = explode (" ", $row['created']);
    $time = explode (":", $date[1]);
    $date = explode ("-", $date[0]);
    $date = sprintf ("%d.%d.%d %02d:%02d", $date[2], $date[1], $date[0], $time[0], $time[1]);

    printf ("<tr class=\"t%s\"><td align=\"right\">%s</td><td align=\"center\">%s</td><td><a href=\"show.php?id=%s\">%s</a>"
	   ." (<a href=\"http://www.infodrom.org/~joey/log/?%s\">pub</a>)</td></tr>",
	   $color,
	   $date, $row['category'], $row['id'], $row['teaser'], $row['id']);
    $color = !$color;
  }
?>

</table>

</page>

# Local variables:
# mode: text
# mode: auto-fill
# end:
