#include <infodrom.style>
#include <debian.style>
#include <calendar.style>

<page title="Debian Events -- Upcoming Events Calendar">

<h1 align=center>Upcoming Events Calendar</h1>

<p>This calendar should give information about upcoming events that
cover Linux and/or Free Software and could be of interest for Debian
Developers, either for simply attending as well as running a booth or
giving a talk.  (<em>To be honest, it ought to help me do events work
for Debian as well.</em>)

<p>Please check out <a
href="http://www.debian.org/events/">www.debian.org</a> and the links
(if any) of each event to find out whether Debian involvement is
already planned.  If you want to help out at a location or negotiate
with the administration, please contact events@debian.org who should
have contact information.

<?
  $dbh = event_connect ();

  $query = "SELECT $event_cols FROM events WHERE cancelled = 0 "
	  ."AND (start <= 'now') AND (start + delta + '23:59' >= 'now') ORDER BY start,name";

  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");

  $year = 0;
  for ($i=0; $i < pg_NumRows ($sth); $i++) {
    $row = pg_fetch_array ($sth, $i);

    $date = explode (" ", $row['start']);
    $date = explode ("-", $date[0]);
    $end = explode (" ", $row[2]);
    $end = explode ("-", $end[0]);
    $thisyear = $date[0];

    $date = format_date ($date, $end);

    if ($thisyear != $year) {
      if ($year > 0) {
        echo ($event_table_end);
      }
      $color = 2;
      printf ("<h3>Upcoming events in %s</h3>", $thisyear);
      echo ($event_table_start);
      $year = $thisyear;
    }

    $row['name'] = str_replace (" ", "&nbsp;", $row['name']);
    $row['country'] = str_replace (" ", "&nbsp;", $row['country']);

    $name = encode_name ($row, "debian");

    printf ($event_trow, $color, $date, $name, $row['city'], $row['country'],
	    $row['conference']==1?"x":"&nbsp;",
	    $row['exhibition']==1?"x":"&nbsp;");

  }

  $query = "SELECT $event_cols FROM events WHERE cancelled = 0 AND (start > 'now') ORDER BY start,name";

  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");

  $color = 0;
  for ($i=0; $i < pg_NumRows ($sth); $i++) {
    $row = pg_fetch_array ($sth, $i);

    $date = explode (" ", $row['start']);
    $date = explode ("-", $date[0]);
    $end = explode (" ", $row[2]);
    $end = explode ("-", $end[0]);
    $thisyear = $date[0];

    $date = format_date ($date, $end);

    if ($thisyear != $year) {
      if ($year > 0) {
        echo ($event_table_end);
      }
      $color = 0;
      printf ("<h3>Upcoming events in %s</h3>", $thisyear);
      echo ($event_table_start);
      $year = $thisyear;
    }

    $row['name'] = str_replace (" ", "&nbsp;", $row['name']);
    $row['city'] = str_replace (" ", "&nbsp;", $row['city']);
    $row['country'] = str_replace (" ", "&nbsp;", $row['country']);

    $name = encode_name ($row, "debian");

    printf ($event_trow, $color, $date, $name, $row['city'], $row['country'],
	    $row['conference']==1?"x":"&nbsp;",
	    $row['exhibition']==1?"x":"&nbsp;");
    $color = !$color;
  }
  echo ($event_table_end);
?>

<p>Download <a href="<root_prefix>Linux/calendar.ics">iCal</a> or <a href="<root_prefix>Linux/calendar.rdf">RSS</a> calendar file.</p>

</page>

# Local variables:
# mode: indented-text
# mode: auto-fill
# end:
