16 import(
'lib.pkp.classes.notification.NotificationManagerDelegate');
17 import(
'lib.pkp.classes.workflow.WorkflowStageDAO');
26 parent::__construct($notificationType);
33 return NOTIFICATION_STYLE_CLASS_WARNING;
41 $submission = $submissionDao->getById($notification->getAssocId());
43 $stageData = $this->_getStageDataByType();
44 $operation = $stageData[
'path'];
46 import(
'classes.core.Services');
47 return Services::get(
'submission')->getWorkflowUrlByUserRoles($submission, $notification->getUserId(), $stageData[
'path']);
54 $stageData = $this->_getStageDataByType();
56 $stageKey = $stageData[
'translationKey'];
58 return __(
'notification.type.pendingRevisions', array(
'stage' => __($stageKey)));
65 $stageData = $this->_getStageDataByType();
66 $stageId = $stageData[
'id'];
67 $submissionId = $notification->getAssocId();
70 $submission = $submissionDao->getById($submissionId);
72 $lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId);
74 import(
'lib.pkp.controllers.api.file.linkAction.AddRevisionLinkAction');
78 $request, $lastReviewRound, array(ROLE_ID_AUTHOR)
88 $stageData = $this->_getStageDataByType();
89 $stageKey = $stageData[
'translationKey'];
90 return __(
'notification.type.pendingRevisions.title', array(
'stage' => __($stageKey)));
97 $userId = current($userIds);
98 $submissionId = $assocId;
99 $stageData = $this->_getStageDataByType();
100 if ($stageData ==
null)
return;
101 $expectedStageId = $stageData[
'id'];
104 $pendingRevisionDecision = $editDecisionDao->findValidPendingRevisionsDecision($submissionId, $expectedStageId, SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS);
105 $removeNotifications =
false;
107 if ($pendingRevisionDecision) {
108 if ($editDecisionDao->responseExists($pendingRevisionDecision, $submissionId)) {
110 $removeNotifications =
true;
112 $context = $request->getContext();
114 $notificationFactory = $notificationDao->getByAssoc(
115 ASSOC_TYPE_SUBMISSION,
118 NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS,
121 if ($notificationFactory->wasEmpty()) {
124 $notificationDao->build(
126 NOTIFICATION_LEVEL_TASK,
127 $this->getNotificationType(),
128 ASSOC_TYPE_SUBMISSION,
137 $removeNotifications =
true;
140 if ($removeNotifications) {
141 $context = $request->getContext();
143 $notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submissionId, $userId, $this->
getNotificationType(), $context->getId());
144 $notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submissionId, $userId, NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS, $context->getId());
157 private function _getStageDataByType() {
161 case NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS:
162 return array_key_exists(WORKFLOW_STAGE_ID_INTERNAL_REVIEW, $stagesData) ? $stagesData[WORKFLOW_STAGE_ID_INTERNAL_REVIEW] :
null;
163 case NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS:
164 return $stagesData[WORKFLOW_STAGE_ID_EXTERNAL_REVIEW];