createRootElement(); $menu->addChild('Dashboard', [ 'route' => 'app_teamer_index', 'linkAttributes' => [ 'title' => 'Dashboard', ], 'extras' => [ 'icon' => 'chart', ], ]); $menu->addChild('Einsatzübersicht', [ 'route' => 'app_teamer_assignment_index', 'linkAttributes' => [ 'title' => 'Einsatzübersicht', ], 'extras' => [ 'icon' => 'calendar', 'routes' => [ ['pattern' => '/^app_teamer_assignment_/'], ], ], ]); $profileMenu = $menu->addChild('Mein Profil', [ 'extras' => [ 'icon' => 'profile', ], ]); // Season teamers only, and on the flag rather than on a current assignment: a month // still has to be reachable after the season it belongs to has ended. if (true === $this->isSeasonTeamer()) { $profileMenu->addChild('Arbeitszeiten', [ 'route' => 'app_teamer_work_month_index', 'linkAttributes' => [ 'title' => 'Arbeitszeiten', ], 'extras' => [ 'routes' => [ ['pattern' => '/^app_teamer_work_month_/'], ], ], ]); } $profileMenu->addChild('Stammdaten & Foto', [ 'route' => 'app_teamer_profile_index', 'linkAttributes' => [ 'title' => 'Stammdaten & Foto', ], ]); $profileMenu->addChild('Jobprofile & Skills', [ 'route' => 'app_teamer_profile_skills', 'linkAttributes' => [ 'title' => 'Jobprofile & Skills', ], ]); $profileMenu->addChild('Meine Verfügbarkeit', [ 'route' => 'app_teamer_profile_availability_index', 'linkAttributes' => [ 'title' => 'Meine Verfügbarkeit', ], ]); $dispositionMenu = $menu->addChild('Meine Einsätze', [ 'extras' => [ 'icon' => 'bus', ], ]); // Only for an all-season teamer who actually has an assignment this season: the page // would have nothing to show otherwise, and it throws a 404 in exactly that case. if (null !== $this->resolveSeasonAssignment()) { $dispositionMenu->addChild('Saison-Einsatz', [ 'route' => 'app_teamer_season_index', 'linkAttributes' => [ 'title' => 'Saison-Einsatz', ], 'extras' => [ 'routes' => [ ['pattern' => '/^app_teamer_season_/'], ], ], ]); } $dispositionMenu->addChild('Merkliste', [ 'route' => 'app_teamer_bookmark_index', 'linkAttributes' => [ 'title' => 'Merkliste', ], ]); $dispositionMenu->addChild('Offene Bewerbungen', [ 'route' => 'app_teamer_application_index', 'linkAttributes' => [ 'title' => 'Offene Bewerbungen', ], ]); $dispositionMenu->addChild('Nächste Einsätze', [ 'route' => 'app_teamer_disposition_upcoming', 'linkAttributes' => [ 'title' => 'Nächste Einsätze', ], ]); $dispositionMenu->addChild('Letzte Einsätze', [ 'route' => 'app_teamer_disposition_recent', 'linkAttributes' => [ 'title' => 'Letzte Einsätze', ], // the questionnaire after a past placement 'extras' => [ 'routes' => [ ['pattern' => '/^app_teamer_questionnaire_/'], ], ], ]); $menu->addChild('Dokumente', [ 'route' => 'app_teamer_document', 'linkAttributes' => [ 'title' => 'Dokumente', ], 'extras' => [ 'icon' => 'document', ], ]); $infoMenu = $menu->addChild('FAQ & Kontakt', [ 'extras' => [ 'icon' => 'info', ], ]); $infoMenu->addChild('FAQ', [ 'route' => 'app_teamer_faq', 'linkAttributes' => [ 'title' => 'FAQ', ], ]); $infoMenu->addChild('Kontakt', [ 'route' => 'app_teamer_contact', 'linkAttributes' => [ 'title' => 'Kontakt', ], ]); $this->addAdminItem($menu); $this->addManagerItem($menu); $this->addHouseManagerItem($menu); $this->addLogoutItem($menu); return $menu; } private function isSeasonTeamer(): bool { $user = $this->security->getUser(); return $user instanceof User && true === $user->getTeamer()?->isAllSeason(); } private function resolveSeasonAssignment(): ?SeasonAssignment { $user = $this->security->getUser(); if (false === $user instanceof User || null === $teamer = $user->getTeamer()) { return null; } return $this->seasonAssignmentResolver->resolveFor($teamer); } }