Current events

This feature lets any page or template retrieve and display current and upcoming talks and events.

The template function current_events() returns a hash with two keys: current and upcoming. For each key, the value is a hash whose keys are the rooms and the values are the corresponding event.

This snippet of code displays the entire structure:

  <table>
  [% events = current_events();
     FOREACH period = events.keys.sort %]
     
     <tr><td colspan="3"><h2>[% period %]</h2></td></tr>
     
     [% FOREACH room = events.$period.keys.sort;
          event = events.$period.$room %]
          <tr><td>[% global.config.rooms.$room OR loc("room_$room") %]</td>
              <td>[% date_format(event.datetime, 'time') %]</td>
              <td><b>[% event.title %]</b>
                  <i>([% event.duration %] {{min}})</i>
                  [% IF global.config.talks_languages %]
                  - [% global.config.talks_languages.${event.lang} %]
                  [% END %]
                  [% IF event.user %]
                    <br />{{by}} [% user_info_base(event.user) %]
                  [% END %]
              </td>
          </tr>
     [% END %]

  [% END %]
  </table>

current_events() uses the current date and time to determine current and upcoming events. To accomodate testing ahead of time, the function takes a datetime string as an optional argument:

  [% events = current_events('2007-08-28 10:00:00') %]

The following example creates a full screen window displaying on the left side the current talks and events, and a slideshow on the right side. This requires 2 files. The first file fullscreen_start.html creates a full screen window.

  [% WRAPPER ui title="Photos" %]
    <script language="JavaScript">
    window.open('[% make_uri("fullscreen.html") %]', '', 'fullscreen=yes, scrollbars=auto');
    </script>
  [% END %]

The second file fullscreen.html displays the current and upcoming talks and events and the slideshow. The talk and event list is refreshed every 5 minutes.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="[% global.request.language %]" xml:lang="[% global.request.language %]">
    <head>
    <meta http-equiv="refresh" content="300"/>
    <title>[% global.conference.name %]</title>
    <style>
    body {
      font-family: sans-serif;
      font-size: 15pt;
      font-weight:normal;
      background-color: #FFF;
      padding: 0;
      margin: 0;
    }
    h1 {
      font-size: 20pt;
      color: #22b5d7;
    }
    table {
      border: none;
    }
    td {
      vertical-align: top;
    }
    </style>
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript" src="/js/act.js"></script><script language="JavaScript">
    if (window.act) {
        $(function() {
            var photos = [
              [% photos = flickr_get(); FOREACH p = photos %]
                '[% p.medium %]'[% ',' UNLESS loop.last %]
              [% END %]
            ];
            function newpic()
            {
                var i = Math.floor(Math.random() * photos.length);
                $("#flickrimage").attr('src', photos[i]);
                setTimeout(newpic, 5000);
            }
            newpic();
        });
    }
    </script>
    </head>
    <body>
    <table width="100%" cellpadding="10">
        <tr>
            <td width="50%">
                <table>
                [% events = current_events();
                   FOREACH period = events.keys.sort %]
                   
                     <tr><td colspan="3"><h1>[% period %]</h1></td></tr>
                
                     [% FOREACH room = events.$period.keys.sort;
                          event = events.$period.$room %]
                          <tr><td>[% global.config.rooms.$room %]</td>
                              <td>[% date_format(event.datetime, 'time') %]</td>
                              <td><b>[% event.title %]</b> <i>([% event.duration %]mn)</i></td>
                          </tr>
                     [% END %]
                
                  [% END %]
                </table>
            </td>
            [% IF photos.size %]
            <td>
              <img id="flickrimage" src="" />
            </td>
            [% END %]
        </tr>
    </table>
    </body>

Authors

Philippe Bruhat, Éric Cholet

License

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.