Exemplo n.º 1
0
 /**
  * @return string
  */
 public function generate()
 {
     // Display a wildcard in the back end
     if (TL_MODE === 'BE') {
         $template = new \BackendTemplate('be_wildcard');
         $template->wildcard = '### ROCKSOLID SLIDER ###';
         $template->title = $this->name;
         $template->id = $this->id;
         $template->link = $this->name;
         $template->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $template->parse();
     }
     if ($this->rsts_content_type === 'rsts_news') {
         $newsModule = new SliderNews($this->objModel, $this->strColumn);
         $this->newsArticles = $newsModule->getNewsArticles();
         if (!count($this->newsArticles)) {
             // Return if there are no news articles
             return '';
         }
     } else {
         if ($this->rsts_content_type === 'rsts_events') {
             $eventsModule = new SliderEvents($this->objModel, $this->strColumn);
             $this->eventItems = $eventsModule->getEventItems();
             if (!count($this->eventItems)) {
                 // Return if there are no events
                 return '';
             }
         } else {
             if ($this->rsts_content_type === 'rsts_images' || !$this->rsts_id) {
                 $this->multiSRC = deserialize($this->multiSRC);
                 if (!is_array($this->multiSRC) || !count($this->multiSRC)) {
                     // Return if there are no images
                     return '';
                 }
             } else {
                 $this->slider = SliderModel::findByPk($this->rsts_id);
                 // Return if there is no slider
                 if (!$this->slider || $this->slider->id !== $this->rsts_id) {
                     return '';
                 }
                 $this->multiSRC = deserialize($this->slider->multiSRC);
                 $this->orderSRC = $this->slider->orderSRC;
             }
         }
     }
     if (version_compare(VERSION, '3.2', '<')) {
         $this->files = \FilesModel::findMultipleByIds($this->multiSRC);
     } else {
         $this->files = \FilesModel::findMultipleByUuids($this->multiSRC);
     }
     if ($this->rsts_template) {
         $this->strTemplate = $this->rsts_template;
     }
     return parent::generate();
 }
 /**
  * @return string
  */
 public function generate()
 {
     // Display a wildcard in the back end
     if (TL_MODE === 'BE') {
         $template = new \BackendTemplate('be_wildcard');
         $template->wildcard = '### ROCKSOLID SLIDER ###';
         $template->title = $this->name;
         $template->id = $this->id;
         $template->link = $this->name;
         $template->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         if ($this->objModel->rsts_id && ($slider = SliderModel::findByPk($this->objModel->rsts_id)) !== null) {
             $template->id = $slider->id;
             $template->link = $slider->name;
             $template->href = 'contao/main.php?do=rocksolid_slider&amp;table=tl_rocksolid_slide&amp;id=' . $slider->id;
         }
         return $template->parse();
     }
     if ($this->rsts_content_type === 'rsts_news') {
         $newsModule = new SliderNews($this->objModel, $this->strColumn);
         $this->newsArticles = $newsModule->getNewsArticles();
         if (!count($this->newsArticles)) {
             // Return if there are no news articles
             return '';
         }
     } else {
         if ($this->rsts_content_type === 'rsts_events') {
             $eventsModule = new SliderEvents($this->objModel, $this->strColumn);
             $this->eventItems = $eventsModule->getEventItems();
             if (!count($this->eventItems)) {
                 // Return if there are no events
                 return '';
             }
         } else {
             if ($this->rsts_content_type === 'rsts_settings') {
                 return '';
             } else {
                 if ($this->rsts_content_type === 'rsts_images' || !$this->rsts_id) {
                     $this->multiSRC = deserialize($this->multiSRC);
                     if (!is_array($this->multiSRC) || !count($this->multiSRC)) {
                         // Return if there are no images
                         return '';
                     }
                 } else {
                     $this->slider = SliderModel::findByPk($this->rsts_id);
                     // Return if there is no slider
                     if (!$this->slider || $this->slider->id !== $this->rsts_id) {
                         return '';
                     }
                     if ($this->slider->type === 'image') {
                         $this->multiSRC = deserialize($this->slider->multiSRC);
                         $this->orderSRC = $this->slider->orderSRC;
                     }
                 }
             }
         }
     }
     if (version_compare(VERSION, '3.2', '<')) {
         $this->files = \FilesModel::findMultipleByIds($this->multiSRC);
     } else {
         $this->files = \FilesModel::findMultipleByUuids($this->multiSRC);
     }
     if ($this->rsts_import_settings && $this->rsts_import_settings_from && ($settingsModule = \ModuleModel::findByPk($this->rsts_import_settings_from))) {
         $exclude = array('rsts_import_settings', 'rsts_import_settings_from', 'rsts_content_type', 'rsts_id');
         $include = array('imgSize', 'fullsize');
         foreach ($settingsModule->row() as $key => $value) {
             if ((substr($key, 0, 5) === 'rsts_' || in_array($key, $include)) && !in_array($key, $exclude)) {
                 $this->arrData[$key] = $value;
             }
         }
     }
     if ($this->rsts_template) {
         $this->strTemplate = $this->rsts_template;
     }
     return parent::generate();
 }