1 #include <infocon.style>
3 <page func=InfoCon title="Stempeluhr">
6 function min2hour($minutes)
8 return sprintf('%02d:%02d', $minutes/60, $minutes%60);
11 $table_head = '<hr class="bar">%s</h3>
12 <table class=font width="100%%" border=0 cellpadding=2 cellspacing=0>
14 <th width=15%%>Datum</th>
15 <th width=15%%>Dauer</th>
16 <th width=70%%>Verwendungszweck</th>
18 $table_foot = '</table>';
19 $table_row = '<tr bgcolor=#%s><td>%s</td><td>%s</td><td><a href="edit.php?id=%d">%s</a></td></tr>';
21 $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
22 or die("Unable to connect to SQL server");
24 pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
26 $query = "SELECT oid,start,customer,time,task FROM stempel WHERE time IS NOT NULL ORDER BY customer,start";
28 $sth = pg_exec ($dbh, $query);
31 while ($row = pg_fetch_array ($sth)) {
33 if ($customer != $row['customer']) {
34 if (strlen($customer))
36 printf($table_head, $row['customer']);
37 $customer = $row['customer'];
41 $d = explode(' ', $row['start']);
43 $color = $color=="<cold>"?"<coln>":"<cold>";
44 printf($table_row, $color, $d[0], min2hour($row['time']), $row['oid'], $row['task']);