diff --git a/Controller/EventController.php b/Controller/EventController.php index 986efc24d..474e2b14b 100644 --- a/Controller/EventController.php +++ b/Controller/EventController.php @@ -2,6 +2,7 @@ namespace Chill\EventBundle\Controller; +use Chill\EventBundle\Entity\Participation; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Chill\PersonBundle\Form\Type\PickPersonType; @@ -231,5 +232,24 @@ class EventController extends Controller */ public function listByPersonAction($person_id) { + $em = $this->getDoctrine()->getManager(); + + $person = $em->getRepository('ChillPersonBundle:Person')->find($person_id); + + if ($person === NULL) { + throw $this->createNotFoundException('Person not found'); + } + + $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person); + + $participations = $em->getRepository('ChillEventBundle:Participation') + ->findBy( + array('person' => $person) + ); + + return $this->render('ChillEventBundle:Event:listByPerson.html.twig', array( + 'participations' => $participations, + 'person' => $person + )); } } diff --git a/Resources/views/Event/listByPerson.html.twig b/Resources/views/Event/listByPerson.html.twig new file mode 100644 index 000000000..dc5b21706 --- /dev/null +++ b/Resources/views/Event/listByPerson.html.twig @@ -0,0 +1,28 @@ +{# + * Copyright (C) 2014, Champs Libres Cooperative SCRLFS, + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . +#} +{% extends "ChillPersonBundle::layout.html.twig" %} + + +{% set activeRouteKey = 'chill_event__list_by_person' %} + +{% block title %}{{ 'Events participation' |trans }}{% endblock title %} + +{% block personcontent %} +

{{ 'Events participation' |trans }}

+hop + {{ dump() }} +{% endblock %} \ No newline at end of file