First version of export person - 'rfs #400

This commit is contained in:
Marc Ducobu
2015-02-18 15:47:27 +01:00
parent 0f4e285bd7
commit a7b807514b
3 changed files with 91 additions and 2 deletions

View File

@@ -118,7 +118,7 @@ class PersonController extends Controller
return $this->redirect($url);
}
}
public function searchAction()
{
$q = $this->getRequest()->query->getAlnum('q', '');
@@ -176,6 +176,26 @@ class PersonController extends Controller
'pattern' => $q
));
}
/**
* Return a csv file with all the persons
*
* @return A csv file with all the persons
*/
public function exportAction()
{
$em = $this->getDoctrine()->getManager();
$persons = $em->getRepository('ChillPersonBundle:Person')->findAll();
$response = $this->render('ChillPersonBundle:Person:export.csv.twig',
array(
'persons' => $persons,
'cf_group' => $this->getCFGroup()));
$response->headers->set('Content-Type', 'text/csv');
$response->headers->set('Content-Disposition', 'attachment; filename="export.csv"');
return $response;
}
public function newAction()
{