Print the title
[infodrom.org/oldenburg.linux.de] / src / Termine / index.wml
1 #include <LUGO.style>
2 #include "stacheltermine.inc"
3 #include "years.inc"
4
5 <?
6 $datedb = "dates.txt";
7
8 $dates = array();
9 function readdb()
10 {
11   global $datedb;
12   global $dates;
13
14   if (($db = fopen($datedb,'r')) !== false) {
15     $lines = array();
16     while (!feof($db)) {
17       $line = fgets($db, 200);
18
19       if (!preg_match("/^([0-9]{4})-([0-9]{2})-([0-9]{2})\|/", $line))
20         continue;
21
22       $dates[] = $line;
23     }
24   }
25 }
26
27 function display_dates()
28 {
29   global $dates;
30
31   $layout_head = '<div style="padding-top: 10px;"></div>'
32                 .'<table class="dates" width="100%%" border="0" cellpadding="0" cellspacing="0">'
33                 .'<tr bgcolor="#aeaeae"><th align="left" colspan="2"><strong>&nbsp;%s</strong></th>'
34                 .'<td align="left">Ort</td>'
35                 .'<td align="center">Zeit</td>'
36                 .'</tr>';
37   $layout_row = '<tr bgcolor=#%s>'
38                .'<td align=left width=20%%>&nbsp;%d. (%s)</td>'
39                .'<td align=left width=60%%>%s</td>'
40                .'<td align=left width=15%%>%s</td>'
41                .'<td align=right width=5%%>%s&nbsp;</td>'
42                .'</tr>';
43   $layout_foot = '</table>';
44
45   $nowstring = date("Y-m-");
46   $today = mktime(0,0,0, date('m'), date('d'), date('Y'));
47
48   sort($dates);
49   $cmon = false;
50   $color = 'ffffff';
51   foreach ($dates as $line) {
52     if ($line < $nowstring)
53       continue;
54
55     if (preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})\|([^\|]*)\|[^\|]*\|([^\|]*)\|([^\|]*)\|(.*)/", $line, $match)) {
56
57       $when = mktime(0,0,0, $match[2], $match[3], $match[1]);
58
59       if ($match[1] !== $thisyear || $match[2] !== $thismonth) {
60         if ($cmon)
61           echo $layout_foot;
62         $thisyear = $match[1];
63         $thismonth = $match[2];
64         printf($layout_head, strftime("%B %Y", $when));
65         $cmon = true;
66       }
67       if (strlen($match[7]))
68         $title = '<a href="' . $match[7] . '">' . $match[5] . '</a>';
69       else
70         $title = $match[5];
71
72       if ($when == $today)
73         $color = 'ffff00';
74       printf($layout_row, $color, $match[3], strftime("%A", $when), $title, $match[6], $match[4]);
75       $color = $color == 'ffffff'?'d7d7d7':'ffffff';
76     }
77   }
78   if ($cmon)
79     echo $layout_foot;
80 }
81
82 setlocale(LC_TIME, "de_DE");
83 readdb();
84 ?>
85
86 <page name=Termine>
87
88 <h3>Veranstaltungen rund um GNU/Linux in der Region Weser-Ems</h3>
89
90 <p>Hier finden Sie Termine von Veranstaltungen, die sich mit Linux,
91 GNU/Linux und/oder Freier Software befassen und in der Region
92 Weser-Ems stattfinden.  Wenn keine Stadt angegeben ist, findet die
93 Veranstaltung in Oldenburg statt.</p>
94
95 <p>Sollte eine Veranstaltung fehlen, kontaktieren Sie bitte joey@infodrom.org.</p>
96
97 <? display_dates() ?>
98
99 <build_tables>
100 <more_years>
101
102 </page>
103
104 # Local variables:
105 # mode: text
106 # mode: auto-fill
107 # mode: iso-accents
108 # end: