system/modules/hideaway/elements/CeHideawayCombiReader.php line 70

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 CeHideawayCombiReader extends \ContentElement
  23. {
  24. /**
  25. * Template
  26. * @var string
  27. */
  28. protected $strTemplate = 'ce_hideaway_combi_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 Combi 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. $obj = $this->Hideaway->getCombiEntry($id, true);
  58. $tmp = array();
  59. //var_dump($obj['row']);
  60. //die();
  61. for($i=1; $i<=21; $i++)
  62. {
  63. if($obj['row']['element_'.$i.'_object']!='' && $obj['row']['element_'.$i.'_object']!='0')
  64. {
  65. $tid = explode("_", $obj['row']['element_'.$i.'_object']);
  66. $tobj = array();
  67. $type = '';
  68. switch($tid[0])
  69. {
  70. case 'h':
  71. $tobj = $this->Hideaway->getHotelEntry($tid[1]);
  72. $type = 'hotel';
  73. break;
  74. case 't':
  75. $tobj = $this->Hideaway->getTravelEntry($tid[1]);
  76. $type = 'travel';
  77. break;
  78. case 'tr':
  79. $tobj = $this->Hideaway->getTripEntry($tid[1]);
  80. $type = 'trip';
  81. break;
  82. }
  83. $tmp[] = array('pos'=>$i, 'type'=>$type, 'title'=>$obj['row']['element_'.$i.'_title'], 'obj'=>$tobj);
  84. //$objModel = \FilesModel::findByUuid($obj['row']['element_'.$i.'_image']);
  85. //$tmp[] = array('pos'=>$i, 'location'=>$obj['row']['element_'.$i.'_location'], 'image_path'=>$objModel->path,'teaser'=>$obj['row']['element_'.$i.'_teaser']);
  86. }
  87. }
  88. $obj['stations'] = $tmp;
  89. $this->Template->entry = $obj;
  90. }
  91. }