/** * Handle a singular element import. * @param $node DOMElement */ function handleElement($node) { $deployment = $this->getDeployment(); $context = $deployment->getContext(); $user = $deployment->getUser(); // Create and insert the submission (ID needed for other entities) $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->newDataObject(); $submission->setContextId($context->getId()); $submission->setStatus(STATUS_QUEUED); $submissionLocale = $node->getAttribute('locale'); if (empty($submissionLocale)) { $submissionLocale = $context->getPrimaryLocale(); } $submission->setLocale($submissionLocale); $submission->setSubmissionProgress(0); $workflowStageDao = DAORegistry::getDAO('WorkflowStageDAO'); $submission->setStageId(WorkflowStageDAO::getIdFromPath($node->getAttribute('stage'))); $submissionDao->insertObject($submission); $deployment->setSubmission($submission); // Handle any additional attributes etc. $submission = $this->populateObject($submission, $node); for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) { if (is_a($n, 'DOMElement')) { $this->handleChildElement($n, $submission); } } $submissionDao->updateObject($submission); // Persist setters return $submission; }
protected function _saveGeneralPromote($args, $request) { // Redirect to the next workflow page after // promoting the submission. $decision = (int) $request->getUserVar('decision'); $redirectOp = null; if ($decision == SUBMISSION_EDITOR_DECISION_ACCEPT) { $redirectOp = WORKFLOW_STAGE_PATH_EDITING; } elseif ($decision == SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW) { $redirectOp = WORKFLOW_STAGE_PATH_EXTERNAL_REVIEW; } elseif ($decision == SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION) { $redirectOp = WORKFLOW_STAGE_PATH_PRODUCTION; } // Make sure user has access to the workflow stage. import('lib.pkp.classes.workflow.WorkflowStageDAO'); $redirectWorkflowStage = WorkflowStageDAO::getIdFromPath($redirectOp); $userAccessibleWorkflowStages = $this->getAuthorizedContextObject(ASSOC_TYPE_ACCESSIBLE_WORKFLOW_STAGES); if (!array_key_exists($redirectWorkflowStage, $userAccessibleWorkflowStages)) { $redirectOp = null; } return $this->_saveEditorDecision($args, $request, 'PromoteForm', $redirectOp); }
/** * Translate the requested operation to a stage id. * @param $request Request * @param $args array * @return integer One of the WORKFLOW_STAGE_* constants. */ protected function identifyStageId($request, $args) { if ($stageId = $request->getUserVar('stageId')) { return (int) $stageId; } // Maintain the old check for previous path urls $router = $request->getRouter(); $workflowPath = $router->getRequestedOp($request); $stageId = WorkflowStageDAO::getIdFromPath($workflowPath); if ($stageId) { return $stageId; } // Finally, retrieve the requested operation, if the stage id is // passed in via an argument in the URL, like index/submissionId/stageId $stageId = $args[1]; // Translate the operation to a workflow stage identifier. assert(WorkflowStageDAO::getPathFromId($stageId) !== null); return $stageId; }