system/modules/hideaway/elements/CeHideawayCountryHeaderReader.php line 59

Open in your IDE?
  1. <?php
  2. /**
  3. * Contao Open Source CMS
  4. *
  5. * Copyright (C) 2005-2013 Leo Feyer
  6. *
  7. * @package Comments
  8. * @link https://contao.org
  9. * @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
  10. */
  11. /**
  12. * Run in a custom namespace, so the class can be replaced
  13. */
  14. namespace hideaway;
  15. /**
  16. * Class CeHideawayList
  17. *
  18. * @copyright Leo Feyer 2005-2013
  19. * @author Leo Feyer <https://contao.org>
  20. * @package Comments
  21. */
  22. class CeHideawayCountryHeaderReader extends \ContentElement
  23. {
  24. /**
  25. * Template
  26. * @var string
  27. */
  28. protected $strTemplate = 'ce_hideaway_country_header_reader';
  29. /**
  30. * Display a wildcard in the back end
  31. * @return string
  32. */
  33. public function generate()
  34. {
  35. if (TL_MODE == 'BE')
  36. {
  37. $objTemplate = new \BackendTemplate('be_wildcard');
  38. $objTemplate->wildcard = '### Hideaway Country Header Reader ###';
  39. $objTemplate->title = $this->headline;
  40. return $objTemplate->parse();
  41. }
  42. // Set the item from the auto_item parameter
  43. if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item']))
  44. {
  45. \Input::setGet('items', \Input::get('auto_item'));
  46. }
  47. return parent::generate();
  48. }
  49. /**
  50. * Generate the module
  51. */
  52. protected function compile()
  53. {
  54. global $objPage;
  55. $id = $this->Input->get('items');
  56. $this->import('Hideaway');
  57. $country = $this->Hideaway->getCountryByUrl();
  58. //var_dump($country);
  59. $this->Template->entry = $country;
  60. // Testimonials für dieses Land laden
  61. $testimonials = array();
  62. if ($country && isset($country['row']['id']))
  63. {
  64. $objTestimonials = \Database::getInstance()
  65. ->prepare("SELECT * FROM tl_hideaway_testimonial WHERE published='1' AND country=? ORDER BY sorting ASC")
  66. ->execute($country['row']['id']);
  67. while ($objTestimonials->next())
  68. {
  69. $testimonials[] = (object) array(
  70. 'name' => $objTestimonials->name,
  71. 'rating' => (int) $objTestimonials->rating,
  72. 'title' => $objTestimonials->title,
  73. 'text' => $objTestimonials->text,
  74. );
  75. }
  76. }
  77. $this->Template->testimonials = $testimonials;
  78. //die('Country Header');
  79. /*$obj = $this->Hideaway->getHotelEntry($id);
  80. $this->Template->entry = $obj;
  81. */
  82. }
  83. }