* @package com.woltlab.wcf.conversation * @subpackage system.user.notification.event * @category Community Framework */ class ConversationMessageUserNotificationEvent extends AbstractUserNotificationEvent { /** * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable */ protected $stackable = true; /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage() */ public function getTitle() { $count = count($this->getAuthors()); if ($count > 1) { return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.title.stacked', array('count' => $count)); } return $this->getLanguage()->get('wcf.user.notification.conversation.message.title'); } /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage() */ public function getMessage() { $authors = array_values($this->getAuthors()); $count = count($authors); if ($count > 1) { return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.message.stacked', array( 'author' => $this->author, 'authors' => $authors, 'count' => $count, 'message' => $this->userNotificationObject, 'others' => $count - 1 )); } return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.message', array( 'author' => $this->author, 'message' => $this->userNotificationObject )); } /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage() */ public function getEmailMessage($notificationType = 'instant') { return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.mail', array( 'message' => $this->userNotificationObject, 'author' => $this->author, 'notificationType' => $notificationType )); } /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink() */ public function getLink() { return LinkHandler::getInstance()->getLink('Conversation', array( 'object' => $this->userNotificationObject->getConversation(), 'messageID' => $this->userNotificationObject->messageID ), '#message'.$this->userNotificationObject->messageID); } /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash() */ public function getEventHash() { return sha1($this->eventID . '-' . $this->userNotificationObject->conversationID); } /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::checkAccess() */ public function checkAccess() { return $this->userNotificationObject->getConversation()->canRead(); } }