mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
43 lines
1.4 KiB
PHP
43 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Chill\MainBundle\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Chill\MainBundle\Entity\User;
|
|
use Chill\MainBundle\Repository\NotificationRepository;
|
|
use Chill\MainBundle\Notification\NotificationRenderer;
|
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
|
use Symfony\Component\Security\Core\Security;
|
|
|
|
class NotificationController extends AbstractController
|
|
{
|
|
private $security;
|
|
|
|
public function __construct(Security $security)
|
|
{
|
|
$this->security = $security;
|
|
}
|
|
|
|
public function showAction(NotificationRepository $notificationRepository, NotificationRenderer $notificationRenderer)
|
|
{
|
|
$currentUser = $this->security->getUser();
|
|
|
|
$notifications = $notificationRepository->findAllForAttendee($currentUser);
|
|
|
|
$templateData = array();
|
|
foreach ($notifications as $notification) {
|
|
$data = [
|
|
'template' => $notificationRenderer->getTemplate($notification),
|
|
'template_data' => $notificationRenderer->getTemplateData($notification),
|
|
'notification' => $notification
|
|
];
|
|
$templateData[] = $data;
|
|
}
|
|
|
|
return $this->render('ChillMainBundle:Notification:show.html.twig', [
|
|
'datas' => $templateData,
|
|
'notifications' => $notifications,
|
|
]);
|
|
}
|
|
}
|