Offer a means to add a date
[infodrom.org/www.infodrom.org] / src / Linux / calendar.html.wml
1 #include <infodrom.style>
2 #include <calendar.style>
3 #include <linux.style>
4 #include <addresses.inc>
5
6 <page title="GNU/Linux Events -- Upcoming Events Calendar" alternates="calendar.ics calendar.rdf">
7
8 <h1 align=center>Upcoming Events Calendar</h1>
9
10 <p>This calendar should provide information and dates of upcoming
11 events that cover GNU/Linux and/or Free Software and could be of
12 interest for people affiliated with Free Software or GNU/Linux.  This
13 calendar is a side-effect of the <a
14 href="<root_prefix>Debian/events/calendar.html">work</a> I'm doing for
15 the <a href="http://www.debian.org/">Debian project</a>.  If you miss
16 one event, please don't hesitate and tell me about it by sending a
17 mail to <joey mailto>.
18
19 <p>[ Conf = Conference &ndash; Exhib = Exhibition ]</p>
20
21 <?
22   $dbh = event_connect ();
23
24   $query = "SELECT $event_cols FROM events WHERE cancelled = 0 "
25           ."AND (start <= 'now') AND (start + delta + '23:59' >= 'now') ORDER BY start,name";
26
27   $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
28
29   $year = 0;
30   for ($i=0; $i < pg_NumRows ($sth); $i++) {
31     $row = pg_fetch_array ($sth, $i);
32
33     $date = explode (" ", $row['start']);
34     $date = explode ("-", $date[0]);
35     $end = explode (" ", $row[2]);
36     $end = explode ("-", $end[0]);
37     $thisyear = $date[0];
38
39     $date = format_date ($date, $end);
40
41     if ($thisyear != $year) {
42       if ($year > 0) {
43         echo ($event_table_end);
44         echo ($event_border_end);
45       }
46       $color = $nowcolor;
47       printf ("<h3>Upcoming events in %s</h3>", $thisyear);
48       echo ($event_border_start);
49       echo ($event_table_start);
50       $year = $thisyear;
51     }
52
53     $row['name'] = ereg_replace (" ", "&nbsp;", $row['name']);
54     $row['country'] = ereg_replace (" ", "&nbsp;", $row['country']);
55
56     $name = encode_name ($row, "infodrom");
57
58     printf ($event_trow, $color, $date, $name, $row['city'], $row['country'],
59             $row['conference']==1?"x":"&nbsp;",
60             $row['exhibition']==1?"x":"&nbsp;");
61
62   }
63
64   $query = "SELECT $event_cols FROM events WHERE cancelled = 0 AND (start > 'now') ORDER BY start,name";
65
66   $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
67
68   $color = "<cold>";
69   for ($i=0; $i < pg_NumRows ($sth); $i++) {
70     $row = pg_fetch_array ($sth, $i);
71
72     $date = explode (" ", $row['start']);
73     $date = explode ("-", $date[0]);
74     $end = explode (" ", $row[2]);
75     $end = explode ("-", $end[0]);
76     $thisyear = $date[0];
77
78     $date = format_date ($date, $end);
79
80     if ($thisyear != $year) {
81       if ($year > 0) {
82         echo ($event_table_end);
83         echo ($event_border_end);
84       }
85       $color = "<cold>";
86       printf ("<h3>Upcoming events in %s</h3>", $thisyear);
87       echo ($event_border_start);
88       echo ($event_table_start);
89       $year = $thisyear;
90     }
91
92     $row['name'] = ereg_replace (" ", "&nbsp;", $row['name']);
93     $row['country'] = ereg_replace (" ", "&nbsp;", $row['country']);
94
95     $name = encode_name ($row, "infodrom");
96
97     $color = $color == "<cold>"?"<coln>" : "<cold>";
98     printf ($event_trow, $color, $date, $name, $row['city'], $row['country'],
99             $row['conference']==1?"x":"&nbsp;",
100             $row['exhibition']==1?"x":"&nbsp;");
101
102   }
103   echo ($event_table_end);
104   echo ($event_border_end);
105 ?>
106
107 <p>Download <a href="calendar.ics">iCal</a> or <a href="calendar.rdf">RSS</a> calendar file.</p>
108
109 <p>Submit new <a href="submit.html">event</a>.</p>
110
111 </page>
112
113 # Local variables:
114 # mode: indented-text
115 # mode: auto-fill
116 # end: