mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
add ListPerson
Add / complete list of person. Some SQL function are added to allow to get the last address at a given date.
This commit is contained in:
@@ -130,36 +130,6 @@ class PersonController extends Controller
|
||||
return $this->redirect($url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a csv file with all the persons
|
||||
*
|
||||
* @return A csv file with all the persons
|
||||
*/
|
||||
public function exportAction()
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$chillSecurityHelper = $this->get('chill.main.security.authorization.helper');
|
||||
$user = $this->get('security.context')->getToken()->getUser();
|
||||
|
||||
$reachableCenters = $chillSecurityHelper->getReachableCenters($user,
|
||||
new Role('CHILL_PERSON_SEE'));
|
||||
|
||||
$personRepository = $em->getRepository('ChillPersonBundle:Person');
|
||||
$qb = $personRepository->createQueryBuilder('p');
|
||||
$qb->where($qb->expr()->in('p.center', ':centers'))
|
||||
->setParameter('centers', $reachableCenters);
|
||||
$persons = $qb->getQuery()->getResult();
|
||||
|
||||
$response = $this->render('ChillPersonBundle:Person:export.csv.twig',
|
||||
array(
|
||||
'persons' => $persons,
|
||||
'cf_group' => $this->getCFGroup()));
|
||||
$response->headers->set('Content-Type', 'text/csv; charset=utf-8');
|
||||
$response->headers->set('Content-Disposition', 'attachment; filename="export_person.csv"');
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function newAction()
|
||||
{
|
||||
|
Reference in New Issue
Block a user