Exemple #1
0
 public function render()
 {
     $item = $this->getModel()->getRow();
     $state = $this->getModel()->getState();
     $container = $this->getObject('com:files.model.containers')->slug($item->container)->getRow();
     $this->path = $container->path . '/' . $item->path;
     $this->filename = $item->name;
     if (!file_exists($this->path)) {
         throw new Library\ViewException('File not found');
     }
     return parent::render();
 }
Exemple #2
0
 public function render()
 {
     $state = $this->getModel()->getState();
     $file = $this->getModel()->getRow();
     $this->path = $file->fullpath;
     $this->filename = $file->name;
     $this->mimetype = $file->mimetype ? $file->mimetype : 'application/octet-stream';
     if ($file->isImage() || $file->extension === 'pdf') {
         $this->disposition = 'inline';
     }
     if (!file_exists($this->path)) {
         throw new Library\ViewException(JText::_('File not found'));
     }
     return parent::render();
 }