mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
37 lines
945 B
PHP
37 lines
945 B
PHP
<?php
|
|
/**
|
|
* Export TFE listings as CSV.
|
|
*
|
|
* Thin dispatcher — delegates all data assembly to ExportController,
|
|
* then streams the response.
|
|
*/
|
|
require_once __DIR__ . "/../../../bootstrap.php";
|
|
require_once __DIR__ . '/../../../src/AdminAuth.php';
|
|
AdminAuth::requireLogin();
|
|
|
|
require_once APP_ROOT . '/src/Controllers/ExportController.php';
|
|
$controller = ExportController::create();
|
|
|
|
$filename = 'posterg-export-' . date('Y-m-d') . '.csv';
|
|
|
|
header('Content-Type: text/csv; charset=UTF-8');
|
|
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
|
header('Cache-Control: no-cache, must-revalidate');
|
|
|
|
// UTF-8 BOM for Excel compatibility
|
|
echo "\xEF\xBB\xBF";
|
|
|
|
$out = fopen('php://output', 'w');
|
|
|
|
// Column headers
|
|
fputcsv($out, ExportController::CSV_HEADERS, ',', '"', '');
|
|
|
|
// Data rows
|
|
$rows = $controller->exportAllTheses();
|
|
foreach ($rows as $csvLine) {
|
|
fputcsv($out, $csvLine, ',', '"', '');
|
|
}
|
|
|
|
fclose($out);
|
|
exit;
|