- Dynamic maps using geodesix plugin. -Car
- Link to local maps for all addresses. -Car
+ * Notifications :
+ - iCal calendar for birthdays. -Car
+
* Profile :
- - See fiche send to AX. -Car
+ - See fiche sent to AX. -Car
* Skin :
- Common file for header above title. -Car
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 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 *
+ ***************************************************************************/
+
+require_once("xorg.inc.php");
+new_nonhtml_page('carnet/calendar.tpl', AUTH_PUBLIC);
+
+if (preg_match(',^/([^/]+)/([^/_]+)(_all)?\.ics$,', $_SERVER['PATH_INFO'], $m)) {
+ $alias = $m[1];
+ $hash = $m[2];
+ $all = $m[3];
+} else {
+ $alias = Env::get('alias');
+ $hash = Env::get('hash');
+ $all = Env::has('all');
+}
+if ($alias && $hash) {
+ $res = $globals->xdb->query(
+ 'SELECT a.id
+ FROM aliases AS a
+ INNER JOIN auth_user_quick AS q ON ( a.id = q.user_id AND q.core_rss_hash = {?} )
+ WHERE a.alias = {?} AND a.type != "homonyme"', $hash, $alias);
+ $uid = $res->fetchOneCell();
+}
+
+require_once('notifs.inc.php');
+$notifs = new Notifs($uid, true);
+
+$annivcat = false;
+foreach ($notifs->_cats as $cat)
+ if (preg_match('/anniv/i', $cat['short']))
+ $annivcat = $cat['id'];
+
+if ($annivcat !== false) {
+ $annivs = array();
+ foreach ($notifs->_data[$annivcat] as $promo) foreach ($promo as $notif)
+ if ($all || $notif['contact']) {
+ $annivs[] = array(
+ 'timestamp' => $notif['known'],
+ 'date' => strtotime($notif['date']),
+ 'tomorrow' => strtotime("+1 day", strtotime($notif['date'])),
+ 'bestalias' => $notif['bestalias'],
+ 'summary' => 'Anniversaire de '.$notif['prenom'].' '.$notif['nom'].' - x '.$notif['promo'],
+ );
+ }
+ $page->assign('events', $annivs);
+}
+
+header('Content-Type: text/calendar; charset=utf-8');
+
+$page->run();
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/***************************************************************************
+ * 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 *
+ ***************************************************************************/
+
+function smarty_function_display_ical($param, &$smarty) {
+ $txt = '';
+ if (isset($param['name']))
+ $txt .= strtoupper($param['name']);
+ if (isset($param['param']))
+ $txt .= ';'.$param['param'];
+ if (isset($param['value'])) {
+ if ($txt) $txt .= ':';
+ $txt .= utf8_encode($param['value']);
+ }
+ $length = strlen($txt);
+ $endline = "\r\n";
+ $maxchars = 75;
+ $folded_txt = substr($txt, 0, $maxchars);
+ for ($i = $maxchars; $i < $length; $i += $maxchars - 1)
+ $folded_txt .= $endline.' '.substr($txt, $i, $maxchars - 1);
+ return $folded_txt;
+}
+?>
--- /dev/null
+{**************************************************************************}\r
+{* *}\r
+{* Copyright (C) 2003-2006 Polytechnique.org *}\r
+{* http://opensource.polytechnique.org/ *}\r
+{* *}\r
+{* This program is free software; you can redistribute it and/or modify *}\r
+{* it under the terms of the GNU General Public License as published by *}\r
+{* the Free Software Foundation; either version 2 of the License, or *}\r
+{* (at your option) any later version. *}\r
+{* *}\r
+{* This program is distributed in the hope that it will be useful, *}\r
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}\r
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}\r
+{* GNU General Public License for more details. *}\r
+{* *}\r
+{* You should have received a copy of the GNU General Public License *}\r
+{* along with this program; if not, write to the Free Software *}\r
+{* Foundation, Inc., *}\r
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}\r
+{* *}\r
+{**************************************************************************}\r
+BEGIN:VCALENDAR\r
+{display_ical name="prodid" value="-//Polytechnique.org//Plat-al//FR"}\r
+VERSION:2.0\r
+CALSCALE:GREGORIAN\r
+METHOD:PUBLISH\r
+{display_ical name="x-wr-calname" value="Anniversaires des X"}\r
+X-WR-TIMEZONE:Europe/Paris\r
+{foreach from=$events item=e}\r
+BEGIN:VEVENT\r
+DTSTAMP:{$e.timestamp|date_format:"%Y%m%dT%H%M%SZ"}\r
+DTSTART;VALUE=DATE:{$e.date|date_format:"%Y%m%d"}\r
+DTEND;VALUE=DATE:{$e.tomorrow|date_format:"%Y%m%d"}\r
+UID:anniv-{$e.date|date_format:"%Y%m%d"}-{$e.bestalias}@polytechnique.org\r
+CLASS:PUBLIC\r
+{display_ical name="summary" value=$e.summary}\r
+END:VEVENT\r
+{/foreach}\r
+END:VCALENDAR
\ No newline at end of file
[<a href="mescontacts_pdf.php/mes_contacts.pdf" class='popup'><strong>tri par noms</strong></a>]
</li>
</ul>
+{if $smarty.session.core_rss_hash}
+<p>
+ Tu peux récupérer un calendrier iCal avec l'anniversaire de tes contacts.
+</p>
+ <div class="right">
+ <a href='{rel}/carnet/calendar/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}.ics'><img src='{rel}/images/icalicon.gif' alt='fichier ical' title='Anniversaires'/></a>
+ </div>
+{else}
+<p>
+ Pour récupérer un calendrier iCal avec l'anniversaire de tes contacts, active les flux RSS dans <a href="{rel}/preferences.php">Mes préférences</a>.
+</p>
+{/if}
+
{if $trombi}
</h1>
<p>
-Pour afficher le trombi de tes contacts : [<a href="?trombi=1&order={$order}&inv={$inv}"><strong>vue sous forme de trombi</strong></a>]
+[<a href="?trombi=1&order={$order}&inv={$inv}"><strong>Afficher le trombi de tes contacts</strong></a>]
</p>
{include file=carnet/tricontacts.tpl order=$order}