2 namespace wcf\system\user\notification\event;
3 use wcf\system\comment\CommentDataHandler;
4 use wcf\system\request\LinkHandler;
7 * User notification event for profile commment responses.
9 * @author Alexander Ebert
10 * @copyright 2001-2015 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package com.woltlab.wcf
13 * @subpackage system.user.notification.event
14 * @category Community Framework
16 class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUserNotificationEvent {
18 * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
20 protected $stackable = true;
23 * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::prepare()
25 protected function prepare() {
26 CommentDataHandler::getInstance()->cacheCommentID($this->userNotificationObject->commentID);
27 CommentDataHandler::getInstance()->cacheUserID($this->additionalData['objectID']);
28 CommentDataHandler::getInstance()->cacheUserID($this->additionalData['userID']);
32 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
34 public function getTitle() {
35 $count = count($this->getAuthors());
37 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.title.stacked', array(
39 'timesTriggered' => $this->notification->timesTriggered
43 return $this->getLanguage()->get('wcf.user.notification.commentResponse.title');
47 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
49 public function getMessage() {
50 $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
51 $owner = CommentDataHandler::getInstance()->getUser($comment->objectID);
53 $authors = $this->getAuthors();
54 if (count($authors) > 1) {
55 if (isset($authors[0])) {
58 $count = count($authors);
60 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message.stacked', array(
61 'authors' => array_values($authors),
63 'others' => $count - 1,
65 'guestTimesTriggered' => $this->notification->guestTimesTriggered
69 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message', array(
70 'author' => $this->author,
76 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
78 public function getEmailMessage($notificationType = 'instant') {
79 $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
80 $owner = CommentDataHandler::getInstance()->getUser($comment->objectID);
82 $authors = $this->getAuthors();
83 if (count($authors) > 1) {
84 if (isset($authors[0])) {
87 $count = count($authors);
89 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail.stacked', array(
90 'author' => $this->author,
91 'authors' => array_values($authors),
93 'notificationType' => $notificationType,
94 'others' => $count - 1,
96 'response' => $this->userNotificationObject,
97 'guestTimesTriggered' => $this->notification->guestTimesTriggered
101 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail', array(
102 'response' => $this->userNotificationObject,
103 'author' => $this->author,
105 'notificationType' => $notificationType
110 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
112 public function getLink() {
113 $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
114 $user = CommentDataHandler::getInstance()->getUser($comment->objectID);
116 return LinkHandler::getInstance()->getLink('User', array('object' => $user), '#wall');
120 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
122 public function getEventHash() {
123 return sha1($this->eventID . '-' . $this->userNotificationObject->commentID);