<?php
namespace App\Controller\Front;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
use App\Repository\PageRepository;
use App\Repository\SectionRepository;
use App\Repository\NewsItemRepository;
use App\Entity\Page;
use App\Entity\Section;
use App\Entity\NewsItem;
use Symfony\Component\HttpFoundation\Response;
class HomeController extends AbstractController
{
/**
* @Route("/")
*/
public function home(Request $request,PageRepository $pageRepository, SectionRepository $sectionRepository, NewsItemRepository $newsItemRepository )
{
$home = $pageRepository->findOneBy(["slug"=>"index"],[]);
$content = $sectionRepository->findBy(["page"=>$home->getId()], ["customOrder"=>"ASC"]);
$latestNews = $newsItemRepository->findByHomeResume();
$contestAnnouncement = $newsItemRepository->findContestAndAnnouncementResume();
return $this->render('front/home.html.twig', ["content" => $content, "latestNews" => $latestNews, "contestAnnouncement" => $contestAnnouncement]);
}
/**
* @Route("/indices/indice/transparencia")
*/
public function transparencyIndex(Request $request,PageRepository $pageRepository, SectionRepository $sectionRepository)
{
$page = $pageRepository->findOneBy(["slug"=>"indices/indice/transparencia"],[]);
$content = $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
return $this->render('front/index/transparencyIndex.html.twig', ["content" => $content]);
}
/**
* @Route("/indices/indice/estudios")
*/
public function studiesIndex(Request $request,PageRepository $pageRepository, SectionRepository $sectionRepository)
{
$page = $pageRepository->findOneBy(["slug"=>"indices/indice/estudios"],[]);
$content = $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
return $this->render('front/index/studiesIndex.html.twig', ["content" => $content]);
}
/**
* @Route("/indices/indice/alumnos")
*/
public function studentsIndex(Request $request,PageRepository $pageRepository, SectionRepository $sectionRepository)
{
$page = $pageRepository->findOneBy(["slug"=>"indices/indice/alumnos"],[]);
$content = $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
return $this->render('front/index/studentsIndex.html.twig', ["content" => $content]);
}
/**
* @Route("/indices/indice/investigacion")
*/
public function investigationIndex(Request $request,PageRepository $pageRepository, SectionRepository $sectionRepository)
{
$page = $pageRepository->findOneBy(["slug"=>"indices/indice/investigacion"],[]);
$content = $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
return $this->render('front/index/investigationIndex.html.twig', ["content" => $content]);
}
/**
* @Route("/indices/indice/calidad")
*/
public function qualityIndex(Request $request,PageRepository $pageRepository, SectionRepository $sectionRepository)
{
$page = $pageRepository->findOneBy(["slug"=>"indices/indice/calidad"],[]);
$content = $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
return $this->render('front/index/qualityIndex.html.twig', ["content" => $content]);
}
/**
* @Route("/indices/indice/biblioteca")
*/
public function libraryIndex(Request $request,PageRepository $pageRepository, SectionRepository $sectionRepository)
{
$page = $pageRepository->findOneBy(["slug"=>"indices/indice/biblioteca"],[]);
$content = $sectionRepository->findBy(["page"=>$page->getId()], ["customOrder"=>"ASC"]);
return $this->render('front/index/libraryIndex.html.twig', ["content" => $content]);
}
}