add export button, route and controller method

This commit is contained in:
Tchama 2019-07-17 11:53:56 +02:00
parent ad45e71051
commit c26b4f1ae7
4 changed files with 30 additions and 0 deletions

View File

@ -25,6 +25,7 @@ namespace Chill\EventBundle\Controller;
use Chill\EventBundle\Entity\Participation;
use Chill\EventBundle\Form\Type\PickEventType;
use Chill\EventBundle\Repository\ParticipationRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Chill\EventBundle\Security\Authorization\EventVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\PersonBundle\Entity\Person;
@ -442,6 +443,24 @@ class EventController extends Controller
return $builder->getForm();
}
/**
* @paramConverter("event", options={"id" = "event_id"})
* @param Event $event
* @return \Symfony\Component\HttpFoundation\Response
*/
public function exportParticipationsAction(Event $event)
{
dump($event);
return $this->render('ChillEventBundle:Event:exportParticipations.html.twig', [
'event' => $event,
]);
}
// pour aller plus loin
// TODO ?? inclure le type d'événement et la date dans les résultats de recherche (ex: on tape 'vis' --> il affiche les visites )
// TODO ?? exclure des résultats les événement déjà sélectionnés pour une personne. empêcher d'inscrire 2x une personne !

View File

@ -40,3 +40,10 @@ chill_event__list_by_person:
path: /{person_id}/list
defaults: { _controller: "ChillEventBundle:Event:listByPerson" }
methods: [ GET ]
chill_event__event_export_participations:
path: /{event_id}/export/participations
defaults: { _controller: "ChillEventBundle:Event:exportParticipations" }
requirements:
event_id: \d+
methods: [ GET ]

View File

@ -0,0 +1,3 @@
{% for participation in event.participations %}
{{ dump(participation.person.firstname ~ ' ' ~ participation.person.lastname) }}
{% endfor %}

View File

@ -104,6 +104,7 @@
<ul class="record_actions">
{% if count > 0 %}
<li><a href="{{ path('chill_event__event_export_participations', { 'event_id' : event.id } ) }}" class="sc-button btn-download">{{ 'Export participation list'|trans }}</a></li>
<li><a href="{{ path('chill_event_participation_edit_multiple', { 'event_id' : event.id } ) }}" class="sc-button bt-edit">{{ 'Edit all the participations'|trans }}</a></li>
{% endif %}
</ul>