mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
74 lines
2.1 KiB
PHP
74 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace Chill\PersonBundle\Menu;
|
|
|
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
use Knp\Menu\MenuItem;
|
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
|
|
/**
|
|
* Class AccompanyingCourseMenuBuilder
|
|
*
|
|
* @package Chill\PersonBundle\Menu
|
|
* @author mathieu.jaumotte@champs-libres.coop
|
|
*/
|
|
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
|
{
|
|
|
|
/**
|
|
* @var TranslatorInterface
|
|
*/
|
|
protected $translator;
|
|
|
|
public function __construct(TranslatorInterface $translator)
|
|
{
|
|
$this->translator = $translator;
|
|
}
|
|
|
|
public static function getMenuIds(): array
|
|
{
|
|
return [ 'accompanyingCourse' ];
|
|
}
|
|
|
|
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
|
{
|
|
$period = $parameters['accompanyingCourse'];
|
|
|
|
$menu->addChild($this->translator->trans('Resume Accompanying Course'), [
|
|
'route' => 'chill_person_accompanying_course_index',
|
|
'routeParameters' => [
|
|
'accompanying_period_id' => $period->getId()
|
|
]])
|
|
->setExtras(['order' => 10]);
|
|
|
|
$menu->addChild($this->translator->trans('Edit Accompanying Course'), [
|
|
'route' => 'chill_person_accompanying_course_edit',
|
|
'routeParameters' => [
|
|
'accompanying_period_id' => $period->getId()
|
|
]])
|
|
->setExtras(['order' => 20]);
|
|
|
|
if (AccompanyingPeriod::STEP_DRAFT === $period->getStep()) {
|
|
// no more menu items if the period is draft
|
|
return;
|
|
}
|
|
|
|
$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 Action'), [
|
|
'route' => 'chill_person_accompanying_period_work_list',
|
|
'routeParameters' => [
|
|
'id' => $period->getId()
|
|
]])
|
|
->setExtras(['order' => 50]);
|
|
}
|
|
|
|
|
|
}
|