_capabilities = $capabilities; $this->_stageId = $stageId; parent::__construct(); } // // Getters and Setters // /** * Can the user delete files from this grid? * * @return bool */ public function canDelete() { return $this->_capabilities->canDelete(); } /** * Can the user view file notes on this grid? * * @return bool */ public function canViewNotes() { return $this->_capabilities->canViewNotes(); } /** * Can the user manage files in this grid? * * @return bool */ public function canEdit() { return $this->_capabilities->canEdit(); } /** * Get the stage id, if any. * * @return int Stage ID */ public function getStageId() { return $this->_stageId; } // // Overridden template methods from GridRow // /** * @copydoc GridRow::initialize() */ public function initialize($request, $template = 'controllers/grid/gridRow.tpl') { parent::initialize($request, $template); // Retrieve the submission file. $submissionFileData = & $this->getData(); assert(isset($submissionFileData['submissionFile'])); $submissionFile = & $submissionFileData['submissionFile']; /** @var SubmissionFile $submissionFile */ assert(is_a($submissionFile, 'SubmissionFile')); // File grid row actions: // 1) Information center action. if ($this->canViewNotes()) { $this->addAction(new FileInfoCenterLinkAction($request, $submissionFile, $this->getStageId())); } // 2) Edit metadata action. if ($this->canEdit()) { $this->addAction(new EditFileLinkAction($request, $submissionFile, $this->getStageId())); } // 3) Delete file action. if ($this->canDelete()) { $this->addAction(new DeleteFileLinkAction($request, $submissionFile, $this->getStageId())); } } }