00001 <?php
00002
00017 import('lib.pkp.classes.notification.PKPNotificationManager');
00018
00019 class NotificationManager extends PKPNotificationManager {
00023 function NotificationManager() {
00024 parent::PKPNotificationManager();
00025 }
00026
00027
00028
00029
00030
00034 function getNotificationUrl(&$request, &$notification) {
00035 $router =& $request->getRouter();
00036 $dispatcher =& $router->getDispatcher();
00037
00038 $type = $notification->getType();
00039 $pressDao =& DAORegistry::getDAO('PressDAO');
00040 $pressId = $notification->getContextId();
00041 assert($pressId);
00042 $press =& $pressDao->getById($pressId);
00043
00044 switch ($type) {
00045 case NOTIFICATION_TYPE_MONOGRAPH_SUBMITTED:
00046 case NOTIFICATION_TYPE_METADATA_MODIFIED:
00047 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED:
00048 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00049 return $dispatcher->url($request, ROUTE_PAGE, $press->getPath(), 'workflow', 'submission', $notification->getAssocId());
00050 case NOTIFICATION_TYPE_LAYOUT_ASSIGNMENT:
00051 case NOTIFICATION_TYPE_INDEX_ASSIGNMENT:
00052 case NOTIFICATION_TYPE_APPROVE_SUBMISSION:
00053 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00054 return $dispatcher->url($request, ROUTE_PAGE, $press->getPath(), 'workflow', 'access', $notification->getAssocId());
00055 case NOTIFICATION_TYPE_AUDITOR_REQUEST:
00056 case NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT:
00057 $signoffDao =& DAORegistry::getDAO('SignoffDAO');
00058 $signoff =& $signoffDao->getById($notification->getAssocId());
00059 assert(is_a($signoff, 'Signoff') && $signoff->getAssocType() == ASSOC_TYPE_MONOGRAPH_FILE);
00060
00061 $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
00062 $monographFile =& $submissionFileDao->getLatestRevision($signoff->getAssocId());
00063 assert(is_a($monographFile, 'MonographFile'));
00064
00065 $monographDao =& DAORegistry::getDAO('MonographDAO');
00066 $monograph =& $monographDao->getById($monographFile->getMonographId());
00067
00068
00069
00070 import('controllers.grid.submissions.SubmissionsListGridCellProvider');
00071 list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $monograph);
00072
00073
00074 if ($page == 'workflow') {
00075 $stageId = $signoffDao->getStageIdBySymbolic($signoff->getSymbolic());
00076 $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
00077 $operation = $userGroupDao->getPathFromId($stageId);
00078 }
00079
00080 return $dispatcher->url($request, ROUTE_PAGE, $press->getPath(), $page, $operation, $monographFile->getMonographId());
00081 case NOTIFICATION_TYPE_REVIEW_ASSIGNMENT:
00082 $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
00083 $reviewAssignment =& $reviewAssignmentDao->getById($notification->getAssocId());
00084 return $dispatcher->url($request, ROUTE_PAGE, $press->getPath(), 'reviewer', 'submission', $reviewAssignment->getSubmissionId());
00085 case NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS:
00086 case NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS:
00087 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00088 return $this->_getPendingRevisionUrl($request, $notification);
00089 case NOTIFICATION_TYPE_NEW_ANNOUNCEMENT:
00090 assert($notification->getAssocType() == ASSOC_TYPE_ANNOUNCEMENT);
00091 $announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
00092 $announcement = $announcementDao->getById($notification->getAssocId());
00093 $pressId = $announcement->getAssocId();
00094 $pressDao =& DAORegistry::getDAO('PressDAO');
00095 $press =& $pressDao->getById($pressId);
00096 return $dispatcher->url($request, ROUTE_PAGE, null, $press->getPath(), 'index', array($notification->getAssocId()));
00097 case NOTIFICATION_TYPE_ALL_REVIEWS_IN:
00098 case NOTIFICATION_TYPE_ALL_REVISIONS_IN:
00099 assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ROUND && is_numeric($notification->getAssocId()));
00100 $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
00101 $reviewRound =& $reviewRoundDao->getReviewRoundById($notification->getAssocId());
00102 assert(is_a($reviewRound, 'ReviewRound'));
00103
00104 $monographDao =& DAORegistry::getDAO('MonographDAO');
00105 $monograph =& $monographDao->getById($reviewRound->getSubmissionId());
00106 import('controllers.grid.submissions.SubmissionsListGridCellProvider');
00107 list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $monograph);
00108
00109 if ($page == 'workflow') {
00110 $stageId = $reviewRound->getStageId();
00111 $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
00112 $operation = $userGroupDao->getPathFromId($stageId);
00113 }
00114
00115 return $dispatcher->url($request, ROUTE_PAGE, $press->getPath(), $page, $operation, $monograph->getId());
00116 case NOTIFICATION_TYPE_APPROVE_SUBMISSION:
00117 break;
00118 case NOTIFICATION_TYPE_VISIT_CATALOG:
00119 return $dispatcher->url($request, ROUTE_PAGE, 'manageCatalog');
00120 }
00121
00122 return parent::getNotificationUrl($request, $notification);
00123 }
00124
00128 function getNotificationMessage(&$request, &$notification) {
00129 $type = $notification->getType();
00130 assert(isset($type));
00131 $contents = array();
00132 $monographDao =& DAORegistry::getDAO('MonographDAO');
00133
00134 switch ($type) {
00135 case NOTIFICATION_TYPE_MONOGRAPH_SUBMITTED:
00136 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00137 $monograph =& $monographDao->getById($notification->getAssocId());
00138 $title = $monograph->getLocalizedTitle();
00139 return __('notification.type.monographSubmitted', array('title' => $title));
00140 case NOTIFICATION_TYPE_REVIEWER_COMMENT:
00141 assert($$notification->getAssocType() == ASSOC_TYPE_REVIEW_ASSIGNMENT && is_numeric($$notification->getAssocId()));
00142 $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
00143 $reviewAssignment =& $reviewAssignmentDao->getById($notification->getAssocId());
00144 $monograph =& $monographDao->getById($reviewAssignment->getSubmissionId());
00145 $title = $monograph->getLocalizedTitle();
00146 return __('notification.type.reviewerComment', array('title' => $title));
00147 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_SUBMISSION:
00148 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_INTERNAL_REVIEW:
00149 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EXTERNAL_REVIEW:
00150 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00151 return __('notification.type.editorAssignment');
00152 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED:
00153 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00154 return __('notification.type.editorAssignmentTask');
00155 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EDITING:
00156 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00157 return __('notification.type.editorAssignmentEditing');
00158 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_PRODUCTION:
00159 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00160 return __('notification.type.editorAssignmentProduction');
00161 case NOTIFICATION_TYPE_LAYOUT_ASSIGNMENT:
00162 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00163 $monograph =& $monographDao->getById($notification->getAssocId());
00164 return __('notification.type.layouteditorRequest', array('title' => $monograph->getLocalizedTitle()));
00165 case NOTIFICATION_TYPE_INDEX_ASSIGNMENT:
00166 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00167 $monograph =& $monographDao->getById($notification->getAssocId());
00168 return __('notification.type.indexRequest', array('title' => $monograph->getLocalizedTitle()));
00169 case NOTIFICATION_TYPE_AUDITOR_REQUEST:
00170 assert($notification->getAssocType() == ASSOC_TYPE_SIGNOFF && is_numeric($notification->getAssocId()));
00171 $signoffDao =& DAORegistry::getDAO('SignoffDAO');
00172 $signoff =& $signoffDao->getById($notification->getAssocId());
00173 assert($signoff->getAssocType() == ASSOC_TYPE_MONOGRAPH_FILE);
00174
00175 $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
00176 $monographFile =& $submissionFileDao->getLatestRevision($signoff->getAssocId());
00177 return __('notification.type.auditorRequest', array('file' => $monographFile->getLocalizedName()));
00178 case NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT:
00179 assert($notification->getAssocType() == ASSOC_TYPE_SIGNOFF && is_numeric($notification->getAssocId()));
00180 $signoffDao =& DAORegistry::getDAO('SignoffDAO');
00181 $signoff =& $signoffDao->getById($notification->getAssocId());
00182 assert($signoff->getAssocType() == ASSOC_TYPE_MONOGRAPH_FILE);
00183
00184 $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
00185 $monographFile =& $submissionFileDao->getLatestRevision($signoff->getAssocId());
00186 return __('notification.type.copyeditorRequest', array('file' => $monographFile->getLocalizedName()));
00187 case NOTIFICATION_TYPE_REVIEW_ASSIGNMENT:
00188 return __('notification.type.reviewAssignment');
00189 case NOTIFICATION_TYPE_SIGNOFF_COPYEDIT:
00190 case NOTIFICATION_TYPE_SIGNOFF_PROOF:
00191 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00192 AppLocale::requireComponents(LOCALE_COMPONENT_OMP_SUBMISSION);
00193 return __('submission.upload.signoff');
00194 case NOTIFICATION_TYPE_EDITOR_DECISION_INTERNAL_REVIEW:
00195 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00196 return __('notification.type.editorDecisionInternalReview');
00197 case NOTIFICATION_TYPE_EDITOR_DECISION_ACCEPT:
00198 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00199 return __('notification.type.editorDecisionAccept');
00200 case NOTIFICATION_TYPE_EDITOR_DECISION_EXTERNAL_REVIEW:
00201 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00202 return __('notification.type.editorDecisionExternalReview');
00203 case NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS:
00204 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00205 return __('notification.type.editorDecisionPendingRevisions');
00206 case NOTIFICATION_TYPE_EDITOR_DECISION_RESUBMIT:
00207 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00208 return __('notification.type.editorDecisionResubmit');
00209 case NOTIFICATION_TYPE_EDITOR_DECISION_DECLINE:
00210 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00211 return __('notification.type.editorDecisionDecline');
00212 case NOTIFICATION_TYPE_EDITOR_DECISION_SEND_TO_PRODUCTION:
00213 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00214 return __('notification.type.editorDecisionSendToProduction');
00215 case NOTIFICATION_TYPE_REVIEW_ROUND_STATUS:
00216 assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ROUND && is_numeric($notification->getAssocId()));
00217 $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
00218 $reviewRound =& $reviewRoundDao->getReviewRoundById($notification->getAssocId());
00219
00220 AppLocale::requireComponents(LOCALE_COMPONENT_OMP_EDITOR);
00221 return __($reviewRound->getStatusKey());
00222 case NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS:
00223 case NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS:
00224 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00225 return $this->_getPendingRevisionMessage($notification);
00226 case NOTIFICATION_TYPE_ALL_REVIEWS_IN:
00227 case NOTIFICATION_TYPE_ALL_REVISIONS_IN:
00228 if ($type == NOTIFICATION_TYPE_ALL_REVIEWS_IN) {
00229 $localeKey = 'notification.type.allReviewsIn';
00230 } else {
00231 $localeKey = 'notification.type.allRevisionsIn';
00232 }
00233
00234 assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ROUND && is_numeric($notification->getAssocId()));
00235 $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
00236 $reviewRound =& $reviewRoundDao->getReviewRoundById($notification->getAssocId());
00237 assert(is_a($reviewRound, 'ReviewRound'));
00238 $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
00239 $stagesData = $userGroupDao->getWorkflowStageKeysAndPaths();
00240 return __($localeKey, array('stage' => __($stagesData[$reviewRound->getStageId()]['translationKey'])));
00241 case NOTIFICATION_TYPE_APPROVE_SUBMISSION:
00242 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00243 return __('notification.type.approveSubmission');
00244 case NOTIFICATION_TYPE_FORMAT_NEEDS_APPROVED_SUBMISSION:
00245 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00246 return __('notification.type.formatNeedsApprovedSubmission');
00247 case NOTIFICATION_TYPE_VISIT_CATALOG:
00248 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00249 return __('notification.type.visitCatalog');
00250 case NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD:
00251 assert($notification->getAssocType() == ASSOC_TYPE_PRESS && is_numeric($notification->getAssocId()));
00252 return __('notification.type.configurePaymentMethod');
00253 }
00254 return parent::getNotificationMessage($request, $notification);
00255 }
00256
00262 function getNotificationTitle(&$notification) {
00263 $type = $notification->getType();
00264 assert(isset($type));
00265
00266 switch ($type) {
00267 case NOTIFICATION_TYPE_SIGNOFF_COPYEDIT:
00268 case NOTIFICATION_TYPE_SIGNOFF_PROOF:
00269 return __('notification.type.signoff');
00270 case NOTIFICATION_TYPE_EDITOR_DECISION_INTERNAL_REVIEW:
00271 case NOTIFICATION_TYPE_EDITOR_DECISION_ACCEPT:
00272 case NOTIFICATION_TYPE_EDITOR_DECISION_EXTERNAL_REVIEW:
00273 case NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS:
00274 case NOTIFICATION_TYPE_EDITOR_DECISION_RESUBMIT:
00275 case NOTIFICATION_TYPE_EDITOR_DECISION_DECLINE:
00276 case NOTIFICATION_TYPE_EDITOR_DECISION_SEND_TO_PRODUCTION:
00277 return __('notification.type.editorDecisionTitle');
00278 case NOTIFICATION_TYPE_APPROVE_SUBMISSION:
00279 case NOTIFICATION_TYPE_FORMAT_NEEDS_APPROVED_SUBMISSION:
00280 return __('notification.type.approveSubmissionTitle');
00281 case NOTIFICATION_TYPE_VISIT_CATALOG:
00282 return __('notification.type.visitCatalogTitle');
00283 case NOTIFICATION_TYPE_REVIEW_ROUND_STATUS:
00284 $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
00285 $reviewRound =& $reviewRoundDao->getReviewRoundById($notification->getAssocId());
00286 return __('notification.type.roundStatusTitle', array('round' => $reviewRound->getRound()));
00287 case NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS:
00288 case NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS:
00289 $stageData = $this->_getStageDataByPendingRevisionsType($notification->getType());
00290 $stageKey = $stageData['translationKey'];
00291 return __('notification.type.pendingRevisions.title', array('stage' => __($stageKey)));
00292 case NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD:
00293 return __('notification.type.configurePaymentMethod.title');
00294 }
00295 return parent::getNotificationTitle($notification);
00296 }
00297
00301 function getNotificationContents(&$request, &$notification) {
00302 $type = $notification->getType();
00303 assert(isset($type));
00304
00305 $notificationMessage = parent::getNotificationContents($request, $notification);
00306
00307 switch($type) {
00308 case NOTIFICATION_TYPE_SIGNOFF_COPYEDIT:
00309 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00310 return $this->_getSignoffNotificationContents($request, $notification, 'SIGNOFF_COPYEDITING', $notificationMessage);
00311 case NOTIFICATION_TYPE_SIGNOFF_PROOF:
00312 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00313 return $this->_getSignoffNotificationContents($request, $notification, 'SIGNOFF_PROOFING', $notificationMessage);
00314 case NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS:
00315 case NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS:
00316 assert($notification->getAssocType() == ASSOC_TYPE_MONOGRAPH && is_numeric($notification->getAssocId()));
00317 return $this->_getPendingRevisionContents($request, $notification, $notificationMessage);
00318 }
00319
00320 return $notificationMessage;
00321 }
00322
00328 function getIconClass(&$notification) {
00329 switch ($notification->getType()) {
00330 case NOTIFICATION_TYPE_MONOGRAPH_SUBMITTED:
00331 return 'notifyIconNewPage';
00332 case NOTIFICATION_TYPE_METADATA_MODIFIED:
00333 return 'notifyIconEdit';
00334 case NOTIFICATION_TYPE_REVIEWER_COMMENT:
00335 return 'notifyIconNewComment';
00336 }
00337 return parent::getIconClass($notification);
00338 }
00339
00345 function getStyleClass(&$notification) {
00346 switch ($notification->getType()) {
00347 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_INTERNAL_REVIEW:
00348 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EXTERNAL_REVIEW:
00349 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EDITING:
00350 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_PRODUCTION:
00351 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_SUBMISSION:
00352 case NOTIFICATION_TYPE_AUDITOR_REQUEST:
00353 case NOTIFICATION_TYPE_LAYOUT_ASSIGNMENT:
00354 case NOTIFICATION_TYPE_INDEX_ASSIGNMENT:
00355 case NOTIFICATION_TYPE_SIGNOFF_COPYEDIT:
00356 case NOTIFICATION_TYPE_SIGNOFF_PROOF:
00357 case NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS:
00358 case NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS:
00359 case NOTIFICATION_TYPE_ALL_REVIEWS_IN:
00360 case NOTIFICATION_TYPE_ALL_REVISIONS_IN:
00361 case NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD:
00362 return 'notifyWarning';
00363 case NOTIFICATION_TYPE_EDITOR_DECISION_INTERNAL_REVIEW:
00364 case NOTIFICATION_TYPE_EDITOR_DECISION_ACCEPT:
00365 case NOTIFICATION_TYPE_EDITOR_DECISION_EXTERNAL_REVIEW:
00366 case NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS:
00367 case NOTIFICATION_TYPE_EDITOR_DECISION_RESUBMIT:
00368 case NOTIFICATION_TYPE_EDITOR_DECISION_DECLINE:
00369 case NOTIFICATION_TYPE_EDITOR_DECISION_SEND_TO_PRODUCTION:
00370 case NOTIFICATION_TYPE_REVIEW_ROUND_STATUS:
00371 case NOTIFICATION_TYPE_APPROVE_SUBMISSION:
00372 case NOTIFICATION_TYPE_VISIT_CATALOG:
00373 case NOTIFICATION_TYPE_FORMAT_NEEDS_APPROVED_SUBMISSION:
00374 case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED:
00375 return 'notifyInformation';
00376 }
00377 return parent::getStyleClass($notification);
00378 }
00379
00383 function getAllUsersNotificationTypes() {
00384 $notificationTypes = parent::getAllUsersNotificationTypes();
00385 return array_merge($notificationTypes, array(
00386 NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_SUBMISSION,
00387 NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_INTERNAL_REVIEW,
00388 NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EXTERNAL_REVIEW,
00389 NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EDITING,
00390 NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_PRODUCTION,
00391 NOTIFICATION_TYPE_REVIEW_ROUND_STATUS,
00392 NOTIFICATION_TYPE_APPROVE_SUBMISSION,
00393 NOTIFICATION_TYPE_VISIT_CATALOG,
00394 NOTIFICATION_TYPE_FORMAT_NEEDS_APPROVED_SUBMISSION,
00395 NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD,
00396 ));
00397 }
00398
00404 function getSignoffNotificationTypeByStageId($stageId) {
00405 switch ($stageId) {
00406 case WORKFLOW_STAGE_ID_EDITING:
00407 return NOTIFICATION_TYPE_SIGNOFF_COPYEDIT;
00408 case WORKFLOW_STAGE_ID_PRODUCTION:
00409 return NOTIFICATION_TYPE_SIGNOFF_PROOF;
00410 }
00411 return null;
00412 }
00413
00419 function getEditorAssignmentNotificationTypeByStageId($stageId) {
00420 switch ($stageId) {
00421 case WORKFLOW_STAGE_ID_SUBMISSION:
00422 return NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_SUBMISSION;
00423 case WORKFLOW_STAGE_ID_INTERNAL_REVIEW:
00424 return NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_INTERNAL_REVIEW;
00425 case WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
00426 return NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EXTERNAL_REVIEW;
00427 case WORKFLOW_STAGE_ID_EDITING:
00428 return NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EDITING;
00429 case WORKFLOW_STAGE_ID_PRODUCTION:
00430 return NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_PRODUCTION;
00431 }
00432 return null;
00433 }
00434
00444 function updateSignoffNotification($signoff, &$request) {
00445
00446 $symbolic = $signoff->getSymbolic();
00447 $notificationType = $this->_getSignoffNotificationTypeBySymbolic($symbolic);
00448
00449
00450
00451 if (is_null($notificationType)) {
00452 return;
00453 }
00454
00455 $press =& $request->getPress();
00456 $contextId = $press->getId();
00457 $userId = $signoff->getUserId();
00458
00459
00460 $monographFileId = $signoff->getAssocId();
00461 $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
00462 $monographFile =& $submissionFileDao->getLatestRevision($monographFileId);
00463 $monographId = $monographFile->getMonographId();
00464
00465
00466 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00467 $notificationFactory =& $notificationDao->getByAssoc(
00468 ASSOC_TYPE_MONOGRAPH,
00469 $monographId,
00470 $userId,
00471 $notificationType,
00472 $contextId
00473 );
00474
00475
00476 $monographFileSignOffDao =& DAORegistry::getDAO('MonographFileSignoffDAO');
00477 $signoffFactory =& $monographFileSignOffDao->getAllByMonograph($monographId, $symbolic, $userId);
00478 $activeSignoffs = false;
00479 if (!$signoffFactory->wasEmpty()) {
00480
00481 while (!$signoffFactory->eof()) {
00482 $workingSignoff =& $signoffFactory->next();
00483 if (!$workingSignoff->getDateCompleted()) {
00484 $activeSignoffs = true;
00485 break;
00486 }
00487 unset($workingSignoff);
00488 }
00489 }
00490
00491
00492 if (!$activeSignoffs && !$notificationFactory->wasEmpty()) {
00493
00494 $notification =& $notificationFactory->next();
00495 $notificationDao->deleteObject($notification);
00496 } else if ($activeSignoffs && $notificationFactory->wasEmpty()) {
00497
00498 $this->createNotification(
00499 $request,
00500 $userId,
00501 $notificationType,
00502 $contextId,
00503 ASSOC_TYPE_MONOGRAPH,
00504 $monographId,
00505 NOTIFICATION_LEVEL_TASK
00506 );
00507 }
00508 }
00509
00523 function updateEditorAssignmentNotification($monograph, $stageId, &$request) {
00524 $press =& $request->getPress();
00525
00526
00527 $notificationType = $this->getEditorAssignmentNotificationTypeByStageId($stageId);
00528
00529
00530 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00531 $notificationFactory =& $notificationDao->getByAssoc(
00532 ASSOC_TYPE_MONOGRAPH,
00533 $monograph->getId(),
00534 null,
00535 $notificationType,
00536 $press->getId()
00537 );
00538
00539
00540 $stageAssignmentDao =& DAORegistry::getDAO('StageAssignmentDAO');
00541 $editorAssigned = $stageAssignmentDao->editorAssignedToStage($monograph->getId(), $stageId);
00542
00543
00544 if ($editorAssigned && !$notificationFactory->wasEmpty()) {
00545
00546 $notification =& $notificationFactory->next();
00547 $notificationDao->deleteObject($notification);
00548 } else if (!$editorAssigned && $notificationFactory->wasEmpty()) {
00549
00550 $this->createNotification(
00551 $request, null, $notificationType, $press->getId(), ASSOC_TYPE_MONOGRAPH,
00552 $monograph->getId(), NOTIFICATION_LEVEL_TASK);
00553 }
00554 }
00555
00556
00565 function updateAuditorRequestNotification($signoff, &$request, $removed = false) {
00566
00567
00568 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00569 $notificationFactory =& $notificationDao->getByAssoc(
00570 ASSOC_TYPE_SIGNOFF,
00571 $signoff->getId(),
00572 $signoff->getUserId(),
00573 NOTIFICATION_TYPE_AUDITOR_REQUEST
00574 );
00575
00576
00577 $signoffCompleted = false;
00578 if (!is_null($signoff->getDateCompleted())) {
00579 $signoffCompleted = true;
00580 }
00581
00582
00583 if (($signoffCompleted || $removed) && !$notificationFactory->wasEmpty()) {
00584 $notification =& $notificationFactory->next();
00585 $notificationDao->deleteObject($notification);
00586 } else if (!$signoffCompleted && $notificationFactory->wasEmpty()) {
00587 $press =& $request->getPress();
00588 $this->createNotification(
00589 $request,
00590 $signoff->getUserId(),
00591 NOTIFICATION_TYPE_AUDITOR_REQUEST,
00592 $press->getId(),
00593 ASSOC_TYPE_SIGNOFF,
00594 $signoff->getId(),
00595 NOTIFICATION_LEVEL_TASK
00596 );
00597 }
00598 }
00599
00606 function updateCopyeditRequestNotification($signoff, $user, &$request) {
00607
00608 $signoffDao = DAORegistry::getDAO('SignoffDAO');
00609 $signoffSignoff = $signoffDao->getBySymbolic('SIGNOFF_SIGNOFF', ASSOC_TYPE_SIGNOFF, $signoff->getId());
00610 if (is_a($signoffSignoff, 'Signoff') && $signoffSignoff->getDateCompleted()) return;
00611
00612
00613 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00614 $notificationFactory =& $notificationDao->getByAssoc(
00615 ASSOC_TYPE_SIGNOFF,
00616 $signoff->getId(),
00617 $user->getId(),
00618 NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT
00619 );
00620
00621 if ($notificationFactory->wasEmpty()) {
00622 $press =& $request->getPress();
00623 PKPNotificationManager::createNotification(
00624 $request,
00625 $user->getId(),
00626 NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT,
00627 $press->getId(),
00628 ASSOC_TYPE_SIGNOFF,
00629 $signoff->getId(),
00630 NOTIFICATION_LEVEL_TASK
00631 );
00632 }
00633 }
00634
00642 function updateProductionRequestNotification($monograph, $user, $task, &$request) {
00643
00644
00645 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00646 $notificationFactory =& $notificationDao->getByAssoc(
00647 ASSOC_TYPE_MONOGRAPH,
00648 $monograph->getId(),
00649 $user->getId(),
00650 $task
00651 );
00652
00653 if ($notificationFactory->wasEmpty()) {
00654 $press =& $request->getPress();
00655 PKPNotificationManager::createNotification(
00656 $request,
00657 $user->getId(),
00658 $task,
00659 $press->getId(),
00660 ASSOC_TYPE_MONOGRAPH,
00661 $monograph->getId(),
00662 NOTIFICATION_LEVEL_TASK
00663 );
00664 }
00665 }
00666
00676 function deleteProductionRequestNotification($monograph, $user, $type, &$request) {
00677 $notificationDao = DAORegistry::getDAO('NotificationDAO');
00678 $notificationDao->deleteByAssoc(ASSOC_TYPE_MONOGRAPH, $monograph->getId(), $user->getId(), $type);
00679 }
00680
00687 function deleteEditorRequiredTaskNotification($monograph, &$request) {
00688 $notificationDao = DAORegistry::getDAO('NotificationDAO');
00689 $notificationDao->deleteByAssoc(ASSOC_TYPE_MONOGRAPH, $monograph->getId(), null, NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED);
00690 }
00691
00698 function deleteCopyeditRequestNotification($signoff, &$request) {
00699 $notificationDao = DAORegistry::getDAO('NotificationDAO');
00700 $notificationDao->deleteByAssoc(ASSOC_TYPE_SIGNOFF, $signoff->getId(), null, NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT);
00701 }
00702
00709 function updateEditorDecisionNotification($monograph, $decision, &$request) {
00710 assert($decision);
00711 $press =& $request->getPress();
00712
00713
00714 $userId = $monograph->getUserId();
00715
00716
00717 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00718 $notificationFactory =& $notificationDao->getByAssoc(
00719 ASSOC_TYPE_MONOGRAPH,
00720 $monograph->getId(),
00721 $userId,
00722 null,
00723 $press->getId()
00724 );
00725
00726 $editorDecisionNotificationTypes = $this->_getAllEditorDecisionNotificationTypes();
00727 while(!$notificationFactory->eof()) {
00728 $notification =& $notificationFactory->next();
00729 if (in_array($notification->getType(), $editorDecisionNotificationTypes)) {
00730 $notificationDao->deleteObject($notification);
00731 }
00732 }
00733
00734
00735 $notificationParams = $this->_getEditorDecisionNotificationParameters($decision);
00736 if (empty($notificationParams)) {
00737 return;
00738 }
00739
00740
00741 $this->createNotification(
00742 $request,
00743 $userId,
00744 $notificationParams['type'],
00745 $press->getId(),
00746 ASSOC_TYPE_MONOGRAPH,
00747 $monograph->getId(),
00748 $notificationParams['level']
00749 );
00750 }
00751
00758 function updatePendingRevisionsNotification(&$request, &$monograph, $stageId, $decision) {
00759 switch($stageId) {
00760 case WORKFLOW_STAGE_ID_INTERNAL_REVIEW:
00761 $notificationType = NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS;
00762 break;
00763 case WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
00764 $notificationType = NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS;
00765 break;
00766 default:
00767
00768 return;
00769 }
00770
00771 switch ($decision) {
00772 case SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS:
00773
00774 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00775
00776 $notification =& $notificationDao->newDataObject();
00777 $notification->setAssocType(ASSOC_TYPE_MONOGRAPH);
00778 $notification->setAssocId($monograph->getId());
00779 $notification->setUserId($monograph->getUserId());
00780 $notification->setType($notificationType);
00781 $notification->setLevel(NOTIFICATION_LEVEL_TASK);
00782 $notification->setContextId($monograph->getPressId());
00783
00784 $notificationDao->build($notification);
00785 break;
00786 case SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION:
00787
00788 break;
00789 default:
00790
00791 $this->deletePendingRevisionsNotification($request, $monograph, $stageId);
00792 break;
00793 }
00794 }
00795
00804 function deletePendingRevisionsNotification(&$request, &$monograph, $stageId, $userId = null) {
00805 $notificationType = null;
00806 switch ($stageId) {
00807 case WORKFLOW_STAGE_ID_INTERNAL_REVIEW:
00808 $notificationType = NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS;
00809 break;
00810 case WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
00811 $notificationType = NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS;
00812 break;
00813 default:
00814
00815 return;
00816 }
00817
00818 $notificationDao = DAORegistry::getDAO('NotificationDAO');
00819
00820 if (is_null($userId)) {
00821 $userId = $monograph->getUserId();
00822 }
00823
00824 $notificationDao->deleteByAssoc(ASSOC_TYPE_MONOGRAPH, $monograph->getId(), $userId, $notificationType, $monograph->getPressId());
00825 }
00826
00833 function insertAllRevisionsInNotification(&$request, &$reviewRound) {
00834 $press =& $request->getPress();
00835 $pressId = $press->getId();
00836
00837 $this->deleteAllRevisionsInNotification($request, $reviewRound);
00838
00839 $stageAssignmentDao =& DAORegistry::getDAO('StageAssignmentDAO');
00840 $stageAssignments = $stageAssignmentDao->getEditorsAssignedToStage($reviewRound->getSubmissionId(), $reviewRound->getStageId());
00841 foreach ($stageAssignments as $stageAssignment) {
00842 $userId = $stageAssignment->getUserId();
00843 $this->createNotification($request, $userId, NOTIFICATION_TYPE_ALL_REVISIONS_IN, $pressId,
00844 ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId(), NOTIFICATION_LEVEL_TASK);
00845 }
00846 }
00847
00854 function deleteAllRevisionsInNotification(&$request, &$reviewRound) {
00855 $press =& $request->getPress();
00856 $pressId = $press->getId();
00857 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00858
00859 $stageAssignmentDao =& DAORegistry::getDAO('StageAssignmentDAO');
00860 $stageAssignments = $stageAssignmentDao->getEditorsAssignedToStage($reviewRound->getSubmissionId(), $reviewRound->getStageId());
00861 foreach ($stageAssignments as $stageAssignment) {
00862 $userId = $stageAssignment->getUserId();
00863
00864
00865 $notificationFactory =& $notificationDao->getByAssoc(
00866 ASSOC_TYPE_REVIEW_ROUND,
00867 $reviewRound->getId(), $userId,
00868 NOTIFICATION_TYPE_ALL_REVISIONS_IN,
00869 $pressId
00870 );
00871
00872 if (!$notificationFactory->wasEmpty()) {
00873 $notification =& $notificationFactory->next();
00874 $notificationDao->deleteObject($notification);
00875 unset($notification);
00876 }
00877 }
00878 }
00879
00885 function updateAllReviewsInNotification(&$request, &$reviewRound) {
00886 $stageAssignmentDao =& DAORegistry::getDAO('StageAssignmentDAO');
00887 $stageAssignments = $stageAssignmentDao->getEditorsAssignedToStage($reviewRound->getSubmissionId(), $reviewRound->getStageId());
00888
00889
00890 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00891 $press =& $request->getPress();
00892 $pressId = $press->getId();
00893
00894 foreach ($stageAssignments as $stageAssignment) {
00895 $userId = $stageAssignment->getUserId();
00896
00897
00898 $notificationFactory =& $notificationDao->getByAssoc(
00899 ASSOC_TYPE_REVIEW_ROUND,
00900 $reviewRound->getId(), $userId,
00901 NOTIFICATION_TYPE_ALL_REVIEWS_IN,
00902 $pressId
00903 );
00904
00905 $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
00906 $currentStatus = $reviewRound->getStatus();
00907 if (in_array($currentStatus, $reviewRoundDao->getEditorDecisionRoundStatus()) ||
00908 in_array($currentStatus, array(REVIEW_ROUND_STATUS_PENDING_REVIEWERS, REVIEW_ROUND_STATUS_PENDING_REVIEWS))) {
00909
00910
00911 if (!$notificationFactory->wasEmpty()) {
00912 $notification =& $notificationFactory->next();
00913 $notificationDao->deleteObject($notification);
00914 unset($notification);
00915 }
00916 } else {
00917
00918
00919 $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
00920 if ($notificationFactory->wasEmpty()) {
00921 $this->createNotification($request, $userId, NOTIFICATION_TYPE_ALL_REVIEWS_IN, $pressId,
00922 ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId(), NOTIFICATION_LEVEL_TASK);
00923 }
00924 }
00925
00926 unset($notificationFactory);
00927 }
00928 }
00929
00936 function updateApproveSubmissionNotificationTypes(&$request, &$monograph) {
00937 $monographId = $monograph->getId();
00938 $pressId = $monograph->getPressId();
00939 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00940
00941 $notificationTypes = array(
00942 NOTIFICATION_TYPE_APPROVE_SUBMISSION => false,
00943 NOTIFICATION_TYPE_FORMAT_NEEDS_APPROVED_SUBMISSION => false,
00944 NOTIFICATION_TYPE_VISIT_CATALOG => true,
00945 );
00946
00947 $isPublished = (boolean) $monograph->getDatePublished();
00948
00949 foreach ($notificationTypes as $type => $forPublicationState) {
00950 $notificationFactory =& $notificationDao->getByAssoc(
00951 ASSOC_TYPE_MONOGRAPH,
00952 $monographId,
00953 null,
00954 $type,
00955 $pressId
00956 );
00957 $notification =& $notificationFactory->next();
00958
00959 if (!$notification && $isPublished == $forPublicationState) {
00960
00961 $this->createNotification(
00962 $request,
00963 null,
00964 $type,
00965 $pressId,
00966 ASSOC_TYPE_MONOGRAPH,
00967 $monographId,
00968 NOTIFICATION_LEVEL_NORMAL
00969 );
00970 } elseif ($notification && $isPublished != $forPublicationState) {
00971
00972 $notificationDao->deleteObject($notification);
00973 }
00974 unset($notificationFactory, $notification);
00975 }
00976 }
00977
00978
00979
00980
00981
00987 function _fetchLinkActionNotificationContent($linkAction) {
00988 $templateMgr =& TemplateManager::getManager();
00989 $templateMgr->assign('linkAction', $linkAction);
00990 return $templateMgr->fetch('controllers/notification/linkActionNotificationContent.tpl');
00991 }
00992
01001 function _getSignoffNotificationContents($request, $notification, $symbolic, $message) {
01002 $monographId = $notification->getAssocId();
01003
01004 $monographDao =& DAORegistry::getDAO('MonographDAO');
01005 $monograph =& $monographDao->getById($monographId);
01006
01007
01008 $signoffDao =& DAORegistry::getDAO('SignoffDAO');
01009 $stageId = $signoffDao->getStageIdBySymbolic($symbolic);
01010
01011 import('controllers.api.signoff.linkAction.AddSignoffFileLinkAction');
01012 $signoffFileLinkAction = new AddSignoffFileLinkAction(
01013 $request, $monographId,
01014 $stageId, $symbolic, null,
01015 $message, $message
01016 );
01017
01018 return $this->_fetchLinkActionNotificationContent($signoffFileLinkAction);
01019 }
01020
01026 function _getSignoffNotificationTypeBySymbolic($symbolic) {
01027 switch ($symbolic) {
01028 case 'SIGNOFF_COPYEDITING':
01029 return NOTIFICATION_TYPE_SIGNOFF_COPYEDIT;
01030 case 'SIGNOFF_PROOFING':
01031 return NOTIFICATION_TYPE_SIGNOFF_PROOF;
01032 default:
01033 }
01034 return null;
01035 }
01036
01041 function _getAllEditorDecisionNotificationTypes() {
01042 return array(
01043 NOTIFICATION_TYPE_EDITOR_DECISION_INTERNAL_REVIEW,
01044 NOTIFICATION_TYPE_EDITOR_DECISION_ACCEPT,
01045 NOTIFICATION_TYPE_EDITOR_DECISION_EXTERNAL_REVIEW,
01046 NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS,
01047 NOTIFICATION_TYPE_EDITOR_DECISION_RESUBMIT,
01048 NOTIFICATION_TYPE_EDITOR_DECISION_DECLINE,
01049 NOTIFICATION_TYPE_EDITOR_DECISION_SEND_TO_PRODUCTION
01050 );
01051 }
01052
01058 function _getEditorDecisionNotificationParameters($decision) {
01059
01060 import('classes.workflow.EditorDecisionActionsManager');
01061
01062 switch ($decision) {
01063 case SUBMISSION_EDITOR_DECISION_INTERNAL_REVIEW:
01064 return array(
01065 'level' => NOTIFICATION_LEVEL_NORMAL,
01066 'type' => NOTIFICATION_TYPE_EDITOR_DECISION_INTERNAL_REVIEW
01067 );
01068 case SUBMISSION_EDITOR_DECISION_ACCEPT:
01069 return array(
01070 'level' => NOTIFICATION_LEVEL_NORMAL,
01071 'type' => NOTIFICATION_TYPE_EDITOR_DECISION_ACCEPT
01072 );
01073 case SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW:
01074 return array(
01075 'level' => NOTIFICATION_LEVEL_NORMAL,
01076 'type' => NOTIFICATION_TYPE_EDITOR_DECISION_EXTERNAL_REVIEW
01077 );
01078 case SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS:
01079 return array(
01080 'level' => NOTIFICATION_LEVEL_NORMAL,
01081 'type' => NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS
01082 );
01083 case SUBMISSION_EDITOR_DECISION_RESUBMIT:
01084 return array(
01085 'level' => NOTIFICATION_LEVEL_NORMAL,
01086 'type' => NOTIFICATION_TYPE_EDITOR_DECISION_RESUBMIT
01087 );
01088 case SUBMISSION_EDITOR_DECISION_DECLINE:
01089 return array(
01090 'level' => NOTIFICATION_LEVEL_NORMAL,
01091 'type' => NOTIFICATION_TYPE_EDITOR_DECISION_DECLINE
01092 );
01093 case SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION:
01094 return array(
01095 'level' => NOTIFICATION_LEVEL_NORMAL,
01096 'type' => NOTIFICATION_TYPE_EDITOR_DECISION_SEND_TO_PRODUCTION
01097 );
01098 default:
01099 assert(false);
01100 break;
01101 }
01102 }
01103
01109 function _getPendingRevisionUrl(&$request, &$notification) {
01110 $monographDao =& DAORegistry::getDAO('MonographDAO');
01111 $monograph =& $monographDao->getById($notification->getAssocId());
01112
01113 import('controllers.grid.submissions.SubmissionsListGridCellProvider');
01114 list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $monograph);
01115
01116 if ($page == 'workflow') {
01117 $stageData = $this->_getStageDataByPendingRevisionsType($notification->getType());
01118 $operation = $stageData['path'];
01119 }
01120
01121 $router =& $request->getRouter();
01122 $dispatcher =& $router->getDispatcher();
01123 return $dispatcher->url($request, ROUTE_PAGE, null, $page, $operation, $monograph->getId());
01124 }
01125
01131 function _getPendingRevisionMessage(&$notification) {
01132 $stageData = $this->_getStageDataByPendingRevisionsType($notification->getType());
01133 $stageKey = $stageData['translationKey'];
01134
01135 return __('notification.type.pendingRevisions', array('stage' => __($stageKey)));
01136 }
01137
01145 function _getPendingRevisionContents(&$request, $notification, $message) {
01146 $stageData = $this->_getStageDataByPendingRevisionsType($notification->getType());
01147 $stageId = $stageData['id'];
01148 $monographId = $notification->getAssocId();
01149
01150 $monographDao =& DAORegistry::getDAO('MonographDAO');
01151 $monograph =& $monographDao->getById($monographId);
01152 $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
01153 $lastReviewRound =& $reviewRoundDao->getLastReviewRoundByMonographId($monograph->getId(), $stageId);
01154
01155 import('controllers.api.file.linkAction.AddRevisionLinkAction');
01156 AppLocale::requireComponents(LOCALE_COMPONENT_OMP_EDITOR);
01157
01158 $uploadFileAction = new AddRevisionLinkAction(
01159 $request, $lastReviewRound, array(ROLE_ID_AUTHOR)
01160 );
01161
01162 return $this->_fetchLinkActionNotificationContent($uploadFileAction);
01163 }
01164
01171 function _getStageDataByPendingRevisionsType($type) {
01172 $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
01173 $stagesData = $userGroupDao->getWorkflowStageKeysAndPaths();
01174
01175 switch ($type) {
01176 case NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS:
01177 return $stagesData[WORKFLOW_STAGE_ID_INTERNAL_REVIEW];
01178 case NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS:
01179 return $stagesData[WORKFLOW_STAGE_ID_EXTERNAL_REVIEW];
01180 default:
01181 assert(false);
01182 }
01183 }
01184 }
01185
01186 ?>