<?php/** * Contao Open Source CMS * * Copyright (C) 2005-2013 Leo Feyer * * @package Comments * @link https://contao.org * @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL *//** * Run in a custom namespace, so the class can be replaced */namespace hideaway;/** * Class CeHideawayList * * @copyright Leo Feyer 2005-2013 * @author Leo Feyer <https://contao.org> * @package Comments */class CeHideawayRegionContentReader extends \ContentElement{ /** * Template * @var string */ protected $strTemplate = 'ce_hideaway_region_content_reader'; /** * Display a wildcard in the back end * @return string */ public function generate() { if (TL_MODE == 'BE') { //$objp = \PageModel::findById($this->hideaway_jumpto); $objTemplate = new \BackendTemplate('be_wildcard'); $objTemplate->wildcard = '### Hideaway Region Content Reader ###'; //$objTemplate->title = 'Zielseite: '. $objp->title . ' ('.$this->hideaway_jumpto.')'; return $objTemplate->parse(); } // Set the item from the auto_item parameter if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) { \Input::setGet('items', \Input::get('auto_item')); } return parent::generate(); } /** * Generate the module */ protected function compile() { global $objPage; $this->import('Hideaway'); $region = $this->Hideaway->getRegionByUrl(); $this->Template->entry = $region; $this->Template->hotels = $this->Hideaway->getHotelsByRegionId($region['row']['id']); $this->Template->travels = $this->Hideaway->getTravelsByRegionId($region['row']['id']); $this->Template->trips = $this->Hideaway->getTripsByRegionId($region['row']['id']); $this->Template->combis = $this->Hideaway->getCombisByRegionId($region['row']['id']); // Content-Elemente des Region-Datensatzes laden (zwei Bereiche) $db = \Database::getInstance(); // Bereich oben $objTop = $db->prepare( "SELECT id FROM tl_content WHERE pid=? AND ptable='tl_hideaway_region' AND (hideaway_content_area='top' OR hideaway_content_area='') AND invisible='' AND (start='' OR start<=?) AND (stop='' OR stop>?) ORDER BY sorting ASC" )->execute($region['row']['id'], time(), time()); $strTop = ''; while ($objTop->next()) { $strTop .= $this->getContentElement($objTop->id); } $this->Template->regionContentTop = $strTop; // Bereich unten $objBottom = $db->prepare( "SELECT id FROM tl_content WHERE pid=? AND ptable='tl_hideaway_region' AND hideaway_content_area='bottom' AND invisible='' AND (start='' OR start<=?) AND (stop='' OR stop>?) ORDER BY sorting ASC" )->execute($region['row']['id'], time(), time()); $strBottom = ''; while ($objBottom->next()) { $strBottom .= $this->getContentElement($objBottom->id); } $this->Template->regionContentBottom = $strBottom; }}