16 import(
'lib.pkp.classes.notification.NotificationManagerDelegate');
25 parent::__construct($notificationType);
32 switch ($notification->getType()) {
33 case NOTIFICATION_TYPE_ASSIGN_COPYEDITOR:
34 return __(
'notification.type.assignCopyeditors');
35 case NOTIFICATION_TYPE_AWAITING_COPYEDITS:
36 return __(
'notification.type.awaitingCopyedits');
37 case NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER:
38 return __(
'notification.type.assignProductionUser');
39 case NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS:
40 return __(
'notification.type.awaitingRepresentations');
52 $context = $contextDao->getById($notification->getContextId());
54 switch ($notification->getType()) {
55 case NOTIFICATION_TYPE_ASSIGN_COPYEDITOR:
56 case NOTIFICATION_TYPE_AWAITING_COPYEDITS:
57 case NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER:
58 case NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS:
59 assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION && is_numeric($notification->getAssocId()));
60 return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(),
'workflow',
'access', $notification->getAssocId());
70 return NOTIFICATION_STYLE_CLASS_INFORMATION;
77 $context = $request->getContext();
78 $contextId = $context->getId();
80 assert($assocType == ASSOC_TYPE_SUBMISSION);
81 $submissionId = $assocId;
83 $submission = $submissionDao->getById($submissionId);
86 $editorStageAssignments = $stageAssignmentDao->getEditorsAssignedToStage($submissionId, $submission->getStageId());
90 $editingQueries = $queryDao->getByAssoc(ASSOC_TYPE_SUBMISSION, $submissionId, WORKFLOW_STAGE_ID_EDITING);
91 $productionQueries = $queryDao->getByAssoc(ASSOC_TYPE_SUBMISSION, $submissionId, WORKFLOW_STAGE_ID_PRODUCTION);
95 import(
'lib.pkp.classes.submission.SubmissionFile');
96 $copyeditedFiles = $submissionFileDao->getLatestRevisions($submissionId, SUBMISSION_FILE_COPYEDIT);
100 $representations = $representationDao->getByPublicationId($submission->getLatestPublication()->getId());
104 foreach ($editorStageAssignments as $editorStageAssignment) {
105 switch ($submission->getStageId()) {
106 case WORKFLOW_STAGE_ID_PRODUCTION:
107 if ($notificationType == NOTIFICATION_TYPE_ASSIGN_COPYEDITOR || $notificationType == NOTIFICATION_TYPE_AWAITING_COPYEDITS) {
109 $this->
_removeNotification($submissionId, $editorStageAssignment->getUserId(), $notificationType, $contextId);
112 if (!$representations->wasEmpty()) {
114 $this->
_removeNotification($submissionId, $editorStageAssignment->getUserId(), $notificationType, $contextId);
117 if (!$productionQueries->wasEmpty()) {
118 if ($notificationType == NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS) {
123 $editorStageAssignment->getUserId(),
127 } elseif ($notificationType == NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER) {
129 $this->
_removeNotification($submissionId, $editorStageAssignment->getUserId(), $notificationType, $contextId);
132 if ($notificationType == NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER) {
137 $editorStageAssignment->getUserId(),
141 } elseif ($notificationType == NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS) {
143 $this->
_removeNotification($submissionId, $editorStageAssignment->getUserId(), $notificationType, $contextId);
149 case WORKFLOW_STAGE_ID_EDITING:
150 if (!empty($copyeditedFiles)) {
152 $this->
_removeNotification($submissionId, $editorStageAssignment->getUserId(), $notificationType, $contextId);
155 if (!$editingQueries->wasEmpty()) {
156 if ($notificationType == NOTIFICATION_TYPE_AWAITING_COPYEDITS) {
161 $editorStageAssignment->getUserId(),
165 } elseif ($notificationType == NOTIFICATION_TYPE_ASSIGN_COPYEDITOR) {
167 $this->
_removeNotification($submissionId, $editorStageAssignment->getUserId(), $notificationType, $contextId);
170 if ($notificationType == NOTIFICATION_TYPE_ASSIGN_COPYEDITOR) {
175 $editorStageAssignment->getUserId(),
179 } elseif ($notificationType == NOTIFICATION_TYPE_AWAITING_COPYEDITS) {
181 $this->
_removeNotification($submissionId, $editorStageAssignment->getUserId(), $notificationType, $contextId);
202 $notificationDao->deleteByAssoc(
203 ASSOC_TYPE_SUBMISSION,
221 $notificationFactory = $notificationDao->getByAssoc(
222 ASSOC_TYPE_SUBMISSION,
228 if ($notificationFactory->wasEmpty()) {
230 $notificationMgr->createNotification(
235 ASSOC_TYPE_SUBMISSION,
237 NOTIFICATION_LEVEL_NORMAL,