Open Preprint Systems  3.3.0
NotificationManager.inc.php
1 <?php
2 
17 import('lib.pkp.classes.notification.PKPNotificationManager');
18 
20  /* @var array Cache each user's most privileged role for each submission */
21  var $privilegedRoles;
22 
26  public function getNotificationUrl($request, $notification) {
27  $router = $request->getRouter();
28  $dispatcher = $router->getDispatcher();
29 
30  switch ($notification->getType()) {
31  // OPS: links leading to a new submission have to be redirected to production stage
32  case NOTIFICATION_TYPE_SUBMISSION_SUBMITTED:
33  $contextDao = Application::getContextDAO();
34  $context = $contextDao->getById($notification->getContextId());
35  return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'workflow', 'production', $notification->getAssocId());
36  default:
37  return parent::getNotificationUrl($request, $notification);
38  }
39  }
40 
46  function _getArticleTitle($notification) {
47  assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION);
48  assert(is_numeric($notification->getAssocId()));
49  $submissionDao = DAORegistry::getDAO('SubmissionDAO'); /* @var $submissionDao SubmissionDAO */
50  $article = $submissionDao->getById($notification->getAssocId());
51  if (!$article) return null;
52  return $article->getLocalizedTitle();
53  }
54 
60  function getIconClass($notification) {
61  switch ($notification->getType()) {
62  case NOTIFICATION_TYPE_NEW_ANNOUNCEMENT:
63  return 'notifyIconNewAnnouncement';
64  default: return parent::getIconClass($notification);
65  }
66  }
67 
71  protected function getMgrDelegate($notificationType, $assocType, $assocId) {
72  switch ($notificationType) {
73  case NOTIFICATION_TYPE_APPROVE_SUBMISSION:
74  assert($assocType == ASSOC_TYPE_SUBMISSION && is_numeric($assocId));
75  import('classes.notification.managerDelegate.ApproveSubmissionNotificationManager');
76  return new ApproveSubmissionNotificationManager($notificationType);
77  }
78  // Otherwise, fall back on parent class
79  return parent::getMgrDelegate($notificationType, $assocType, $assocId);
80  }
81 
82 }
83 
84 
Application\getContextDAO
static getContextDAO()
Definition: Application.inc.php:127
DAORegistry\getDAO
static & getDAO($name, $dbconn=null)
Definition: DAORegistry.inc.php:57
NotificationManager\getMgrDelegate
getMgrDelegate($notificationType, $assocType, $assocId)
Definition: NotificationManager.inc.php:74
ApproveSubmissionNotificationManager
Notification manager delegate that handles notifications related with submission approval process.
Definition: ApproveSubmissionNotificationManager.inc.php:19
PKPNotificationManager
Class for Notification Manager.
Definition: PKPNotificationManager.inc.php:20
NotificationManager\$privilegedRoles
$privilegedRoles
Definition: NotificationManager.inc.php:24
NotificationManager\_getArticleTitle
_getArticleTitle($notification)
Definition: NotificationManager.inc.php:49
NotificationManager
Definition: NotificationManager.inc.php:19
NotificationManager\getNotificationUrl
getNotificationUrl($request, $notification)
Definition: NotificationManager.inc.php:29
NotificationManager\getIconClass
getIconClass($notification)
Definition: NotificationManager.inc.php:63