+ 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);
+ }
+