mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
improve script for downloading exports
This commit is contained in:
@@ -412,9 +412,29 @@ class ExportController extends Controller
|
||||
}
|
||||
|
||||
public function downloadResultAction(Request $request, $alias)
|
||||
{
|
||||
return $this->render("ChillMainBundle:Export:download.html.twig", [
|
||||
{
|
||||
/* @var $exportManager \Chill\MainBundle\Export\ExportManager */
|
||||
$exportManager = $this->get('chill.main.export_manager');
|
||||
$formCenters = $this->createCreateFormExport($alias, 'generate_centers');
|
||||
$formCenters->handleRequest($request);
|
||||
$dataCenters = $formCenters->getData();
|
||||
|
||||
$formExport = $this->createCreateFormExport($alias, 'generate_export', $dataCenters);
|
||||
$formExport->handleRequest($request);
|
||||
$dataExport = $formExport->getData();
|
||||
dump($dataExport);
|
||||
$formatterAlias = $exportManager->getFormatterAlias($dataExport['export']);
|
||||
$formater = $exportManager->getFormatter($formatterAlias);
|
||||
|
||||
$viewVariables = [
|
||||
'alias' => $alias
|
||||
]);
|
||||
];
|
||||
|
||||
if ($formater instanceof \Chill\MainBundle\Export\Formatter\CSVListFormatter) {
|
||||
// due to a bug in php, we add the mime type in the download view
|
||||
$viewVariables['mime_type'] = 'text/csv';
|
||||
}
|
||||
|
||||
return $this->render("ChillMainBundle:Export:download.html.twig", $viewVariables);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user