* Xnet/Events:
- Events can be archived -FRU
+ - Can get iCal version of the events -FRU
Bug/Wish:
$txt .= ';'.$param['param'];
if (isset($param['value'])) {
if ($txt) $txt .= ':';
- $txt .= utf8_encode($param['value']);
+ $txt .= utf8_encode(
+ preg_replace('/[,;:]/', '\\\\$0',
+ preg_replace("/(\r\n|\r|\n)/", '\n', $param['value'])));
}
$length = strlen($txt);
$endline = "\r\n";
'%grp/events' => $this->make_hook('events', AUTH_MDP),
'%grp/events/sub' => $this->make_hook('sub', AUTH_MDP),
'%grp/events/csv' => $this->make_hook('csv', AUTH_MDP),
+ '%grp/events/ical' => $this->make_hook('ical', AUTH_MDP),
'%grp/events/edit' => $this->make_hook('edit', AUTH_MDP),
'%grp/events/admin' => $this->make_hook('admin', AUTH_MDP),
);
$page->assign('tout', !Env::v('item_id', false));
}
+ function handler_ical(&$page, $eid = null)
+ {
+ global $globals;
+
+ require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php';
+ $evt = get_event_detail($eid);
+ if (!$evt) {
+ return PL_NOT_FOUND;
+ }
+ $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']);
+
+ $page->changeTpl('xnetevents/calendar.tpl', NO_SKIN);
+
+ require_once(dirname(__FILE__).'/carnet/smarty.php');
+ $page->assign('asso', $globals->asso());
+ $page->assign('timestamp', time());
+ $page->register_function('display_ical', 'display_ical');
+ $page->assign_by_ref('e', $evt);
+
+ header('Content-Type: text/calendar; charset=utf-8');
+ }
+
function handler_edit(&$page, $eid = null)
{
global $globals;
$evt = $res->fetchOneAssoc();
- if (!$evt) {
+ if (!$evt || ($evt['accept_nonmembre'] == 0 && !is_member() && !may_update())) {
return null;
}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2006 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+BEGIN:VCALENDAR
+{display_ical name="prodid" value="-//Polytechnique.org//Plat-al//FR"}
+VERSION:2.0
+CALSCALE:GREGORIAN
+X-WR-TIMEZONE:Europe/Paris
+METHOD:PUBLISH
+{display_ical name="x-wr-calname" value=$asso.nom}
+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
+{if $e.accept_nonmembre}
+CLASS:PUBLIC
+{else}
+CLASS:PRIVATE
+{/if}
+{display_ical name="summary" value=$e.intitule}
+{display_ical name="description" value=$e.descriptif}
+END:VEVENT
+END:VCALENDAR
</colgroup>
<tr>
<th colspan="2"{if !$e.inscr_open} class="grayed"{/if}>
- {$e.intitule}
+ <a href="{$platal->ns}events/ical/{$e.eid}/{$e.short_name}.ics">
+ {icon name=calendar_view_day} {$e.intitule}
+ </a>
{if !$e.inscr_open}
(<span class="error">Inscriptions closes</span>)
{/if}