267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
protected function export()
{
$db = DB::getInstance();
$champs = Config::getInstance()->get('champs_membres')->getKeys();
$champs_sql = 'm.' . implode(', m.', $champs);
$res = $db->prepare('SELECT ' . $champs_sql . ', c.nom AS categorie FROM membres AS m
LEFT JOIN membres_categories AS c ON m.id_categorie = c.id ORDER BY c.id;')->execute();
return [array_merge($champs, ['categorie']), $res];
}
public function toCSV()
{
list($champs, $result) = $this->export();
$fp = fopen('php://output', 'w');
|
|
|
>
|
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
|
protected function export()
{
$db = DB::getInstance();
$champs = Config::getInstance()->get('champs_membres')->getKeys();
$champs_sql = 'm.' . implode(', m.', $champs);
$res = $db->prepare('SELECT ' . $champs_sql . ', c.nom AS categorie_membre FROM membres AS m
LEFT JOIN membres_categories AS c ON m.id_categorie = c.id ORDER BY c.id;')->execute();
$champs[] = 'categorie_membre';
return [$champs, $res];
}
public function toCSV()
{
list($champs, $result) = $this->export();
$fp = fopen('php://output', 'w');
|