Open Journal Systems  3.3.0
FileNameGridColumn.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.grid.GridColumn');
17 
20  var $_includeNotes;
21 
23  var $_stageId;
24 
27 
35  function __construct($includeNotes = true, $stageId = null, $removeHistoryTab = false) {
36  $this->_includeNotes = $includeNotes;
37  $this->_stageId = $stageId;
38  $this->_removeHistoryTab = $removeHistoryTab;
39 
40  import('lib.pkp.classes.controllers.grid.ColumnBasedGridCellProvider');
41  $cellProvider = new ColumnBasedGridCellProvider();
42 
43  parent::__construct('name', 'common.name', null, null, $cellProvider,
44  array('width' => 70, 'alignment' => COLUMN_ALIGNMENT_LEFT, 'anyhtml' => true));
45  }
46 
47 
48  //
49  // Public methods
50  //
57  function getTemplateVarsFromRow($row) {
58  $submissionFileData = $row->getData();
59  $submissionFile = $submissionFileData['submissionFile'];
60  assert(is_a($submissionFile, 'SubmissionFile'));
61  $id = $submissionFile->getFileId() . '-' . $submissionFile->getRevision();
62  $fileExtension = strtolower($submissionFile->getExtension());
63  return array('label' => '<span class="file_extension ' . $fileExtension . '">' . $id . '</span>');
64  }
65 
66 
67  //
68  // Override methods from GridColumn
69  //
73  function getCellActions($request, $row, $position = GRID_ACTION_POSITION_DEFAULT) {
74  $cellActions = parent::getCellActions($request, $row, $position);
75 
76  // Retrieve the submission file.
77  $submissionFileData =& $row->getData();
78  assert(isset($submissionFileData['submissionFile']));
79  $submissionFile = $submissionFileData['submissionFile']; /* @var $submissionFile SubmissionFile */
80 
81  // Create the cell action to download a file.
82  import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction');
83  $cellActions[] = new DownloadFileLinkAction($request, $submissionFile, $this->_getStageId());
84 
85  return $cellActions;
86  }
87 
88  //
89  // Private methods
90  //
94  function _getIncludeNotes() {
95  return $this->_includeNotes;
96  }
97 
102  function _getStageId() {
104  }
105 }
106 
107 
ColumnBasedGridCellProvider
A cell provider that relies on the column implementation to provide cell content. Use this cell provi...
Definition: ColumnBasedGridCellProvider.inc.php:24
GridColumn
The GridColumn class represents a column within a grid. It is used to format the data presented in a ...
Definition: GridColumn.inc.php:27
FileNameGridColumn\getCellActions
getCellActions($request, $row, $position=GRID_ACTION_POSITION_DEFAULT)
Definition: FileNameGridColumn.inc.php:82
FileNameGridColumn\$_stageId
$_stageId
Definition: FileNameGridColumn.inc.php:29
FileNameGridColumn\_getIncludeNotes
_getIncludeNotes()
Definition: FileNameGridColumn.inc.php:103
FileNameGridColumn
Implements a file name column.
Definition: FileNameGridColumn.inc.php:18
FileNameGridColumn\__construct
__construct($includeNotes=true, $stageId=null, $removeHistoryTab=false)
Definition: FileNameGridColumn.inc.php:44
FileNameGridColumn\$_includeNotes
$_includeNotes
Definition: FileNameGridColumn.inc.php:23
FileNameGridColumn\getTemplateVarsFromRow
getTemplateVarsFromRow($row)
Definition: FileNameGridColumn.inc.php:66
FileNameGridColumn\_getStageId
_getStageId()
Definition: FileNameGridColumn.inc.php:111
FileNameGridColumn\$_removeHistoryTab
$_removeHistoryTab
Definition: FileNameGridColumn.inc.php:35
DownloadFileLinkAction
An action to download a file.
Definition: DownloadFileLinkAction.inc.php:17