_includeNotes = $includeNotes; $this->_stageId = $stageId; $this->_removeHistoryTab = $removeHistoryTab; $cellProvider = new ColumnBasedGridCellProvider(); parent::__construct( 'name', 'common.name', null, null, $cellProvider, ['width' => 70, 'alignment' => GridColumn::COLUMN_ALIGNMENT_LEFT, 'anyhtml' => true] ); } // // Public methods // /** * Method expected by ColumnBasedGridCellProvider * to render a cell in this column. * * @copydoc ColumnBasedGridCellProvider::getTemplateVarsFromRowColumn() */ public function getTemplateVarsFromRow($row) { $submissionFileData = $row->getData(); $submissionFile = $submissionFileData['submissionFile']; assert($submissionFile instanceof SubmissionFile); $fileExtension = pathinfo($submissionFile->getData('path'), PATHINFO_EXTENSION); return ['label' => '' . $submissionFile->getId() . '']; } // // Override methods from GridColumn // /** * @copydoc GridColumn::getCellActions() */ public function getCellActions($request, $row, $position = GridHandler::GRID_ACTION_POSITION_DEFAULT) { $cellActions = parent::getCellActions($request, $row, $position); // Retrieve the submission file. $submissionFileData = & $row->getData(); assert(isset($submissionFileData['submissionFile'])); $submissionFile = $submissionFileData['submissionFile']; /** @var SubmissionFile $submissionFile */ // Create the cell action to download a file. $cellActions[] = new DownloadFileLinkAction($request, $submissionFile, $this->_getStageId()); return $cellActions; } // // Private methods // /** * Determine whether or not submission note status should be included. */ public function _getIncludeNotes() { return $this->_includeNotes; } /** * Get stage id, if any. * * @return mixed int or null */ public function _getStageId() { return $this->_stageId; } }