src/Controller/Front/HomeController.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Front;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use App\Repository\PageRepository;
  7. use App\Repository\SectionRepository;
  8. use App\Repository\NewsItemRepository;
  9. use App\Entity\Page;
  10. use App\Entity\Section;
  11. use App\Entity\NewsItem;
  12. use Symfony\Component\HttpFoundation\Response;
  13. class HomeController extends AbstractController
  14. {
  15.     
  16.     /**
  17.      * @Route("/")
  18.      */
  19.     public function home(Request $request,PageRepository $pageRepositorySectionRepository $sectionRepositoryNewsItemRepository $newsItemRepository )
  20.     {
  21.       
  22.       $home $pageRepository->findOneBy(["slug"=>"index"],[]);
  23.       $content $sectionRepository->findBy(["page"=>$home->getId()], ["customOrder"=>"ASC"]);
  24.       $latestNews $newsItemRepository->findByHomeResume();
  25.       $contestAnnouncement $newsItemRepository->findContestAndAnnouncementResume();
  26.       return $this->render('front/home.html.twig', ["content" => $content"latestNews" => $latestNews"contestAnnouncement" => $contestAnnouncement]);
  27.     }
  28.     
  29.     /**
  30.      * @Route("/indices/indice/transparencia")
  31.      */
  32.     public function transparencyIndex(Request $request,PageRepository $pageRepositorySectionRepository $sectionRepository)
  33.     {
  34.         $page $pageRepository->findOneBy(["slug"=>"indices/indice/transparencia"],[]);
  35.         $content $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
  36.   
  37.         return $this->render('front/index/transparencyIndex.html.twig', ["content" => $content]);
  38.     }
  39.     
  40.     /**
  41.      * @Route("/indices/indice/estudios")
  42.      */
  43.     public function studiesIndex(Request $request,PageRepository $pageRepositorySectionRepository $sectionRepository)
  44.     {
  45.         $page $pageRepository->findOneBy(["slug"=>"indices/indice/estudios"],[]);
  46.         $content $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
  47.   
  48.         return $this->render('front/index/studiesIndex.html.twig', ["content" => $content]);
  49.     }
  50.     
  51.     /**
  52.      * @Route("/indices/indice/alumnos")
  53.      */
  54.     public function studentsIndex(Request $request,PageRepository $pageRepositorySectionRepository $sectionRepository)
  55.     {
  56.         $page $pageRepository->findOneBy(["slug"=>"indices/indice/alumnos"],[]);
  57.         $content $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
  58.   
  59.         return $this->render('front/index/studentsIndex.html.twig', ["content" => $content]);
  60.     }
  61.     
  62.     /**
  63.      * @Route("/indices/indice/investigacion")
  64.      */
  65.     public function investigationIndex(Request $request,PageRepository $pageRepositorySectionRepository $sectionRepository)
  66.     {
  67.         $page $pageRepository->findOneBy(["slug"=>"indices/indice/investigacion"],[]);
  68.         $content $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
  69.   
  70.         return $this->render('front/index/investigationIndex.html.twig', ["content" => $content]);
  71.     }
  72.     
  73.     /**
  74.      * @Route("/indices/indice/calidad")
  75.      */
  76.     public function qualityIndex(Request $request,PageRepository $pageRepositorySectionRepository $sectionRepository)
  77.     {
  78.         $page $pageRepository->findOneBy(["slug"=>"indices/indice/calidad"],[]);
  79.         $content $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
  80.   
  81.         return $this->render('front/index/qualityIndex.html.twig', ["content" => $content]);
  82.     }
  83.     
  84.     /**
  85.      * @Route("/indices/indice/biblioteca")
  86.      */
  87.     public function libraryIndex(Request $request,PageRepository $pageRepositorySectionRepository $sectionRepository)
  88.     {
  89.         $page $pageRepository->findOneBy(["slug"=>"indices/indice/biblioteca"],[]);
  90.         $content $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
  91.   
  92.         return $this->render('front/index/libraryIndex.html.twig', ["content" => $content]);
  93.     }
  94. }