mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'master' into stable
This commit is contained in:
commit
9cbd6b6987
@ -12,3 +12,8 @@ Version 1.5.2
|
|||||||
- fix error when persons not loaded by other aggregators / filters
|
- fix error when persons not loaded by other aggregators / filters
|
||||||
- add "filter by activity type" filter
|
- add "filter by activity type" filter
|
||||||
|
|
||||||
|
Version 1.5.3
|
||||||
|
=============
|
||||||
|
|
||||||
|
- add privacy events to activity list / show / edit
|
||||||
|
|
||||||
|
@ -22,11 +22,12 @@
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Controller;
|
namespace Chill\ActivityBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\ActivityBundle\Form\ActivityType;
|
use Chill\ActivityBundle\Form\ActivityType;
|
||||||
@ -37,7 +38,22 @@ use Chill\ActivityBundle\Form\ActivityType;
|
|||||||
*/
|
*/
|
||||||
class ActivityController extends Controller
|
class ActivityController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var EventDispatcherInterface
|
||||||
|
*/
|
||||||
|
protected $eventDispatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ActivityController constructor.
|
||||||
|
*
|
||||||
|
* @param EventDispatcherInterface $eventDispatcher
|
||||||
|
*/
|
||||||
|
public function __construct(EventDispatcherInterface $eventDispatcher)
|
||||||
|
{
|
||||||
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all Activity entities.
|
* Lists all Activity entities.
|
||||||
*
|
*
|
||||||
@ -62,8 +78,13 @@ class ActivityController extends Controller
|
|||||||
array('person' => $person, 'scope' => $reachableScopes),
|
array('person' => $person, 'scope' => $reachableScopes),
|
||||||
array('date' => 'DESC')
|
array('date' => 'DESC')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$event = new PrivacyEvent($person, array(
|
||||||
|
'element_class' => Activity::class,
|
||||||
|
'action' => 'list'
|
||||||
|
));
|
||||||
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:list.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:list.html.twig', array(
|
||||||
'activities' => $activities,
|
'activities' => $activities,
|
||||||
'person' => $person
|
'person' => $person
|
||||||
@ -201,7 +222,14 @@ class ActivityController extends Controller
|
|||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id, $person);
|
$deleteForm = $this->createDeleteForm($id, $person);
|
||||||
|
|
||||||
|
$event = new PrivacyEvent($person, array(
|
||||||
|
'element_class' => Activity::class,
|
||||||
|
'element_id' => $entity->getId(),
|
||||||
|
'action' => 'show'
|
||||||
|
));
|
||||||
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:show.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:show.html.twig', array(
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
@ -234,6 +262,13 @@ class ActivityController extends Controller
|
|||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
$editForm = $this->createEditForm($entity);
|
||||||
$deleteForm = $this->createDeleteForm($id, $person);
|
$deleteForm = $this->createDeleteForm($id, $person);
|
||||||
|
|
||||||
|
$event = new PrivacyEvent($person, array(
|
||||||
|
'element_class' => Activity::class,
|
||||||
|
'element_id' => $entity->getId(),
|
||||||
|
'action' => 'edit'
|
||||||
|
));
|
||||||
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:edit.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:edit.html.twig', array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
@ -285,6 +320,13 @@ class ActivityController extends Controller
|
|||||||
$deleteForm = $this->createDeleteForm($id, $person);
|
$deleteForm = $this->createDeleteForm($id, $person);
|
||||||
$editForm = $this->createEditForm($entity);
|
$editForm = $this->createEditForm($entity);
|
||||||
$editForm->handleRequest($request);
|
$editForm->handleRequest($request);
|
||||||
|
|
||||||
|
$event = new PrivacyEvent($person, array(
|
||||||
|
'element_class' => Activity::class,
|
||||||
|
'element_id' => $entity->getId(),
|
||||||
|
'action' => 'update'
|
||||||
|
));
|
||||||
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
|
||||||
if ($editForm->isValid()) {
|
if ($editForm->isValid()) {
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
@ -53,6 +53,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
|||||||
$loader->load('services/repositories.yml');
|
$loader->load('services/repositories.yml');
|
||||||
$loader->load('services/fixtures.yml');
|
$loader->load('services/fixtures.yml');
|
||||||
$loader->load('services/menu.yml');
|
$loader->load('services/menu.yml');
|
||||||
|
$loader->load('services/controller.yml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepend(ContainerBuilder $container)
|
public function prepend(ContainerBuilder $container)
|
||||||
|
5
Resources/config/services/controller.yml
Normal file
5
Resources/config/services/controller.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
services:
|
||||||
|
Chill\ActivityBundle\Controller\ActivityController:
|
||||||
|
arguments:
|
||||||
|
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||||
|
tags: ['controller.service_arguments']
|
Loading…
x
Reference in New Issue
Block a user