mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 06:14:59 +00:00
adding remove event feature
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
|
||||
namespace Chill\EventBundle\Controller;
|
||||
|
||||
use ArrayIterator;
|
||||
use Chill\EventBundle\Entity\Event;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -31,8 +31,9 @@ use Chill\EventBundle\Security\Authorization\ParticipationVoter;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class ParticipationController
|
||||
*
|
||||
* @package Chill\EventBundle\Controller
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class ParticipationController extends Controller
|
||||
@@ -44,9 +45,9 @@ class ParticipationController extends Controller
|
||||
* This function parse the person_id / persons_ids query argument
|
||||
* and decide if it should process a single or multiple participation. Depending
|
||||
* on this, the appropriate layout and form.
|
||||
*
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
|
||||
*/
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
@@ -158,9 +159,9 @@ class ParticipationController extends Controller
|
||||
*
|
||||
* If all participations must be ignored, an error is shown and the method redirects
|
||||
* to the event 'show' view with an appropriate flash message.
|
||||
*
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
|
||||
*/
|
||||
protected function newMultiple(Request $request)
|
||||
{
|
||||
@@ -224,6 +225,10 @@ class ParticipationController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
|
||||
*/
|
||||
public function createAction(Request $request)
|
||||
{
|
||||
// test the request is correct
|
||||
@@ -257,6 +262,10 @@ class ParticipationController extends Controller
|
||||
. "'persons_ids' argument in query");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
|
||||
*/
|
||||
public function createSingle(Request $request)
|
||||
{
|
||||
$participation = $this->handleRequest($request, new Participation(), false);
|
||||
@@ -295,6 +304,10 @@ class ParticipationController extends Controller
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
|
||||
*/
|
||||
public function createMultiple(Request $request)
|
||||
{
|
||||
$participations = $this->handleRequest($request, new Participation(), true);
|
||||
@@ -431,9 +444,8 @@ class ParticipationController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $participations
|
||||
* @return type
|
||||
* @return \Symfony\Component\Form\FormInterface
|
||||
*/
|
||||
public function createCreateFormMultiple(array $participations)
|
||||
{
|
||||
@@ -491,6 +503,11 @@ class ParticipationController extends Controller
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $participation_id
|
||||
* @param Request $request
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
|
||||
*/
|
||||
public function updateAction($participation_id, Request $request)
|
||||
{
|
||||
/* @var $participation Participation */
|
||||
@@ -640,15 +657,12 @@ class ParticipationController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Doctrine\Common\Collections\Collection $participations contains object of Participation type
|
||||
* @param \Chill\EventBundle\Entity\Event $event
|
||||
* @param ArrayIterator $participations
|
||||
* @param Event $event
|
||||
* @return \Symfony\Component\Form\FormInterface
|
||||
*/
|
||||
protected function createEditFormMultiple(
|
||||
\Doctrine\Common\Collections\Collection $participations,
|
||||
\Chill\EventBundle\Entity\Event $event
|
||||
) {
|
||||
protected function createEditFormMultiple(ArrayIterator $participations, Event $event)
|
||||
{
|
||||
$form = $this->createForm(\Symfony\Component\Form\Extension\Core\Type\FormType::class,
|
||||
array('participations' => $participations), array(
|
||||
'method' => 'POST',
|
||||
@@ -710,7 +724,7 @@ class ParticipationController extends Controller
|
||||
]);
|
||||
}
|
||||
}
|
||||
return $this->render('ChillEventBundle:Event:confirm_delete.html.twig', [
|
||||
return $this->render('ChillEventBundle:Participation:confirm_delete.html.twig', [
|
||||
'event_id' => $event->getId(),
|
||||
'delete_form' => $form->createView()
|
||||
]);
|
||||
|
Reference in New Issue
Block a user