Open Journal Systems  3.3.0
DownloadFileLinkAction.inc.php
1 <?php
15 import('lib.pkp.controllers.api.file.linkAction.FileLinkAction');
16 
19  var $label;
20 
29  function __construct($request, $submissionFile, $stageId = null, $label = null) {
30  // Instantiate the redirect action request.
31  $router = $request->getRouter();
32  import('lib.pkp.classes.linkAction.request.PostAndRedirectAction');
33  $this->label = $label;
34  $redirectRequest = new PostAndRedirectAction(
35  $router->url(
36  $request, null, 'api.file.FileApiHandler', 'recordDownload',
37  null, $this->getActionArgs($submissionFile, $stageId)),
38  $router->url(
39  $request, null, 'api.file.FileApiHandler', 'downloadFile',
40  null, $this->getActionArgs($submissionFile, $stageId))
41  );
42 
43  // Configure the file link action.
44  parent::__construct(
45  'downloadFile', $redirectRequest, htmlspecialchars($this->getLabel($submissionFile)),
46  $submissionFile->getDocumentType(),
47  $submissionFile->getFileId() . '-' . $submissionFile->getRevision()
48  );
49  }
50 
56  function getLabel($submissionFile) {
57  if ($this->label !== null) return $this->label;
58  return $submissionFile->getFileLabel();
59  }
60 }
61 
62 
PostAndRedirectAction
Class defining a post and redirect action. See PostAndRedirectRequest.js to detailed description.
Definition: PostAndRedirectAction.inc.php:19
DownloadFileLinkAction\__construct
__construct($request, $submissionFile, $stageId=null, $label=null)
Definition: DownloadFileLinkAction.inc.php:32
DownloadFileLinkAction\getLabel
getLabel($submissionFile)
Definition: DownloadFileLinkAction.inc.php:59
DownloadFileLinkAction\$label
$label
Definition: DownloadFileLinkAction.inc.php:22
FileLinkAction
An abstract file action.
Definition: FileLinkAction.inc.php:17
DownloadFileLinkAction
An action to download a file.
Definition: DownloadFileLinkAction.inc.php:17