template page for list events participation by person

This commit is contained in:
Tchama 2019-01-16 16:24:09 +01:00
parent d89e440784
commit 735425f2fd
2 changed files with 48 additions and 0 deletions

View File

@ -2,6 +2,7 @@
namespace Chill\EventBundle\Controller; namespace Chill\EventBundle\Controller;
use Chill\EventBundle\Entity\Participation;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Chill\PersonBundle\Form\Type\PickPersonType; use Chill\PersonBundle\Form\Type\PickPersonType;
@ -231,5 +232,24 @@ class EventController extends Controller
*/ */
public function listByPersonAction($person_id) 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
));
} }
} }

View File

@ -0,0 +1,28 @@
{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* 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 <http://www.gnu.org/licenses/>.
#}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = 'chill_event__list_by_person' %}
{% block title %}{{ 'Events participation' |trans }}{% endblock title %}
{% block personcontent %}
<h2>{{ 'Events participation' |trans }}</h2>
hop
{{ dump() }}
{% endblock %}