2 namespace wcf\system\user\notification\event;
3 use wcf\data\user\User;
4 use wcf\system\comment\CommentDataHandler;
5 use wcf\system\request\LinkHandler;
8 * User notification event for profile commment responses.
10 * @author Alexander Ebert
11 * @copyright 2001-2014 WoltLab GmbH
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13 * @package com.woltlab.wcf
14 * @subpackage system.user.notification.event
15 * @category Community Framework
17 class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUserNotificationEvent {
19 * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
21 protected $stackable = true;
24 * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::prepare()
26 protected function prepare() {
27 CommentDataHandler::getInstance()->cacheCommentID($this->userNotificationObject->commentID);
28 CommentDataHandler::getInstance()->cacheUserID($this->additionalData['objectID']);
29 CommentDataHandler::getInstance()->cacheUserID($this->additionalData['userID']);
33 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
35 public function getTitle() {
36 $count = count($this->getAuthors());
38 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.title.stacked', array(
40 'timesTriggered' => $this->timesTriggered
44 return $this->getLanguage()->get('wcf.user.notification.commentResponse.title');
48 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
50 public function getMessage() {
51 $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
52 $owner = CommentDataHandler::getInstance()->getUser($comment->objectID);
54 $authors = array_values($this->getAuthors());
55 $count = count($authors);
57 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message.stacked', array(
58 'authors' => $authors,
60 'others' => $count - 1,
65 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message', array(
66 'author' => $this->author,
72 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
74 public function getEmailMessage($notificationType = 'instant') {
75 $authors = array_values($this->getAuthors());
76 $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
77 $count = count($authors);
78 $owner = CommentDataHandler::getInstance()->getUser($comment->objectID);
81 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail.stacked', array(
82 'author' => $this->author,
83 'authors' => $authors,
85 'notificationType' => $notificationType,
86 'others' => $count - 1,
88 'response' => $this->userNotificationObject
92 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail', array(
93 'response' => $this->userNotificationObject,
94 'author' => $this->author,
96 'notificationType' => $notificationType
101 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
103 public function getLink() {
104 $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
105 $user = CommentDataHandler::getInstance()->getUser($comment->objectID);
107 return LinkHandler::getInstance()->getLink('User', array('object' => $user), '#wall');
111 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
113 public function getEventHash() {
114 return sha1($this->eventID . '-' . $this->userNotificationObject->commentID);