/** * @see Form::fetch() */ function fetch($request) { $submission = $this->getSubmission(); $reviewRound = $this->getReviewRound(); if (is_a($reviewRound, 'ReviewRound')) { $this->setData('reviewRoundId', $reviewRound->getId()); } $this->setData('stageId', $this->getStageId()); $templateMgr = TemplateManager::getManager($request); $stageDecisions = EditorDecisionActionsManager::getStageDecisions($this->getStageId()); $templateMgr->assign(array('decisionData' => $stageDecisions[$this->getDecision()], 'submissionId' => $submission->getId(), 'submission' => $submission)); return parent::fetch($request); }
/** * Fetch JSON-encoded editor decision options. * @param $args array * @param $request Request * @return JSONMessage JSON object */ function editorDecisionActions($args, $request) { AppLocale::requireComponents(LOCALE_COMPONENT_APP_EDITOR); $reviewRoundId = (int) $request->getUserVar('reviewRoundId'); // Prepare the action arguments. $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); $actionArgs = array('submissionId' => $submission->getId(), 'stageId' => (int) $stageId); // If a review round was specified, include it in the args; // must also check that this is the last round or decisions // cannot be recorded. if ($reviewRoundId) { $actionArgs['reviewRoundId'] = $reviewRoundId; $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); $lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId); } // If a review round was specified, // If there is an editor assigned, retrieve stage decisions. $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); if ($stageAssignmentDao->editorAssignedToStage($submission->getId(), $stageId) && (!$reviewRoundId || $reviewRoundId == $lastReviewRound->getId())) { import('classes.workflow.EditorDecisionActionsManager'); $decisions = EditorDecisionActionsManager::getStageDecisions($stageId); } else { $decisions = array(); // None available } // Iterate through the editor decisions and create a link action for each decision. $editorActions = array(); // If we're in Submission stage and could expedite, show action. import('lib.pkp.classes.workflow.linkAction.ExpediteSubmissionLinkAction'); if ($stageId == WORKFLOW_STAGE_ID_SUBMISSION && ExpediteSubmissionLinkAction::canExpedite($request->getUser(), $request->getContext())) { $editorActions[] = new ExpediteSubmissionLinkAction($request, $submission->getId()); } $dispatcher = $request->getDispatcher(); import('lib.pkp.classes.linkAction.request.AjaxModal'); foreach ($decisions as $decision => $action) { $actionArgs['decision'] = $decision; $editorActions[] = new LinkAction($action['name'], new AjaxModal($dispatcher->url($request, ROUTE_COMPONENT, null, 'modals.editorDecision.EditorDecisionHandler', $action['operation'], null, $actionArgs), __($action['title']), $action['titleIcon']), __($action['title'])); } // Assign the actions to the template. $templateMgr = TemplateManager::getManager($request); $templateMgr->assign('editorActions', $editorActions); $templateMgr->assign('stageId', $stageId); return $templateMgr->fetchJson('workflow/editorialLinkActions.tpl'); }