<?php
namespace App\Controller\Pages;
use App\Controller\System;
use App\Kernel;
use App\Controller\AbstractKasController;
use App\Controller\Database;
use App\Controller\PageInfo;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;
use App\Controller\Objects\Page;
use Symfony\VarDumper;
class ProgramController extends AbstractKasController
{
public function __construct(RequestStack $requestStack, Database $db, PageInfo $pageInfo)
{
parent::__construct($requestStack, $db, $pageInfo);
$this->request = $requestStack->getCurrentRequest();
$this->model = new ProgramModel($db);
}
/**
* @Route("/program-html-{id}", methods={"GET"})
* @Route("/program-kino-html-{id}", methods={"GET"})
* @Route("/program-html-{id}/{week}", methods={"GET"})
* @Route("/program-kino-html-{id}/{week}", methods={"GET"})
* @return Response
*/
public function programKinoData($id, string $week = ''):Response
{
$week = ($week=='week');
$program = $this->model->getProgramEvents($id, $week);
return $this->render('/partials/program.html.twig', [
'program' => $program,
'eid' => System::encrypt($id)
]);
}
/**
* @Route("/program-divadlo-html-{id}", methods={"GET"})
* @Route("/program-divadlo-html-{id}/{week}", methods={"GET"})
* @return Response
*/
public function programDivadloData($id, string $week = ''):Response
{
$week = ($week=='week');
$program = $this->model->getProgramEvents($id, $week);
return $this->render('/partials/program_divadlo.html.twig', [
'program' => $program,
'eid' => System::encrypt($id)
]);
}
/**
* @Route("/program")
* @Route("/program-{eid}", methods={"GET"})
* @return Response
*/
public function program(string $eid = ''): Response
{
//$link = $this->request->getRequestUri();
$page = $this->model->getProgramInfo();
$id = 0;
if ($eid!=='') {
$id = (int)System::decrypt($eid);
}
return $this->render('/pages/program.html.twig', [
'pageinfo' => $this->pageInfo,
'page' => $page,
'id' => $id
]);
}
}
?>