From: x2003bruneau Date: Thu, 26 Oct 2006 10:12:14 +0000 (+0000) Subject: Improve iCal version of xnetevents X-Git-Tag: xorg/0.9.12~162 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=99544d53fa61dee39d200b8cf7615b58999ceeb7;p=platal.git Improve iCal version of xnetevents git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1027 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/modules/carnet/smarty.php b/include/ical.inc.php similarity index 98% rename from modules/carnet/smarty.php rename to include/ical.inc.php index 09d5504..7ab5896 100644 --- a/modules/carnet/smarty.php +++ b/include/ical.inc.php @@ -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) diff --git a/modules/carnet.php b/modules/carnet.php index 91a145a..88e76b7 100644 --- a/modules/carnet.php +++ b/modules/carnet.php @@ -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'); diff --git a/modules/xnetevents.php b/modules/xnetevents.php index 3ffa2eb..ef4c145 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -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); diff --git a/templates/xnetevents/calendar.tpl b/templates/xnetevents/calendar.tpl index 85d62c3..e63e9dc 100644 --- a/templates/xnetevents/calendar.tpl +++ b/templates/xnetevents/calendar.tpl @@ -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} diff --git a/templates/xnetevents/index.tpl b/templates/xnetevents/index.tpl index 5a47665..8a2f064 100644 --- a/templates/xnetevents/index.tpl +++ b/templates/xnetevents/index.tpl @@ -29,10 +29,12 @@ {if $archive}Archives {else}[Archives] {/if} +{if !$archive}

[Annoncer un nouvel événement]

{/if} +{/if} {foreach from=$evenements item=e} @@ -42,9 +44,10 @@ - - {icon name=calendar_view_day} {$e.intitule} + + {icon name=calendar_view_day title="Evénement iCal"} + {$e.intitule} {if !$e.inscr_open} (Inscriptions closes) {/if} @@ -167,10 +170,22 @@ {foreachelse} +

+{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}

{/foreach} +{if $evenements} +

+ 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 +

+{/if} + {* vim:set et sw=2 sts=2 sws=2: *}