csv export by type

parent 0e1470b0
......@@ -337,6 +337,16 @@ return function (App $app) {
return $res->withRedirect($router->pathFor('index'));
}
$config = $c['csv_export_config'];
if (!array_key_exists($type, $config)) {
return $res->withStatus(404);
}
$typeConfig = $config[$type];
$csvResponse = $c['csv_export_csv_response'];
return $csvResponse($res, $c[$typeConfig['data_callback']], $typeConfig['headers'], 'edulabs_' . $type . '.csv');
})->setName('export.csv');
});
};
<?php
/**
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
return function (Slim\App $app) {
$container = $app->getContainer();
$events = $container['events'];
$events('on', 'app.bootstrap', function (Slim\App $app, Slim\Container $c) {
});
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment