mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
[Aside activity] Temporarily remove the link to aside activities
This commit is contained in:
parent
d652771af0
commit
9a1f56a820
@ -28,36 +28,36 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
|||||||
use Chill\TaskBundle\Security\Authorization\TaskVoter;
|
use Chill\TaskBundle\Security\Authorization\TaskVoter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
*/
|
*/
|
||||||
class UserMenuBuilder implements LocalMenuBuilderInterface
|
class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var CountNotificationTask
|
* @var CountNotificationTask
|
||||||
*/
|
*/
|
||||||
public $counter;
|
public $counter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @var TokenStorageInterface
|
* @var TokenStorageInterface
|
||||||
*/
|
*/
|
||||||
public $tokenStorage;
|
public $tokenStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var TranslatorInterface
|
* @var TranslatorInterface
|
||||||
*/
|
*/
|
||||||
public $translator;
|
public $translator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var AuthorizationCheckerInterface
|
* @var AuthorizationCheckerInterface
|
||||||
*/
|
*/
|
||||||
public $authorizationChecker;
|
public $authorizationChecker;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
CountNotificationTask $counter,
|
CountNotificationTask $counter,
|
||||||
TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
@ -69,44 +69,44 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->authorizationChecker = $authorizationChecker;
|
$this->authorizationChecker = $authorizationChecker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getMenuIds(): array
|
public static function getMenuIds(): array
|
||||||
{
|
{
|
||||||
return [ 'user' ];
|
return [ 'user' ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
{
|
{
|
||||||
if (FALSE === $this->authorizationChecker->isGranted(TaskVoter::SHOW)) {
|
if (FALSE === $this->authorizationChecker->isGranted(TaskVoter::SHOW)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->tokenStorage->getToken()->getUser();
|
$user = $this->tokenStorage->getToken()->getUser();
|
||||||
$ended = $this->counter->countNotificationEnded($user);
|
$ended = $this->counter->countNotificationEnded($user);
|
||||||
$warning = $this->counter->countNotificationWarning($user);
|
$warning = $this->counter->countNotificationWarning($user);
|
||||||
|
|
||||||
if ($ended > 0) {
|
if ($ended > 0) {
|
||||||
$this->addItemInMenu(
|
$this->addItemInMenu(
|
||||||
$menu,
|
$menu,
|
||||||
$user,
|
$user,
|
||||||
'%number% tasks over deadline',
|
'%number% tasks over deadline',
|
||||||
'My tasks over deadline',
|
'My tasks over deadline',
|
||||||
SingleTaskRepository::DATE_STATUS_ENDED,
|
SingleTaskRepository::DATE_STATUS_ENDED,
|
||||||
$ended,
|
$ended,
|
||||||
-15);
|
-15);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($warning > 0) {
|
if ($warning > 0) {
|
||||||
$this->addItemInMenu(
|
$this->addItemInMenu(
|
||||||
$menu,
|
$menu,
|
||||||
$user,
|
$user,
|
||||||
'%number% tasks near deadline',
|
'%number% tasks near deadline',
|
||||||
'My tasks near deadline',
|
'My tasks near deadline',
|
||||||
SingleTaskRepository::DATE_STATUS_WARNING,
|
SingleTaskRepository::DATE_STATUS_WARNING,
|
||||||
$warning,
|
$warning,
|
||||||
-14);
|
-14);
|
||||||
}
|
}
|
||||||
|
|
||||||
$menu->addChild("My tasks", [
|
$menu->addChild("My tasks", [
|
||||||
'route' => 'chill_task_single_my_tasks'
|
'route' => 'chill_task_single_my_tasks'
|
||||||
])
|
])
|
||||||
@ -115,6 +115,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
'icon' => 'tasks'
|
'icon' => 'tasks'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/*
|
||||||
$menu->addChild("My aside activities", [
|
$menu->addChild("My aside activities", [
|
||||||
'route' => 'chill_crud_aside_activity_index'
|
'route' => 'chill_crud_aside_activity_index'
|
||||||
])
|
])
|
||||||
@ -122,13 +123,14 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
'order' => -10,
|
'order' => -10,
|
||||||
'icon' => 'tasks'
|
'icon' => 'tasks'
|
||||||
]);
|
]);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addItemInMenu(MenuItem $menu, User $u, $message, $title, $status, $number, $order)
|
protected function addItemInMenu(MenuItem $menu, User $u, $message, $title, $status, $number, $order)
|
||||||
{
|
{
|
||||||
if ($number > 0) {
|
if ($number > 0) {
|
||||||
$menu->addChild(
|
$menu->addChild(
|
||||||
$this->translator->transChoice($message, $number),
|
$this->translator->transChoice($message, $number),
|
||||||
[
|
[
|
||||||
'route' => 'chill_task_singletask_list',
|
'route' => 'chill_task_singletask_list',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user