123456789101112131415161718192021222324252627282930313233 |
- <?php
- class TemplatePage
- {
- public static function getInstance()
- {
- return new TemplatePage(new TwigWrapper("/var/www/views"), OfferRetriever::getInstance());
- }
- private $twig;
- private $offerRetriever;
- public function __construct(TwigWrapper $twig, OfferRetriever $offerRetriever)
- {
- $this->twig = $twig;
- $this->offerRetriever = $offerRetriever;
- }
- public function display()
- {
- $offerId = $_GET['id'];
- $page = isset($_GET['page']) ? $_GET['page'] : 0;
-
- $templateName = 'templateDoesNotExist.html';
- $pageData = array();
- if(isset($offerId))
- {
- $pageData = $this->offerRetriever->getPageData($offerId, $page);
- $templateName = $pageData['filename'];
- }
- return $this->twig->render($templateName, $pageData);
- }
- }
|