<?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 CeHideawayCountryContentReader extends \ContentElement{ /** * Template * @var string */ protected $strTemplate = 'ce_hideaway_country_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 Country 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; $id = $this->Input->get('items'); $this->import('Hideaway'); $country = $this->Hideaway->getCountryByUrl(); $regions = $this->Hideaway->getRegionsByCountryId($country['row']['id'], $this->hideaway_jumpto); $combis = $this->Hideaway->getCombisByCountryId($country['row']['id']); $hotels = false; $travels = false; $trips = false; $hotels = $this->Hideaway->getHotelsByRegionId($country['row']['single_region']); if($country['row']['single_region'] > 0) { $travels = $this->Hideaway->getTravelsByRegionId($country['row']['single_region']); $this->Template->isSingleRegion = true; } else $this->Template->isSingleRegion = false; $trips = $this->Hideaway->getTripsByCountryId($country['row']['id']); $this->Template->combis = $combis; $this->Template->entry = $country; $this->Template->regions = $regions; $this->Template->region_jumpto = $this->hideaway_jumpto; $this->Template->hotels = $hotels; $this->Template->travels = $travels; $this->Template->trips = $trips; // Content-Elemente des Country-Datensatzes laden (zwei Bereiche) $db = \Database::getInstance(); // Bereich oben (top = Standard für alle bisherigen Elemente) $objTop = $db->prepare( "SELECT id FROM tl_content WHERE pid=? AND ptable='tl_hideaway_country' AND (hideaway_content_area='top' OR hideaway_content_area='') AND invisible='' AND (start='' OR start<=?) AND (stop='' OR stop>?) ORDER BY sorting ASC" )->execute($country['row']['id'], time(), time()); $strTop = ''; while ($objTop->next()) { $strTop .= $this->getContentElement($objTop->id); } $this->Template->countryContentTop = $strTop; // Bereich unten $objBottom = $db->prepare( "SELECT id FROM tl_content WHERE pid=? AND ptable='tl_hideaway_country' AND hideaway_content_area='bottom' AND invisible='' AND (start='' OR start<=?) AND (stop='' OR stop>?) ORDER BY sorting ASC" )->execute($country['row']['id'], time(), time()); $strBottom = ''; while ($objBottom->next()) { $strBottom .= $this->getContentElement($objBottom->id); } $this->Template->countryContentBottom = $strBottom; }}