/** * @param Request $request * @param $name * * @return \Symfony\Component\HttpFoundation\Response */ public function indexAction(Request $request, $name) { $this->menuBuilder->getChild('training')->setCurrent(true); $certification = $this->certificationManager->getCertification($name); $response = $this->engine->renderResponse('CertificationyTrainingBundle:Session:index.html.twig', ['certification_metrics' => $certification->getMetrics()]); return $response; }
/** * @param Request $request * * @return \Knp\Menu\ItemInterface */ public function createTrainingMenu(Request $request) { $menu = $this->factory->createItem('training'); $trainingMenu = $menu->addChild('training', ['label' => $this->translator->trans('training.menu', [], 'training')]); foreach ($this->certificationManager->getCertifications() as $certificationName => $certificationLabel) { $trainingMenu->addChild($certificationName, ['route' => 'certification_guidelines', 'routeParameters' => ['name' => $certificationName], 'label' => $certificationLabel]); } return $menu; }
/** * @param CertificationManager $certificationManager */ public function addCertificationTemplateDir(CertificationManager $certificationManager) { if (!is_dir($this->baseDir)) { throw new \RuntimeException('certification-data folder not found: did you install the certifications ?'); } foreach (array_keys($certificationManager->getCertifications()) as $certificationName) { $this->loader->addPath($this->baseDir . '/' . $certificationName, $certificationName); } }
/** * @param Request $request * * @return Response */ public function footerAction(Request $request) { $response = new Response(); $response->setPublic(); $response->setSharedMaxAge(600); $response->setVary('Accept-Encoding', 'User-Agent'); return $this->engine->renderResponse('@CertificationyWeb/Site/footer.html.twig', ['trainings' => $this->certificationManager->getCertifications()]); }