mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
privacyEvent, add event to activity list and show actions
This commit is contained in:
parent
4163f7a6fb
commit
13333ed54a
@ -22,6 +22,8 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Controller;
|
||||
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
@ -37,7 +39,22 @@ use Chill\ActivityBundle\Form\ActivityType;
|
||||
*/
|
||||
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.
|
||||
*
|
||||
@ -62,8 +79,13 @@ class ActivityController extends Controller
|
||||
array('person' => $person, 'scope' => $reachableScopes),
|
||||
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(
|
||||
'activities' => $activities,
|
||||
'person' => $person
|
||||
@ -201,7 +223,14 @@ class ActivityController extends Controller
|
||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
||||
|
||||
$deleteForm = $this->createDeleteForm($id, $person);
|
||||
|
||||
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => Activity::class,
|
||||
'element_id' => intval($id),
|
||||
'action' => 'show'
|
||||
));
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
return $this->render('ChillActivityBundle:Activity:show.html.twig', array(
|
||||
'person' => $person,
|
||||
'entity' => $entity,
|
||||
|
@ -53,6 +53,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
$loader->load('services/repositories.yml');
|
||||
$loader->load('services/fixtures.yml');
|
||||
$loader->load('services/menu.yml');
|
||||
$loader->load('services/controller.yml');
|
||||
}
|
||||
|
||||
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