X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Flists.php;h=115c7c424ef1dda33e71b6d4a8fd6c22514cec02;hb=1fec3da6a5ec7db190df686bd4c1a71f69308482;hp=78fba968f254184dc01d56bd1f73221a65e9afc0;hpb=a0c034efcf0777541e087500e94853f515cda1ca;p=platal.git diff --git a/modules/lists.php b/modules/lists.php index 78fba96..115c7c4 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -31,6 +31,7 @@ class ListsModule extends PLModule 'lists/create' => $this->make_hook('create', AUTH_MDP), 'lists/members' => $this->make_hook('members', AUTH_COOKIE), + 'lists/csv' => $this->make_hook('csv', AUTH_COOKIE), 'lists/annu' => $this->make_hook('annu', AUTH_COOKIE), 'lists/archives' => $this->make_hook('archives', AUTH_COOKIE), 'lists/archives/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS), @@ -337,6 +338,25 @@ class ListsModule extends PLModule } } + function handler_csv(PlPage &$page, $liste = null) + { + if (is_null($liste)) { + return PL_NOT_FOUND; + } + $this->prepare_client($page); + $members = $this->client->get_members($liste); + $list = list_fetch_names(list_extract_members($members[1])); + header('Content-Type: text/x-csv; charset=utf-8;'); + header('Pragma: '); + header('Cache-Control: '); + + echo "email,nom,prenom,promo\n"; + foreach ($list as $member) { + echo @$member['email'] . ',' . @$member['nom'] . ',' . @$member['prenom'] . ',' . @$member['promo'] . "\n"; + } + exit; + } + function handler_annu(&$page, $liste = null, $action = null, $subaction = null) { if (is_null($liste)) {