mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
Menu entry added in PersonMenuBuilder of taskbundle. Removed from menubuilder in Personbundle. Rename file, PersonMenuBuilder to MenuBuilder?
This commit is contained in:
parent
b28b4e5fba
commit
b1dbd8b011
@ -67,13 +67,6 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
'id' => $period->getId()
|
'id' => $period->getId()
|
||||||
]])
|
]])
|
||||||
->setExtras(['order' => 40]);
|
->setExtras(['order' => 40]);
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('Tasks'), [
|
|
||||||
'route' => 'chill_task_singletask_list',
|
|
||||||
'routeParameters' => [
|
|
||||||
'course_id' => $period->getId()
|
|
||||||
]])
|
|
||||||
->setExtras(['order' => 50]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,28 +53,55 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
{
|
{
|
||||||
/* @var $person \Chill\PersonBundle\Entity\Person */
|
switch($menuId) {
|
||||||
|
case 'person':
|
||||||
|
$this->buildPersonMenu($menu, $parameters);
|
||||||
|
break;
|
||||||
|
case 'accompanyingCourse':
|
||||||
|
$this->buildAccompanyingCourseMenu($menu, $parameters);
|
||||||
|
break;
|
||||||
|
case 'section':
|
||||||
|
$menu->setExtras('icons', 'tasks');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new \LogicException("this menuid $menuId is not implemented");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildPersonMenu($menu, $parameters){
|
||||||
|
|
||||||
|
//var $person \Chill\PersonBundle\Entity\Person */
|
||||||
$person = $parameters['person'] ?? null;
|
$person = $parameters['person'] ?? null;
|
||||||
|
|
||||||
if ($this->authorizationChecker->isGranted(TaskVoter::SHOW, $person)) {
|
if ($this->authorizationChecker->isGranted(TaskVoter::SHOW, $person)) {
|
||||||
$menu->addChild(
|
$menu->addChild(
|
||||||
$this->translator->trans('Tasks'), [
|
$this->translator->trans('Tasks'), [
|
||||||
'route' => 'chill_task_singletask_list',
|
'route' => 'chill_task_singletask_list',
|
||||||
'routeParameters' => $menuId === 'person' ?
|
'routeParameters' =>
|
||||||
[ 'person_id' => $person->getId() ]
|
[ 'person_id' => $person->getId() ]
|
||||||
:
|
])
|
||||||
null,
|
->setExtra('order', 400);
|
||||||
])
|
|
||||||
->setExtra('order', 400)
|
|
||||||
;
|
|
||||||
if ($menuId === 'section') {
|
|
||||||
$menu->setExtra('icons', 'tasks');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function buildAccompanyingCourseMenu($menu, $parameters){
|
||||||
|
|
||||||
|
//var $person \Chill\PersonBundle\Entity\Person */
|
||||||
|
$course = $parameters['accompanyingCourse'];
|
||||||
|
|
||||||
|
// if ($this->authorizationChecker->isGranted(TaskVoter::SHOW, $course)) {
|
||||||
|
$menu->addChild(
|
||||||
|
$this->translator->trans('Tasks'), [
|
||||||
|
'route' => 'chill_task_singletask_list',
|
||||||
|
'routeParameters' =>
|
||||||
|
[ 'course_id' => $course->getId() ]
|
||||||
|
])
|
||||||
|
->setExtra('order', 400);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
public static function getMenuIds(): array
|
public static function getMenuIds(): array
|
||||||
{
|
{
|
||||||
return ['person'];
|
return ['person', 'accompanyingCourse'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user