mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Merge remote-tracking branch 'origin/master' into issue469_budget
This commit is contained in:
@@ -68,12 +68,14 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
}
|
||||
|
||||
if ($this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $period)) {
|
||||
$menu->addChild($this->translator->trans('Accompanying Course History'), [
|
||||
'route' => 'chill_person_accompanying_course_history',
|
||||
'routeParameters' => [
|
||||
'accompanying_period_id' => $period->getId(),
|
||||
], ])
|
||||
->setExtras(['order' => 30]);
|
||||
/*
|
||||
$menu->addChild($this->translator->trans('Accompanying Course History'), [
|
||||
'route' => 'chill_person_accompanying_course_history',
|
||||
'routeParameters' => [
|
||||
'accompanying_period_id' => $period->getId(),
|
||||
], ])
|
||||
->setExtras(['order' => 30]);
|
||||
*/
|
||||
|
||||
$menu->addChild($this->translator->trans('Accompanying Course Comment'), [
|
||||
'route' => 'chill_person_accompanying_period_comment_list',
|
||||
|
@@ -13,7 +13,9 @@ namespace Chill\PersonBundle\Menu;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Doctrine\ORM\Query\Parameter;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
@@ -22,23 +24,20 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*/
|
||||
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationCheckerInterface
|
||||
*/
|
||||
protected $authorizationChecker;
|
||||
protected AuthorizationCheckerInterface $authorizationChecker;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
protected ParameterBagInterface $parameterBag;
|
||||
|
||||
/**
|
||||
* SectionMenuBuilder constructor.
|
||||
*/
|
||||
public function __construct(AuthorizationCheckerInterface $authorizationChecker, TranslatorInterface $translator)
|
||||
public function __construct(AuthorizationCheckerInterface $authorizationChecker, TranslatorInterface $translator, ParameterBagInterface $parameterBag)
|
||||
{
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
$this->translator = $translator;
|
||||
$this->parameterBag = $parameterBag;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +45,7 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
*/
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
if ($this->authorizationChecker->isGranted(PersonVoter::CREATE)) {
|
||||
if ($this->authorizationChecker->isGranted(PersonVoter::CREATE) && $this->parameterBag->get('chill_person.create_person_allowed')) {
|
||||
$menu->addChild($this->translator->trans('Add a person'), [
|
||||
'route' => 'chill_person_new',
|
||||
])
|
||||
@@ -56,12 +55,22 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
]);
|
||||
}
|
||||
|
||||
$menu->addChild($this->translator->trans('Create an accompanying course'), [
|
||||
'route' => 'chill_person_accompanying_course_new',
|
||||
if ($this->parameterBag->get('chill_person.create_parcours_allowed')) {
|
||||
$menu->addChild($this->translator->trans('Create an accompanying course'), [
|
||||
'route' => 'chill_person_accompanying_course_new',
|
||||
])
|
||||
->setExtras([
|
||||
'order' => 11,
|
||||
'icons' => ['plus'],
|
||||
]);
|
||||
}
|
||||
|
||||
$menu->addChild($this->translator->trans('Accompanying courses of users'), [
|
||||
'route' => 'chill_course_list_reassign',
|
||||
])
|
||||
->setExtras([
|
||||
'order' => 11,
|
||||
'icons' => ['plus'],
|
||||
'order' => 12,
|
||||
'icons' => ['task'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user