downloadFile() публичный Метод

Download a file.
public downloadFile ( $fileId, $inline = false ) : boolean
$fileId int the file id of the file to download
$inline print file as inline instead of attachment, optional
Результат boolean
Пример #1
0
 /**
  * An action to download an issue galley
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function download($args, $request)
 {
     $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
     $issueGalley = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE_GALLEY);
     import('classes.file.IssueFileManager');
     $issueFileManager = new IssueFileManager($issue->getId());
     return $issueFileManager->downloadFile($issueGalley->getFileId());
 }
Пример #2
0
 /**
  * Show an issue galley file (either inline or download)
  * @param $issueId int
  * @param $galleyId int
  * @param $request Request
  * @param $inline boolean
  */
 function _showIssueGalley($request, $inline = false)
 {
     $journal =& $request->getJournal();
     $issue =& $this->getIssue();
     $galley =& $this->getGalley();
     $galleyDao =& DAORegistry::getDAO('IssueGalleyDAO');
     if (!HookRegistry::call('IssueHandler::viewFile', array(&$issue, &$galley))) {
         import('classes.file.IssueFileManager');
         $issueFileManager = new IssueFileManager($issue->getId());
         return $issueFileManager->downloadFile($galley->getFileId(), $inline);
     }
 }
Пример #3
0
 /**
  * Downloads an issue galley file
  * @param $args array ($issueId, $galleyId)
  * @param $request Request
  */
 function download($args, $request)
 {
     if ($this->userCanViewGalley($request)) {
         $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
         $galley = $this->getGalley();
         if (!HookRegistry::call('IssueHandler::download', array(&$issue, &$galley))) {
             import('classes.file.IssueFileManager');
             $issueFileManager = new IssueFileManager($issue->getId());
             return $issueFileManager->downloadFile($galley->getFileId(), $request->getUserVar('inline') ? true : false);
         }
     }
 }
Пример #4
0
 /**
  * Download an issue file.
  * @param $args array ($issueId, $fileId)
  */
 function downloadIssueFile($args, $request)
 {
     $issueId = isset($args[0]) ? (int) $args[0] : 0;
     $fileId = isset($args[1]) ? (int) $args[1] : 0;
     $this->validate($issueId, true);
     if ($fileId) {
         import('classes.file.IssueFileManager');
         $issueFileManager = new IssueFileManager($issueId);
         return $issueFileManager->downloadFile($fileId);
     }
     $request->redirect(null, null, 'issueGalleys', $issueId);
 }
Пример #5
0
 /**
  * Show an issue galley file (either inline or download)
  * @param $issueId int
  * @param $galleyId int
  * @param $request Request
  * @param $inline boolean
  */
 function _showIssueGalley($request, $inline = false)
 {
     $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
     $galley = $this->getGalley();
     if (!HookRegistry::call('IssueHandler::viewFile', array(&$issue, &$galley))) {
         import('classes.file.IssueFileManager');
         $issueFileManager = new IssueFileManager($issue->getId());
         return $issueFileManager->downloadFile($galley->getFileId(), $inline);
     }
 }