62590d216e8d935c0af39dc73d6fce4ab6664223
[infodrom.org/service.infodrom.org] / src / Infodrom / calendar / index.wml
1 #include <infodrom.style>
2
3 <future>
4 <page func="Infodrom Oldenburg" title="Termine">
5
6 <style type="text/css">
7 table#calendar tr.row:hover {
8     background: yellow;
9 }
10 table#calendar tr.newkw td {
11     border-top: 1px solid #999;
12 }
13 table#calendar tr.month {
14     background: #a7ddff;
15 }
16 table#calendar tr.current {
17     background: orange;
18 }
19 </style>
20
21 <table id="calendar" width="100%" class="smallfont border" cellspacing="0" summary="">
22 <tr class="head">
23 <th width="5%">KW</th>
24 <th width="20%">Datum</th>
25 <th width="55%">Beschreibung</th>
26 <th width="20%">Location</th>
27 </tr>
28
29 <?php
30   setlocale('LC_TIME', 'de_DE');
31   $now = date('Y-m-d H:i:s');
32   $pivot = date('Y-m-d H:i:s', time()+(7*24*60*60));
33
34   $item = new Calendar_Item();
35   $month = '';
36
37   if (empty($_GET['year'])) {
38     $from = time();
39     $to = false;
40   } else {
41     $from = mktime(0,0,0,1,1,intval($_GET['year']));
42     $to = mktime(0,0,0,1,1,intval($_GET['year'])+1) - 1;
43   }
44   $kw = '';
45   foreach ($item->getItems($from, $to) as $row) {
46     $start = new DateTime($row->dtstart);
47     $newmonth = $start->format('F Y');
48     if ($month != $newmonth) {
49       $month = $newmonth;
50       printf('<tr class="month" month="%s"><td colspan="4">%s</td></tr>',
51              $start->format('Y-m'), $month);
52       $kw = '';
53     }
54
55     $tooltip = '';
56     if (strlen($row->description))
57       $tooltip = sprintf(' title="%s"', htmlspecialchars($row->description));
58
59     $class = 'row';
60     if ($row->dtstart >= $now && $row->dtstart < $pivot)
61       $class .= ' current';
62     if (strlen($kw) && $kw != $row->kw)
63       $class .= ' newkw';
64       
65     printf('<tr id="%d" class="%s"><td>%s</td><td>%s</td><td%s>%s</td><td>%s</td></tr>',
66            $row->dav_id,
67            $class,
68            $kw != $row->kw ? $row->kw : '&nbsp;',
69            Calendar_Item::formatTimespan($row->dtstart, $row->dtend),
70            utf8_decode($tooltip),
71            utf8_decode($row->summary),
72            utf8_decode($row->location));
73     $kw = $row->kw;
74   }
75
76 ?>
77
78 </table>
79
80 </page>
81
82 # Local variables:
83 # mode: text
84 # mode: auto-fill
85 # mode: iso-accents
86 # end: