예제 #1
0
 /**
  * View file.
  * @param $articleId int
  * @param $fileId int
  * @param $revision int
  */
 function viewFile($articleId, $fileId, $revision = null)
 {
     import('classes.file.ArticleFileManager');
     $articleFileManager = new ArticleFileManager($articleId);
     return $articleFileManager->viewFile($fileId, $revision);
 }
예제 #2
0
 /**
  * Download a supplementary file
  * @param $args array
  * @param $request Request
  */
 function downloadSuppFile($args, &$request)
 {
     $articleId = isset($args[0]) ? $args[0] : 0;
     $suppId = isset($args[1]) ? $args[1] : 0;
     $this->validate($request, $articleId);
     $journal =& $this->journal;
     $issue =& $this->issue;
     $article =& $this->article;
     $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
     if ($journal->getSetting('enablePublicSuppFileId')) {
         $suppFile =& $suppFileDao->getSuppFileByBestSuppFileId($article->getId(), $suppId);
     } else {
         $suppFile =& $suppFileDao->getSuppFile((int) $suppId, $article->getId());
     }
     if ($article && $suppFile) {
         import('file.ArticleFileManager');
         $articleFileManager = new ArticleFileManager($article->getId());
         if ($suppFile->isInlineable()) {
             $articleFileManager->viewFile($suppFile->getFileId());
         } else {
             $articleFileManager->downloadFile($suppFile->getFileId());
         }
     }
 }