4 @month = ('dummy','Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember');
5 @day = ('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag');
8 $layout_month = '<div style="padding-top: 10px;"></div>\
9 <table class="dates" width="100%%" border="0" cellpadding="0" cellspacing="0">\
10 <tr><th align="left" colspan="2" bgcolor="#80CCF8"><strong> %s %d</strong></th>\
11 <td align="left" bgcolor="#80CCF8">Ort</td>\
12 <td align="center" bgcolor="#80CCF8">Zeit</td>\
14 # bgcol Tag (Tag) - Text - Ort - Zeit
17 <td align=left width=20%%> %d. (%s)</td>\
18 <td align=left width=60%%>%s</td>\
19 <td align=left width=15%%>%s</td>\
20 <td align=right width=5%%>%s </td>\
24 @layout_color = ('ffffff','eff0f1');
27 <define-tag more_years>
31 my $max = (localtime(time))[5]+1900;
32 foreach my $year (2000..$max) {
33 next unless -f $year . '.wml';
34 push (@y, sprintf ("<a href=\"%s.%s\">%s</a>",
35 $year, $year >= 2008?"php":"html", $year))
36 if ($year ne "<get-var WML_SRC_BASENAME>");
38 printf "<p>Vergangene Termine in %s</p>\n", join (", ", @y);
42 <define-tag build_tables>
45 $year = (split (/-/, (split (/\|/, (sort (@termine))[0]))[0]))[0];
48 $color = $layout_color[1];
49 foreach $termin (sort (@termine)) {
50 @termin = split (/\|/, $termin);
51 @date = split (/-/, $termin[0]);
53 if ($mon ne "$date[0]-$date[1]") {
58 $color = $layout_color[1];
59 print "<p><hr>" if ($year != $date[0]);
62 printf $layout_month, $month[$date[1]], $date[0];
63 $mon = "$date[0]-$date[1]";
65 if ($termin[2] ne $descr || $date[2] != $day+1) {
66 $color = $color eq $layout_color[0]?$layout_color[1]:$layout_color[0];
71 $text = sprintf ("<a href=\"%s\">%s</a>", $termin[4], $termin[2]);
75 $wday = (localtime(timelocal(0,0,0,$date[2],$date[1]-1, $date[0])))[6];
77 printf $layout_row, $color, $date[2], $day[$wday], $text, $termin[3], $termin[1];
84 <define-tag php_utils>
86 function readdb($datedb)
90 if (($db = fopen($datedb,'r')) !== false) {
93 $line = fgets($db, 200);
95 if (!preg_match("/^([0-9]{4})-([0-9]{2})-([0-9]{2})\|/", $line))
104 function display_dates($past=false)
109 $layout_head = '<div style="padding-top: 10px;"></div>'
110 .'<table class="dates" width="100%%" border="0" cellpadding="0" cellspacing="0">'
111 .'<tr class="head"><th align="left" colspan="2"><strong> %s</strong></th>'
112 .'<td align="left">Ort</td>'
113 .'<td align="center">Zeit</td>'
115 $layout_row = '<tr class="%s">'
116 .'<td align=left width=20%%> %d. (%s)</td>'
117 .'<td align=left width=60%%>%s</td>'
118 .'<td align=left width=15%%>%s</td>'
119 .'<td align=right width=5%%>%s </td>'
122 $layout_foot = '</table>';
124 $nowstring = date("Y-m-d");
125 $today = mktime(0,0,0, date('m'), date('d'), date('Y'));
129 foreach ($dates as $line) {
130 if (($past == false && $line < $nowstring) ||
131 ($past == true && $line > $nowstring))
134 if (preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})\|([^\|]*)\|[^\|]*\|([^\|]*)\|([^\|]*)\|(.*)/", $line, $match)) {
136 $when = mktime(0,0,0, $match[2], $match[3], $match[1]);
138 if ($match[1] !== $thisyear || $match[2] !== $thismonth) {
141 $thisyear = $match[1];
142 $thismonth = $match[2];
143 printf($layout_head, strftime("%B %Y", $when));
146 if (strlen($match[7]))
147 $title = '<a href="' . $match[7] . '">' . $match[5] . '</a>';
154 $class = ($class == 'row0'?'row1':'row0');
156 printf($layout_row, $class, $match[3], strftime("%A", $when), $title, $match[6], $match[4]);
166 # mode: indented-text