Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
SubmissionNotificationManager.inc.php
1 <?php
2 
16 import('lib.pkp.classes.notification.NotificationManagerDelegate');
17 
19 
24  function SubmissionNotificationManager($notificationType) {
25  parent::NotificationManagerDelegate($notificationType);
26  }
27 
31  public function getNotificationMessage($request, $notification) {
32  assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION && is_numeric($notification->getAssocId()));
33  $submissionDao = Application::getSubmissionDAO();
34  $submission = $submissionDao->getById($notification->getAssocId()); /* @var $submission Submission */
35 
36  switch ($notification->getType()) {
37  case NOTIFICATION_TYPE_SUBMISSION_SUBMITTED:
38  return __('notification.type.submissionSubmitted', array('title' => $submission->getLocalizedTitle()));
39  case NOTIFICATION_TYPE_METADATA_MODIFIED:
40  return __('notification.type.metadataModified', array('title' => $submission->getLocalizedTitle()));
41  case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED:
42  return __('notification.type.editorAssignmentTask');
43  default:
44  assert(false);
45  }
46  }
47 
51  public function getNotificationUrl($request, $notification) {
52  $router = $request->getRouter();
53  $dispatcher = $router->getDispatcher();
54 
55  assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION && is_numeric($notification->getAssocId()));
56  switch ($notification->getType()) {
57  case NOTIFICATION_TYPE_SUBMISSION_SUBMITTED:
58  case NOTIFICATION_TYPE_METADATA_MODIFIED:
59  case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED:
60  $contextDao = Application::getContextDAO();
61  $context = $contextDao->getById($notification->getContextId());
62  return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'workflow', 'submission', $notification->getAssocId());
63  default:
64  assert(false);
65  }
66  }
67 
71  public function getIconClass($notification) {
72  switch ($notification->getType()) {
73  case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED:
74  return 'notifyIconPageAlert';
75  case NOTIFICATION_TYPE_SUBMISSION_SUBMITTED:
76  return 'notifyIconNewPage';
77  case NOTIFICATION_TYPE_METADATA_MODIFIED:
78  return 'notifyIconEdit';
79  default:
80  assert(false);
81  }
82  }
83 
87  public function getStyleClass($notification) {
88  switch ($notification->getType()) {
89  case NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED:
90  return NOTIFICATION_STYLE_CLASS_INFORMATION;
91  case NOTIFICATION_TYPE_SUBMISSION_SUBMITTED:
92  case NOTIFICATION_TYPE_METADATA_MODIFIED:
93  return '';
94  default:
95  assert(false);
96  }
97  }
98 }
99 
100 ?>
Submission notification types manager delegate.
static getSubmissionDAO()
Abstract class to support notification manager delegates that provide default implementation to the i...
static getContextDAO()