Improve iCal version of xnetevents
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 26 Oct 2006 10:12:14 +0000 (10:12 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 26 Oct 2006 10:12:14 +0000 (10:12 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1027 839d8a87-29fc-0310-9880-83ba4fa771e5

include/ical.inc.php [moved from modules/carnet/smarty.php with 98% similarity]
modules/carnet.php
modules/xnetevents.php
templates/xnetevents/calendar.tpl
templates/xnetevents/index.tpl

similarity index 98%
rename from modules/carnet/smarty.php
rename to include/ical.inc.php
index 09d5504..7ab5896 100644 (file)
@@ -32,7 +32,7 @@ function display_ical($param) {
                     preg_replace("/(\r\n|\r|\n)/", '\n', $param['value'])));
     }
     $length = strlen($txt);
-    $endline = "\r\n";
+    $endline = "\n";
     $maxchars = 75;
     $folded_txt = substr($txt, 0, $maxchars);
     for ($i = $maxchars; $i < $length; $i += $maxchars - 1)
index 91a145a..88e76b7 100644 (file)
@@ -337,7 +337,7 @@ class CarnetModule extends PLModule
 
     function handler_ical(&$page)
     {
-        require_once dirname(__FILE__).'/carnet/smarty.php';
+        require_once 'ical.inc.php';
         $page->changeTpl('carnet/calendar.tpl', NO_SKIN);
         $page->register_function('display_ical', 'display_ical');
 
index 3ffa2eb..ef4c145 100644 (file)
@@ -290,11 +290,20 @@ class XnetEventsModule extends PLModule
         $evt['debut'] = preg_replace('/(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/', "\\1\\2\\3T\\4\\5\\6", $evt['debut']);
         $evt['fin'] = preg_replace('/(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/', "\\1\\2\\3T\\4\\5\\6", $evt['fin']);
 
+        foreach ($evt['moments'] as $m) {
+            $evt['descriptif'] .= "\n\n** " . $m['titre'] . " **\n" . $m['details'];
+        }
+
         $page->changeTpl('xnetevents/calendar.tpl', NO_SKIN);
 
-        require_once(dirname(__FILE__).'/carnet/smarty.php');
+        require_once('ical.inc.php');
         $page->assign('asso', $globals->asso());
         $page->assign('timestamp', time());
+        $page->assign('admin', may_update());
+
+        if (may_update()) {
+            $page->assign('participants', get_event_participants($evt, null, 'promo, nom, prenom'));
+        }
         $page->register_function('display_ical', 'display_ical');
         $page->assign_by_ref('e', $evt);
     
index 85d62c3..e63e9dc 100644 (file)
@@ -30,8 +30,17 @@ BEGIN:VEVENT
 DSTAMP:{$timestamp|date_format:"%Y%m%dT%H%M%SZ"}
 DTSTART;VALUE=DATE;TZID=Europe/Paris:{$e.debut}
 DTEND;VALUE=DATE;TZID=Europe/Paris:{$e.fin}
-ORGANIZER:CN="{$e.prenom} {$e.nom}":MAILTO:{$e.alias}@polytechnique.org
-UID:event-{$asso.diminutif}-{$e.short_name}@polytechnique.org
+ORGANIZER;CN="{$e.prenom|utf8_encode} {$e.nom|utf8_encode}":MAILTO:{$e.alias}@polytechnique.org
+UID:event-{$e.short_name}-{$e.eid}@{$asso.diminutif}.polytechnique.org
+{if $admin}
+{foreach from=$participants item=m}
+{if $m.x}
+ATTENDEE;CN="{$m.prenom|utf8_encode} {$m.nom|utf8_encode} (X{$m.promo})":MAILTO:{$m.email}@{#globals.mail.domain#}
+{else}
+ATTENDEE;CN="{$m.prenom|utf8_encode} {$m.nom|utf8_encode} (non-X)":MAILTO:{$m.email}
+{/if}
+{/foreach}
+{/if}
 {if $e.accept_nonmembre}
 CLASS:PUBLIC
 {else}
index 5a47665..8a2f064 100644 (file)
   {if $archive}Archives {else}[<a href="{$platal->ns}events/archive">Archives</a>] {/if}
 </h1>
 
+{if !$archive}
 <p class="center">
   [<a href="{$platal->ns}events/edit">Annoncer un nouvel événement</a>]
 </p>
 {/if}
+{/if}
 
 {foreach from=$evenements item=e}
 
   </colgroup>
   <tr>
     <th colspan="2"{if !$e.inscr_open} class="grayed"{/if}>
-      <a href="{$platal->ns}events/ical/{$e.eid}/{$e.short_name}.ics">
-        {icon name=calendar_view_day} {$e.intitule}
+      <a href="{$platal->ns}events/ical/{$e.eid}/{$e.short_name}.ics" style="display: block; float: left;">
+        {icon name=calendar_view_day title="Evénement iCal"}
       </a>
+      {$e.intitule}
       {if !$e.inscr_open}
       (<span class="error">Inscriptions closes</span>)
       {/if}
 
 {foreachelse}
 
+
 <p class="descr">
+{if $archive}
+  Aucun événement n'a été archivé par les animateurs du groupe.
+{else}
   Aucun événement n'a été référencé par les animateurs du groupe.
+{/if}
 </p>
 
 {/foreach}
 
+{if $evenements}
+<p class="descr">
+  En cliquant sur l'icône {icon name=calendar_view_day title="Evénement iCal"} associée à un événement
+  tu peux télécharger la version iCal de l'événement qui permet de l'ajouter dans ton agenda électronique
+</p>
+{/if}
+
 {* vim:set et sw=2 sts=2 sws=2: *}