'%grp/forum' => $this->make_hook('forum', AUTH_MDP, 'groupmember'),
'%grp/annuaire' => $this->make_hook('annuaire', AUTH_MDP, 'groupannu'),
'%grp/annuaire/vcard' => $this->make_hook('vcard', AUTH_MDP, 'groupmember:groupannu'),
+ '%grp/annuaire/csv' => $this->make_hook('csv', AUTH_MDP, 'groupmember:groupannu'),
'%grp/trombi' => $this->make_hook('trombi', AUTH_MDP, 'groupannu'),
'%grp/geoloc' => $this->make_hook('geoloc', AUTH_MDP, 'groupannu'),
'%grp/subscribe' => $this->make_hook('subscribe', AUTH_MDP),
$vcard->do_page($page);
}
+ function handler_csv(&$page, $filename = null)
+ {
+ global $globals;
+ if (is_null($filename)) {
+ $filename = $globals->asso('diminutif') . '.csv';
+ }
+ $ann = XDB::iterator(
+ "SELECT IF(m.origine='X',IF(u.nom_usage<>'', u.nom_usage, u.nom) ,m.nom) AS nom,
+ IF(m.origine='X',u.prenom,m.prenom) AS prenom,
+ IF(m.origine='X', u.promo, IF(m.origine='ext', 'extérieur', 'personne morale')) AS promo,
+ IF(m.origine='X' AND u.perms != 'pending',CONCAT(a.alias, '@', {?}), m.email) AS email,
+ IF(m.origine='X',FIND_IN_SET('femme', u.flags), m.sexe) AS femme,
+ m.comm as comm
+ FROM groupex.membres AS m
+ LEFT JOIN auth_user_md5 AS u ON ( u.user_id = m.uid )
+ LEFT JOIN aliases AS a ON ( a.id = m.uid AND a.type = 'a_vie' )
+ WHERE m.asso_id = {?}
+ AND (m.origine != 'X' OR u.perms != 'pending' OR m.email IS NOT NULL)
+ GROUP BY m.uid
+ ORDER BY nom, prenom",
+ $globals->mail->domain, $globals->asso('id'));
+ header('Content-Type: text/x-csv; charset=utf-8;');
+ header('Pragma: ');
+ header('Cache-Control: ');
+ $page->changeTpl('xnetgrp/annuaire-csv.tpl', NO_SKIN);
+ $page->assign('ann', $ann);
+ }
+
function handler_subscribe(&$page, $u = null)
{
global $globals;
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2008 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 *}
+{* *}
+{**************************************************************************}
+Nom,Prénom,Sexe,Promotion,Email,Commentaire
+{if $ann}
+{iterate from=$ann item=m}
+
+{$m.nom},{$m.prenom},{if $m.sexe}F{else}M{/if},{$m.promo},{$m.email},{$m.comm|replace:',':'\,'}
+
+{/iterate}
+{/if}
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}