mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'privacyEvent'
This commit is contained in:
commit
73ef9e1f8e
@ -18,7 +18,13 @@ Version 1.5.5
|
||||
- Fix error on the "see more" link which was not showed
|
||||
- Layout of the task list
|
||||
|
||||
Version 1.5.6
|
||||
=============
|
||||
|
||||
- fix: validation error on warning date interval is not shown
|
||||
- add privacy events to task show / list;
|
||||
- add privacy events to task edit / update;
|
||||
|
||||
branch `master`
|
||||
==============
|
||||
|
||||
- fix: validation error on warning date interval is not shown
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Chill\TaskBundle\Controller;
|
||||
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
@ -30,7 +31,23 @@ use Chill\MainBundle\Repository\CenterRepository;
|
||||
|
||||
class SingleTaskController extends Controller
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
|
||||
/**
|
||||
* SingleTaskController constructor.
|
||||
*
|
||||
* @param EventDispatcherInterface $eventDispatcher
|
||||
*/
|
||||
public function __construct(EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/new",
|
||||
@ -39,7 +56,6 @@ class SingleTaskController extends Controller
|
||||
*/
|
||||
public function newAction(
|
||||
Request $request,
|
||||
EventDispatcherInterface $dispatcher,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
|
||||
@ -78,7 +94,7 @@ class SingleTaskController extends Controller
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($task);
|
||||
|
||||
$dispatcher->dispatch(TaskEvent::PERSIST, new TaskEvent($task));
|
||||
$this->eventDispatcher->dispatch(TaskEvent::PERSIST, new TaskEvent($task));
|
||||
|
||||
$em->flush();
|
||||
|
||||
@ -137,7 +153,14 @@ class SingleTaskController extends Controller
|
||||
|
||||
$timeline = $this->get('chill.main.timeline_builder')
|
||||
->getTimelineHTML('task', array('task' => $task));
|
||||
|
||||
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => SingleTask::class,
|
||||
'element_id' => $task->getId(),
|
||||
'action' => 'show'
|
||||
));
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
return $this->render('ChillTaskBundle:SingleTask:show.html.twig', array(
|
||||
'task' => $task,
|
||||
'timeline' => $timeline
|
||||
@ -154,8 +177,7 @@ class SingleTaskController extends Controller
|
||||
public function editAction(
|
||||
Request $request,
|
||||
$id,
|
||||
TranslatorInterface $translator,
|
||||
EventDispatcherInterface $dispatcher
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
/* @var $taskRepository SingleTaskRepository */
|
||||
$taskRepository = $this->get('chill_task.single_task_repository');
|
||||
@ -187,7 +209,7 @@ class SingleTaskController extends Controller
|
||||
->setForm($this->setCreateForm($task, new Role(TaskVoter::UPDATE)))
|
||||
;
|
||||
|
||||
$dispatcher->dispatch(UIEvent::EDIT_FORM, $event);
|
||||
$this->eventDispatcher->dispatch(UIEvent::EDIT_FORM, $event);
|
||||
|
||||
$form = $event->getForm();
|
||||
|
||||
@ -202,6 +224,13 @@ class SingleTaskController extends Controller
|
||||
|
||||
$this->addFlash('success', $translator
|
||||
->trans("The task has been updated"));
|
||||
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => SingleTask::class,
|
||||
'element_id' => $task->getId(),
|
||||
'action' => 'update'
|
||||
));
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
return $this->redirectToRoute(
|
||||
'chill_task_singletask_list',
|
||||
@ -213,12 +242,19 @@ class SingleTaskController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$dispatcher->dispatch(UIEvent::EDIT_PAGE, $event);
|
||||
$this->eventDispatcher->dispatch(UIEvent::EDIT_PAGE, $event);
|
||||
|
||||
if ($event->hasResponse()) {
|
||||
return $event->getResponse();
|
||||
}
|
||||
|
||||
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => SingleTask::class,
|
||||
'element_id' => $task->getId(),
|
||||
'action' => 'edit'
|
||||
));
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
return $this->render('ChillTaskBundle:SingleTask:edit.html.twig', array(
|
||||
'task' => $task,
|
||||
'form' => $form->createView()
|
||||
@ -503,6 +539,12 @@ class SingleTaskController extends Controller
|
||||
]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => SingleTask::class,
|
||||
'action' => 'list'
|
||||
));
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
return $this->render('ChillTaskBundle:SingleTask:index.html.twig',
|
||||
\array_merge($viewParams, [ 'form' => $form->createView() ]));
|
||||
|
@ -2,3 +2,8 @@ services:
|
||||
Chill\TaskBundle\Controller\:
|
||||
resource: '../../../Controller'
|
||||
tags: ['controller.service_arguments']
|
||||
|
||||
Chill\TaskBundle\Controller\SingleTaskController:
|
||||
arguments:
|
||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||
tags: ['controller.service_arguments']
|
||||
|
Loading…
x
Reference in New Issue
Block a user