15 import(
'lib.pkp.classes.notification.NotificationManagerDelegate');
26 $this->_announcement = $announcement;
33 return __(
'emails.announcement.subject');
40 return Services::get(
'emailTemplate')->getByKey($notification->getContextId(),
'ANNOUNCEMENT');
47 return $request->getDispatcher()->url(
50 $request->getContext()->getData(
'path'),
53 $this->_announcement->getId()
61 return 'notifyIconInfo';
68 return NOTIFICATION_STYLE_CLASS_INFORMATION;
77 return parent::createNotification(
80 NOTIFICATION_TYPE_NEW_ANNOUNCEMENT,
81 $this->_announcement->getAssocId(),
84 NOTIFICATION_LEVEL_NORMAL,
85 array(
'contents' => $this->_announcement->getLocalizedTitle()),
87 function ($mail) use ($user) {
88 return $this->_setupMessage($mail, $user);
97 $contextId = $this->_announcement->getAssocId();
99 if ($context->getId() != $contextId) {
102 import(
'lib.pkp.classes.mail.MailTemplate');
103 $mail =
new MailTemplate(
'ANNOUNCEMENT',
null, $context,
false);
113 private function _setupMessage(
Mail $mail,
User $user) :
Mail {
114 $mail->assignParams($this->_getMessageParams($user));
122 private function _getMessageParams() : array {
124 'title' => $this->_announcement->getLocalizedTitle(),
125 'summary' => $this->_announcement->getLocalizedDescriptionShort(),
126 'announcement' => $this->_announcement->getLocalizedDescription(),
133 $this->_announcement->getId()