Convert conversation notification to new email API
[GitHub/WoltLab/com.woltlab.wcf.conversation.git] / files / lib / system / user / notification / event / ConversationUserNotificationEvent.class.php
CommitLineData
8b467fcd
MW
1<?php
2namespace wcf\system\user\notification\event;
b313c3df 3use wcf\system\request\LinkHandler;
b41c9fd6 4use wcf\system\user\notification\object\ConversationUserNotificationObject;
8b467fcd
MW
5
6/**
7 * User notification event for conversations.
db864366 8 *
8b467fcd 9 * @author Marcel Werk
a2df5242 10 * @copyright 2001-2016 WoltLab GmbH
8b467fcd 11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
c032049e 12 * @package WoltLabSuite\Core\System\User\Notification\Event
b41c9fd6
MS
13 *
14 * @method ConversationUserNotificationObject getUserNotificationObject()
8b467fcd
MW
15 */
16class ConversationUserNotificationEvent extends AbstractUserNotificationEvent {
17 /**
9c3943b0 18 * @inheritDoc
8b467fcd 19 */
851a6133 20 public function getTitle() {
9be1b89b 21 return $this->getLanguage()->get('wcf.user.notification.conversation.title');
8b467fcd
MW
22 }
23
24 /**
9c3943b0 25 * @inheritDoc
8b467fcd 26 */
851a6133 27 public function getMessage() {
eaf1c8eb 28 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message', [
750f3d00
MW
29 'author' => $this->author,
30 'conversation' => $this->userNotificationObject
eaf1c8eb 31 ]);
8b467fcd 32 }
9be1b89b 33
be03f342 34 /** @noinspection PhpMissingParentCallCommonInspection */
9be1b89b 35 /**
9c3943b0 36 * @inheritDoc
9be1b89b 37 */
11cde7d7 38 public function getEmailMessage($notificationType = 'instant') {
fe4319fb
TD
39 return [
40 'message-id' => 'com.woltlab.wcf.conversation.notification/'.$this->getUserNotificationObject()->conversationID,
41 'template' => 'email_notification_conversation',
42 'application' => 'wcf'
43 ];
9be1b89b 44 }
b313c3df
AE
45
46 /**
9c3943b0 47 * @inheritDoc
b313c3df
AE
48 */
49 public function getLink() {
eaf1c8eb 50 return LinkHandler::getInstance()->getLink('Conversation', ['object' => $this->userNotificationObject]);
b313c3df 51 }
cb5aea49 52
be03f342 53 /** @noinspection PhpMissingParentCallCommonInspection */
cb5aea49 54 /**
9c3943b0 55 * @inheritDoc
cb5aea49
MS
56 */
57 public function checkAccess() {
b41c9fd6 58 return $this->getUserNotificationObject()->canRead();
cb5aea49 59 }
8b467fcd 60}