_submission = $submission; $this->_publication = $publication; $this->_readOnly = $readOnly; parent::__construct(); } // // Overridden methods from GridRow // /** * @copydoc GridRow::initialize() * * @param null|mixed $template */ public function initialize($request, $template = null) { // Do the default initialization parent::initialize($request, $template); // Is this a new row or an existing row? $rowId = $this->getId(); if (!empty($rowId) && is_numeric($rowId)) { // Only add row actions if this is an existing row $router = $request->getRouter(); $actionArgs = $this->getRequestArgs(); $actionArgs['authorId'] = $rowId; if (!$this->isReadOnly()) { // Add row-level actions $this->addAction( new LinkAction( 'editAuthor', new AjaxModal( $router->url($request, null, null, 'editAuthor', null, $actionArgs), __('grid.action.editContributor'), 'modal_edit' ), __('grid.action.edit'), 'edit' ) ); $this->addAction( new LinkAction( 'deleteAuthor', new RemoteActionConfirmationModal( $request->getSession(), __('common.confirmDelete'), __('common.delete'), $router->url($request, null, null, 'deleteAuthor', null, $actionArgs), 'modal_delete' ), __('grid.action.delete'), 'delete' ) ); $author = Repo::author()->get((int) $rowId, $this->getPublication()->getId()); if ($author && !Repo::user()->getByEmail($author->getEmail(), true)) { $this->addAction( new LinkAction( 'addUser', new AjaxModal( $router->url($request, null, null, 'addUser', null, $actionArgs), __('grid.user.add'), 'modal_add_user', true ), __('grid.user.add'), 'add_user' ) ); } } } } /** * Get the submission for this row (already authorized) * * @return Submission */ public function getSubmission() { return $this->_submission; } /** * Get the publication for this row (already authorized) * * @return Publication */ public function getPublication() { return $this->_publication; } /** * Get the base arguments that will identify the data in the grid. * * @return array */ public function getRequestArgs() { $submission = $this->getSubmission(); $publication = $this->getPublication(); return [ 'submissionId' => $submission->getId(), 'publicationId' => $publication->getId() ]; } /** * Determines whether the current user can create user accounts from authors present * in the grid. * Overridden by child grid rows. * * @param PKPRequest $request * * @return bool */ public function allowedToCreateUser($request) { return false; } /** * Determine if this grid row should be read only. * * @return bool */ public function isReadOnly() { return $this->_readOnly; } }