<?
  if (!isset($_GET['id'])) {
    header('Location: index.php');
    exit(0);
  }
?>
#include <infocon.style>
#include "common.inc"

<page func=InfoCon title="Stempeluhr">

<?
  $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 start,stop,customer,time,task,status FROM stempel WHERE oid = %d", $_GET['id']);

  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");

  $row = pg_fetch_array ($sth, 0);
?>

<style type="text/css">
label {
  display: block;
  font-weight: bold;
  font-size: 12px;
  width: 80px;
  text-align: left;
  padding-left: 5px;
  padding-top: 0px;
  padding-bottom: 0px;
  background-color: #1aa2fe;
  color: white;
}
input {
  width: 400px;
  margin-bottom: 10px;
  border: 1px solid #1aa2fe;
}
input.radio {
  width: auto;
  margin: 0;
  padding: 0;
}
div.radio {
  width: 400px;
  margin-bottom: 10px;
  border: 1px solid #1aa2fe;
  padding-top: 3px;
  padding-bottom: 3px;
}
div.radio input.radio {
  margin-left: 5px;
}
</style>

<?
$name = load_customers();
$cname = $name[$row['customer']];
if (!strlen($cname)) $cname = ucfirst($row['customer']);

printf('<h3 class="bar" align="center">%s: %s</h3>', $cname, substr($row['task'],0,80-strlen($cname)));
?>

<form method=post action="update.php">
<input class=none type=hidden name=oid value="<? echo $_GET['id']; ?>">

<label for=start>Start</label>
<input id=start name=start size=40 maxlength=80 value="<? echo $row['start']; ?>">

<br class="none">
<label for=stop>Stop</label>
<input id=stop name=stop size=40 maxlength=80 value="<? echo $row['stop']; ?>">

<br class="none">
<label for=time>Time</label>
<input id=time name=time size=40 maxlength=80 value="<? echo min2hour($row['time']); ?>">

<br class="none">
<label for=task>Task</label>
<input id=task name=task size=40 maxlength=80 value="<? echo $row['task']; ?>">

<br class="none">
<label for=status>Status</label>
<div class="radio">
<?
  if (!is_array($stati))
    $stati = find_status();

  foreach ($stati as $k=>$v)
    printf('<input type="radio" class="radio" name="status" value="%s"%s>%s&nbsp;', $k, $row['status']==$k?' checked':'', $v);
?>
</div>

<p><center>
<input class=button type=submit value="Update">
<input class=button type=submit name=delete value="Delete">
</center><p>
</form>

</page>

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