_submission = $submission; $this->_publication = $publication; $this->_isEditable = $isEditable; } // // Template methods from GridCellProvider // /** * @copydoc GridCellProvider::getTemplateVarsFromRowColumn() */ public function getTemplateVarsFromRowColumn($row, $column) { $element = $row->getData(); $columnId = $column->getId(); assert($element instanceof \PKP\core\DataObject && !empty($columnId)); /** @var Galley $element */ switch ($columnId) { case 'label': return [ 'label' => !$element->getRemoteUrl() && $element->getData('submissionFileId') ? '' : $element->getLabel() ]; default: assert(false); } return parent::getTemplateVarsFromRowColumn($row, $column); } /** * Get request arguments. * * @param \PKP\controllers\grid\GridRow $row * * @return array */ public function getRequestArgs($row) { return [ 'submissionId' => $this->_submission->getId(), 'publicationId' => $this->_publication->getId(), ]; } /** * @copydoc GridCellProvider::getCellActions() */ public function getCellActions($request, $row, $column, $position = GridHandler::GRID_ACTION_POSITION_DEFAULT) { switch ($column->getId()) { case 'label': $element = $row->getData(); if ($element->getRemoteUrl() || !$element->getData('submissionFileId')) { break; } $submissionFile = Repo::submissionFile() ->get($element->getData('submissionFileId')); return [new DownloadFileLinkAction($request, $submissionFile, WORKFLOW_STAGE_ID_PRODUCTION, $element->getLabel())]; } return parent::getCellActions($request, $row, $column, $position); } }