9d10db05d672f61f27ab4834dd414651f229b0f0
[infodrom.org/service.infodrom.org] / src / InfoCon / stempel / common.inc
1 <?
2
3   function min2hour($minutes)
4   {
5       return sprintf('%02d:%02d', $minutes/60, $minutes%60);
6   }
7
8   function find_status()
9   {
10     global $dbh;
11
12     $a = array();
13     $query = "SELECT id,name FROM stempel_status ORDER BY id";
14     $sth = pg_exec ($dbh, $query);
15
16     while ($row = pg_fetch_array ($sth)) {
17       $a[$row['id']] = $row['name'];
18     }
19     return $a;
20   }
21
22   function find_months()
23   {
24     global $dbh;
25
26     $a = array();
27     $query = "SELECT DISTINCT substr(cast(start AS TEXT),0,8) FROM stempel ORDER BY substr(cast(start AS TEXT),0,8) DESC";
28     $sth = pg_exec ($dbh, $query);
29
30     while ($row = pg_fetch_array ($sth)) {
31       $a[] = $row[0];
32     }
33     return $a;
34   }
35
36 ?>