addPolicy(new ReviewRoundRequiredPolicy($request, $args)); return parent::authorize($request, $args, $roleAssignments); } /** * JSON fetch the external review round info (tab). * * @param array $args * @param PKPRequest $request * * @return JSONMessage JSON object */ public function externalReviewRound($args, $request) { return $this->_reviewRound($args, $request); } /** * @see PKPHandler::setupTemplate */ public function setupTemplate($request) { parent::setupTemplate($request); } // // Protected helper methods. // /** * Internal function to handle both internal and external reviews round info (tab content). * * @param PKPRequest $request * @param array $args * * @return JSONMessage JSON object */ protected function _reviewRound($args, $request) { $this->setupTemplate($request); // Retrieve the authorized submission, stage id and review round. $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); $stageId = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_WORKFLOW_STAGE); $reviewRound = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_REVIEW_ROUND); // Is this round the most recent round? $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ $lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId); // Add the round information to the template. $templateMgr = TemplateManager::getManager($request); $templateMgr->assign('stageId', $stageId); $templateMgr->assign('reviewRoundId', $reviewRound->getId()); $templateMgr->assign('isLastReviewRound', $reviewRound->getId() == $lastReviewRound->getId()); $templateMgr->assign('submission', $submission); // Assign editor decision actions to the template, only if // user is accessing the last review round for this stage. $notificationRequestOptions = [ Notification::NOTIFICATION_LEVEL_NORMAL => [ PKPNotification::NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => [Application::ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId()]], Notification::NOTIFICATION_LEVEL_TRIVIAL => [], ]; $templateMgr->assign('reviewRoundNotificationRequestOptions', $notificationRequestOptions); // If a user is also assigned as an author to this submission, they // shouldn't see any editorial actions $userAccessibleStages = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_ACCESSIBLE_WORKFLOW_STAGES); foreach ($userAccessibleStages as $accessibleStageId => $roles) { if (in_array(Role::ROLE_ID_AUTHOR, $roles)) { $templateMgr->assign('isAssignedAsAuthor', true); break; } } return $templateMgr->fetchJson('workflow/reviewRound.tpl'); } } if (!PKP_STRICT_MODE) { class_alias('\PKP\controllers\tab\workflow\PKPReviewRoundTabHandler', '\PKPReviewRoundTabHandler'); }