<?php
namespace App\Controller\FrontendBundle\Ideas;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
use App\BackendBundle\Helper\SiteTitleHelper;
use App\BackendBundle\Helper\InfoSectionHelper;
use App\Entity\InfoSectionCategory;
class GuidelinesController extends AbstractController {
private $siteTitleHelper;
private $infoSectionHelper;
public function __construct(InfoSectionHelper $infosectionhelper, SiteTitleHelper $sitetitlehelper)
{
$this->infoSectionHelper = $infosectionhelper;
$this->siteTitleHelper = $sitetitlehelper;
}
/**
* @return \Symfony\Component\HttpFoundation\Response
* @Route("/leitfaeden", name="guide_ideas_list", defaults={"title": "Leitfäden zur Nutzung von berufsreise.at", "description": "Sie möchten mit berufsreise.at arbeiten und haben Fragen zur Nutzung? In unseren Leitfäden und Videotutorials finden Sie alle wichtigen Informationen."})
*/
public function listIdeasAction(Request $request) {
$this->siteTitleHelper->setTitleDescription($request);
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository(InfoSectionCategory::class)->findBy(array('sectionType' => 3), array('position'=>'ASC'));
return $this->render('@frontend/public/ideas/ideas_guidelines.html.twig', array(
'heading' => 'Leitfäden',
'categoryRoute' => 'guide_ideas_category',
'entities' => $entities
));
}
/**
* @return \Symfony\Component\HttpFoundation\Response
* @Route("/leitfaeden/{category}", name="guide_ideas_category", defaults={"title": "Leitfäden zur Nutzung von berufsreise.at", "description": "Sie möchten mit berufsreise.at arbeiten und haben Fragen zur Nutzung? In unseren Leitfäden und Videotutorials finden Sie alle wichtigen Informationen."})
*/
public function categoryAction(Request $request, $category) {
$infoSectionCategory = $this->infoSectionHelper->getInfoSectionCategoryByUrlText($category);
if (empty($infoSectionCategory)) {
throw new NotFoundHttpException("Category $category wurde nicht gefunden");
}
$this->siteTitleHelper->setInfoSectionGuidelinesCategoryTitle($request, $infoSectionCategory);
$entities = $this->infoSectionHelper->getInfoSectionSubCategoriesByCategory($infoSectionCategory);
return $this->render('@frontend/public/ideas/ideas_category.html.twig', array(
'category' => $infoSectionCategory,
'entities' => $entities
));
}
}