#include <infodrom.style>
#include <db.style>

<page title="Infodrom Oldenburg - Todo">

<protect>
<? $pkg = strtr($_GET[pkg], "'<>", '   '); ?>
</protect>

<h1 align=center>Infodrom Oldenburg</h1>
<h3 align=center>&mdash; <? echo $pkg; ?> &mdash;</h3>

<?
  $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  = sprintf ("SELECT * FROM todo WHERE package = '%s' ", $pkg);
  if (isset ($_GET[done]) && $_GET[done] == 1) {
    $query .= "AND done IS NOT NULL ";
  } elseif (isset ($_GET[done]) && $_GET[done] == 0) {
    $query .= "AND done IS NULL ";
  }
  $query .= "ORDER by submitted";
  $sth = pg_exec ($dbh, $query); // or die("Datenbank-Abfrage!");

  $package = '';
  for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
    $row = pg_fetch_array ($sth, $nr);
    $date = explode (" ", $row['submitted']);
    $date = explode ("-", $date[0]);
    $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
    $done = explode (" ", $row['done']);
    $done = explode ("-", $done[0]);
    $done = sprintf ("%d.%d.%d", $done[2], $done[1], $done[0]);
?>

<table width=100% class=blueborder cellpadding=1 cellspacing=0>

<tr bgcolor=<colh>>
<th width=90% align=left><b><? echo $row['subject']; ?></b></th>
<th width=10% align=right><? echo $date; ?></th>
</tr>

<tr>
<td colspan=2 width=100%><? echo $row['description']; ?></td>
</tr>

<?  if (strlen ($row['donemsg']) > 0) { ?>
<tr bgcolor=<cold>>
<td colspan=2 width=100%><? printf ("<blockquote>Done on %s<p>%s</blockquote>", $done, $row['donemsg']); ?></td>
</tr>
<?  } ?>

</table>

<?
  }
?>

</page>

# Local variables:
# mode: indented-text
# mode: auto-fill
# mode-: iso-accents
# end:
