コード例 #1
0
 /**
  * Construct a URL for the notification based on its type and associated object
  * @copydoc INotificationInfoProvider::getNotificationContents()
  */
 public function getNotificationUrl($request, $notification)
 {
     $dispatcher = Application::getDispatcher();
     $contextDao = Application::getContextDAO();
     $context = $contextDao->getById($notification->getContextId());
     switch ($notification->getType()) {
         case NOTIFICATION_TYPE_ALL_REVIEWS_IN:
         case NOTIFICATION_TYPE_ALL_REVISIONS_IN:
             assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ROUND && is_numeric($notification->getAssocId()));
             $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
             $reviewRound = $reviewRoundDao->getById($notification->getAssocId());
             assert(is_a($reviewRound, 'ReviewRound'));
             $submissionDao = Application::getSubmissionDAO();
             $submission = $submissionDao->getById($reviewRound->getSubmissionId());
             import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider');
             list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission);
             if ($page == 'workflow') {
                 $stageId = $reviewRound->getStageId();
                 $operation = WorkflowStageDAO::getPathFromId($stageId);
             }
             return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submission->getId());
         case NOTIFICATION_TYPE_LAYOUT_ASSIGNMENT:
         case NOTIFICATION_TYPE_INDEX_ASSIGNMENT:
         case NOTIFICATION_TYPE_APPROVE_SUBMISSION:
             assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION && is_numeric($notification->getAssocId()));
             return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'workflow', 'access', $notification->getAssocId());
         case NOTIFICATION_TYPE_REVIEWER_COMMENT:
             assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ASSIGNMENT && is_numeric($notification->getAssocId()));
             $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
             /* @var $reviewAssignmentDao ReviewAssignmentDAO */
             $reviewAssignment = $reviewAssignmentDao->getById($notification->getAssocId());
             $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
             $operation = $reviewAssignment->getStageId() == WORKFLOW_STAGE_ID_INTERNAL_REVIEW ? WORKFLOW_STAGE_PATH_INTERNAL_REVIEW : WORKFLOW_STAGE_PATH_EXTERNAL_REVIEW;
             return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'workflow', $operation, $reviewAssignment->getSubmissionId());
         case NOTIFICATION_TYPE_REVIEW_ASSIGNMENT:
             $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
             /* @var $reviewAssignmentDao ReviewAssignmentDAO */
             $reviewAssignment = $reviewAssignmentDao->getById($notification->getAssocId());
             return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'reviewer', 'submission', $reviewAssignment->getSubmissionId());
         case NOTIFICATION_TYPE_NEW_ANNOUNCEMENT:
             assert($notification->getAssocType() == ASSOC_TYPE_ANNOUNCEMENT);
             $announcementDao = DAORegistry::getDAO('AnnouncementDAO');
             /* @var $announcementDao AnnouncementDAO */
             $announcement = $announcementDao->getById($notification->getAssocId());
             /* @var $announcement Announcement */
             $context = $contextDao->getById($announcement->getAssocId());
             return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'announcement', 'view', array($notification->getAssocId()));
         case NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD:
             return __('notification.type.configurePaymentMethod');
     }
     return $this->getByDelegate($notification->getType(), $notification->getAssocType(), $notification->getAssocId(), __FUNCTION__, array($request, $notification));
 }
コード例 #2
0
 /**
  * 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;
 }
コード例 #3
0
 /**
  * Construct a URL for the notification based on its type and associated object
  * @copydoc INotificationInfoProvider::getNotificationContents()
  */
 public function getNotificationUrl($request, $notification)
 {
     $dispatcher = Application::getDispatcher();
     $contextDao = Application::getContextDAO();
     $context = $contextDao->getById($notification->getContextId());
     switch ($notification->getType()) {
         case NOTIFICATION_TYPE_ALL_REVIEWS_IN:
         case NOTIFICATION_TYPE_ALL_REVISIONS_IN:
             assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ROUND && is_numeric($notification->getAssocId()));
             $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
             $reviewRound = $reviewRoundDao->getById($notification->getAssocId());
             assert(is_a($reviewRound, 'ReviewRound'));
             $submissionDao = Application::getSubmissionDAO();
             $submission = $submissionDao->getById($reviewRound->getSubmissionId());
             import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider');
             list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission);
             if ($page == 'workflow') {
                 $stageId = $reviewRound->getStageId();
                 $operation = WorkflowStageDAO::getPathFromId($stageId);
             }
             return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submission->getId());
         case NOTIFICATION_TYPE_LAYOUT_ASSIGNMENT:
         case NOTIFICATION_TYPE_INDEX_ASSIGNMENT:
         case NOTIFICATION_TYPE_APPROVE_SUBMISSION:
             assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION && is_numeric($notification->getAssocId()));
             return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'workflow', 'access', $notification->getAssocId());
         case NOTIFICATION_TYPE_AUDITOR_REQUEST:
         case NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT:
             assert($notification->getAssocType() == ASSOC_TYPE_SIGNOFF);
             $signoffDao = DAORegistry::getDAO('SignoffDAO');
             /* @var $signoffDao SignoffDAO */
             $signoff = $signoffDao->getById($notification->getAssocId());
             assert(is_a($signoff, 'Signoff') && $signoff->getAssocType() == ASSOC_TYPE_SUBMISSION_FILE);
             $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
             /* @var $submissionFileDao SubmissionFileDAO */
             $submissionFile = $submissionFileDao->getLatestRevision($signoff->getAssocId());
             assert(is_a($submissionFile, 'SubmissionFile'));
             $submissionDao = Application::getSubmissionDAO();
             $submission = $submissionDao->getById($submissionFile->getSubmissionId());
             // Get correct page (author dashboard or workflow), based
             // on user roles (if only author, go to author dashboard).
             import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider');
             list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission);
             // If workflow, get the correct operation (stage).
             if ($page == 'workflow') {
                 $stageId = $signoffDao->getStageIdBySymbolic($signoff->getSymbolic());
                 $operation = WorkflowStageDAO::getPathFromId($stageId);
             }
             return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submissionFile->getSubmissionId());
         case NOTIFICATION_TYPE_REVIEW_ASSIGNMENT:
             $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
             /* @var $reviewAssignmentDao ReviewAssignmentDAO */
             $reviewAssignment = $reviewAssignmentDao->getById($notification->getAssocId());
             return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'reviewer', 'submission', $reviewAssignment->getSubmissionId());
         case NOTIFICATION_TYPE_NEW_ANNOUNCEMENT:
             assert($notification->getAssocType() == ASSOC_TYPE_ANNOUNCEMENT);
             $announcementDao = DAORegistry::getDAO('AnnouncementDAO');
             /* @var $announcementDao AnnouncementDAO */
             $announcement = $announcementDao->getById($notification->getAssocId());
             /* @var $announcement Announcement */
             $context = $contextDao->getById($announcement->getAssocId());
             return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'announcement', 'view', array($notification->getAssocId()));
         case NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD:
             return __('notification.type.configurePaymentMethod');
     }
     return $this->getByDelegate($notification->getType(), $notification->getAssocType(), $notification->getAssocId(), __FUNCTION__, array($request, $notification));
 }
コード例 #4
0
 /**
  * Create and return a submission node.
  * @param $doc DOMDocument
  * @param $submission Submission
  * @return DOMElement
  */
 function createSubmissionNode($doc, $submission)
 {
     // Create the root node and attributes
     $deployment = $this->getDeployment();
     $deployment->setSubmission($submission);
     $submissionNode = $doc->createElementNS($deployment->getNamespace(), $deployment->getSubmissionNodeName());
     $submissionNode->setAttribute('locale', $submission->getLocale());
     $submissionLanguage = $submission->getLanguage();
     if ($submissionLanguage) {
         $submissionNode->setAttribute('locale', $submissionLanguage);
     }
     $submissionNode->setAttribute('date_submitted', strftime('%F', strtotime($submission->getDateSubmitted())));
     $workflowStageDao = DAORegistry::getDAO('WorkflowStageDAO');
     $submissionNode->setAttribute('stage', WorkflowStageDAO::getPathFromId($submission->getStageId()));
     if ($datePublished = $submission->getDatePublished()) {
         $submissionNode->setAttribute('date_published', strftime('%F', strtotime($datePublished)));
     }
     // FIXME: language attribute (from old DTD). Necessary? Data migration needed?
     $this->addIdentifiers($doc, $submissionNode, $submission);
     $this->addMetadata($doc, $submissionNode, $submission);
     $this->addAuthors($doc, $submissionNode, $submission);
     $this->addFiles($doc, $submissionNode, $submission);
     $this->addRepresentations($doc, $submissionNode, $submission);
     return $submissionNode;
 }