/**
  * Return if there are no files
  *
  * @return string
  */
 public function generate()
 {
     if ($this->playerSRC == '') {
         return '';
     }
     $source = deserialize($this->playerSRC);
     if (!is_array($source) || empty($source)) {
         return '';
     }
     $objFiles = \FilesModel::findMultipleByUuidsAndExtensions($source, array('mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv', 'm4a', 'mp3', 'wma', 'mpeg', 'wav', 'ogg'));
     if ($objFiles === null) {
         return '';
     }
     // Display a list of files in the back end
     if (TL_MODE == 'BE') {
         $return = '<ul>';
         while ($objFiles->next()) {
             $objFile = new \File($objFiles->path);
             $return .= '<li><img src="' . TL_ASSETS_URL . 'assets/contao/images/' . $objFile->icon . '" width="18" height="18" alt="" class="mime_icon"> <span>' . $objFile->name . '</span> <span class="size">(' . $this->getReadableSize($objFile->size) . ')</span></li>';
         }
         return $return . '</ul>';
     }
     $this->objFiles = $objFiles;
     return parent::generate();
 }
Beispiel #2
0
 /**
  * Return if there are no files
  *
  * @return string
  */
 public function generate()
 {
     if ($this->playerSRC == '') {
         return '';
     }
     $source = \StringUtil::deserialize($this->playerSRC);
     if (!is_array($source) || empty($source)) {
         return '';
     }
     $objFiles = \FilesModel::findMultipleByUuidsAndExtensions($source, array('mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv', 'm4a', 'mp3', 'wma', 'mpeg', 'wav', 'ogg'));
     if ($objFiles === null) {
         return '';
     }
     // Display a list of files in the back end
     if (TL_MODE == 'BE') {
         $return = '<ul>';
         while ($objFiles->next()) {
             $objFile = new \File($objFiles->path);
             $return .= '<li>' . \Image::getHtml($objFile->icon, '', 'class="mime_icon"') . ' <span>' . $objFile->name . '</span> <span class="size">(' . $this->getReadableSize($objFile->size) . ')</span></li>';
         }
         return $return . '</ul>';
     }
     $this->objFiles = $objFiles;
     return parent::generate();
 }