$users = User::getBulkUsersWithUIDs($res, 'uid', 'user');
$sum = 0;
- pl_cached_content_headers('text/x-csv', 1);
+ pl_cached_content_headers('text/x-csv', 'iso-8859-1', 1);
$csv = fopen('php://output', 'w');
- fputcsv($csv, array('Date', 'Nom', 'Prénom', 'Sexe', 'Promotion', 'Email', 'Commentaire', 'Montant'), ';');
+ fputcsv($csv, array('Date', 'Nom', utf8_decode('Prénom'), 'Sexe', 'Promotion', 'Email', 'Commentaire', 'Montant'), ';');
foreach ($users as $item) {
$user = $item['user'];
$sum += $item['amount'];
- fputcsv($csv, array(format_datetime($item['date'], '%d/%m/%y'), $user->lastName(), $user->firstName(),
+ fputcsv($csv, array(format_datetime($item['date'], '%d/%m/%y'), utf8_decode($user->lastName()), utf8_decode($user->firstName()),
($user->isFemale()) ? 'F' : 'M', $user->promo(), $user->ForlifeEmail(),
- $item['comment'], strtr($item['amount'],'.',',').' €' ), ';');
+ utf8_decode($item['comment']), strtr($item['amount'], '.', ',') . ' EUR' ), ';');
}
- fputcsv($csv, array(date('d/m/y'), 'Total', '', '', '' , '', '', strtr($sum,'.',',').' €'), ';');
+ fputcsv($csv, array(date('d/m/y'), 'Total', '', '', '' , '', '', strtr($sum, '.', ',') . ' EUR'), ';');
fclose($csv);
exit;
return PL_NOT_FOUND;
}
- pl_cached_content_headers('text/x-csv', 1);
+ pl_cached_content_headers('text/x-csv', 'iso-8859-1', 1);
$page->changeTpl('xnetevents/csv.tpl', NO_SKIN);
$admin = may_update();
-
$tri = (Env::v('order') == 'alpha' ? UserFilter::sortByPromo() : UserFilter::sortByName());
+ $all = !Env::v('item_id', false);
- $page->assign('participants',
- get_event_participants($evt, $item_id, $tri));
+ $participants = get_event_participants($evt, $item_id, $tri);
+ $title = 'Nom;Prénom;Promotion';
+ if ($all) {
+ foreach ($evt['moments'] as $moment) {
+ $title .= ';' . $moment['titre'];
+ }
+ }
+ if ($admin && $evt['money']) {
+ $title .= ';À payer;';
+ if ($evt['paiement_id']) {
+ $title .= 'Télépaiement;Liquide/Chèque;';
+ }
+ $title .= 'Payé';
+ } else {
+ $title .= ';Nombre';
+ }
+ echo utf8_decode($title) . "\n";
+
+ if ($participants) {
+ foreach ($participants as $participant) {
+ $user = $participant['user'];
+ $line = $user->lastName() . ';' . $user->firstName() . ';' . $user->promo();
+ if ($all) {
+ foreach ($evt['moments'] as $moment) {
+ $line .= ';' . $participant[$moment['item_id']];
+ }
+ }
+ if ($admin && $evt['money']) {
+ $line .= ';' . $participant['montant'] . ';';
+ if ($evt['paiement_id']) {
+ $line .= $participant['telepayment'] . ';' . $participant['adminpaid'] . ';';
+ }
+ $line .= $participant['paid'];
+ } else {
+ $line .= ';' . $participant['nb'];
+ }
- $page->assign('admin', $admin);
- $page->assign('moments', $evt['moments']);
- $page->assign('money', $evt['money']);
- $page->assign('telepayment', $evt['paiement_id']);
- $page->assign('tout', !Env::v('item_id', false));
+ echo utf8_decode($line) . "\n";
+ }
+ }
+ exit();
}
function handler_ical($page, $eid = null)
$filename = $globals->asso('diminutif') . '.csv';
}
$users = $globals->asso()->getMembersFilter(null, new UFO_Name())->getUsers();
- pl_cached_content_headers('text/x-csv', 1);
- $page->changeTpl('xnetgrp/annuaire-csv.tpl', NO_SKIN);
- $page->assign('users', $users);
+ pl_cached_content_headers('text/x-csv', 'iso-8859-1', 1);
+
+ echo utf8_decode("Nom;Prénom;Sexe;Promotion;Commentaire\n");
+ foreach ($users as $user) {
+ $line = $user->lastName() . ';' . $user->firstName() . ';' . ($user->isFemale() ? 'F' : 'M')
+ . ';' . $user->promo() . ';' . strtr($user->group_comm, ';', ',');
+ echo utf8_decode($line) . "\n";
+ }
+ exit();
}
function handler_directory_sync($page)
<p>
Liste des personnes ayant payé (pour les administrateurs uniquement) :<br />
<a href="{$platal->ns}payment/csv/{$p.id}.csv">{icon name=page_excel title="Fichier Excel"} Obtenir au format Excel</a>
+ <small>(encodage : iso-8859-1, séparateur : point-virgule)</small>
</p>
<table cellpadding="0" cellspacing="0" id="list_{$p.id}" class='bicol'>
<tr>
<a href="{$platal->ns}events/csv/{$evt.eid}/{$platal->argv[2]}/{$evt.intitule|escape:url}{if $evt.titre}.{$evt.titre|escape:url}{/if}.csv">
{icon name=page_excel title="Télécharger au format Excel"} Télécharger le fichier Excel
</a>
+ <small>(encodage : iso-8859-1, séparateur : point-virgule)</small>
</p>
<hr />
+++ /dev/null
-{**************************************************************************}
-{* *}
-{* Copyright (C) 2003-2011 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;Promotion{if $tout}{foreach from=$moments item=m};{$m.titre}{/foreach}{if $admin && $money};À payer;{if
-$telepayment}Télépaiement;Liquide/Chèque;{/if}Payé{/if}{else};Nombre{/if}
-
-{if $participants}
-{foreach from=$participants item=m}
-
-;
-{$m.user->lastName()};{$m.user->firstName()};{$m.user->promo()}{if $tout}{foreach from=$moments item=i};{$m[$i.item_id]}{/foreach}{if $admin &&
-$money};{$m.montant};{if $telepayment}{$m.telepayment};{$m.adminpaid};{/if}{$m.paid}{/if}{else};{$m.nb}{/if}
-
-{/foreach}
-;
-{/if}
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
+++ /dev/null
-{**************************************************************************}
-{* *}
-{* Copyright (C) 2003-2011 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,Commentaire
-{if $users|@count}
-{foreach from=$users item=user}
-
-{$user->lastName()},{$user->firstName()},{if $user->isFemale()}F{else}M{/if},{$user->promo()},{$user->group_comm|replace:',':'\,'}
-
-{/foreach}
-{/if}
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{icon name=page_excel title="Fichier Excel"}
Obtenir au format Excel
</a>
+ <small>(encodage : iso-8859-1, séparateur : point-virgule)</small>
</li>
<li>
<a href="{$platal->ns}annuaire/vcard/photos/{$asso->diminutif}.vcf">