2 namespace wcf\system\user\notification\event;
3 use wcf\data\comment\Comment;
4 use wcf\data\user\User;
5 use wcf\system\request\LinkHandler;
6 use wcf\system\user\notification\event\AbstractUserNotificationEvent;
9 * User notification event for profile commment responses.
11 * @author Alexander Ebert
12 * @copyright 2001-2014 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 * @package com.woltlab.wcf
15 * @subpackage system.user.notification.event
16 * @category Community Framework
18 class UserProfileCommentResponseUserNotificationEvent extends AbstractUserNotificationEvent {
20 * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
22 protected $stackable = true;
25 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
27 public function getTitle() {
28 $count = count($this->getAuthors());
30 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.title.stacked', array(
32 'timesTriggered' => $this->timesTriggered
36 return $this->getLanguage()->get('wcf.user.notification.commentResponse.title');
40 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
42 public function getMessage() {
43 // @todo: use cache or a single query to retrieve required data
44 $comment = new Comment($this->userNotificationObject->commentID);
45 $owner = new User($comment->objectID);
46 if ($comment->userID) {
47 $commentAuthor = new User($comment->userID);
50 $commentAuthor = new User(null, array(
51 'username' => $comment->username
55 $authors = array_values($this->getAuthors());
56 $count = count($authors);
58 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message.stacked', array(
59 'authors' => $authors,
61 'others' => max($count - 1, 0),
66 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message', array(
67 'author' => $this->author,
73 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
75 public function getEmailMessage($notificationType = 'instant') {
76 $comment = new Comment($this->userNotificationObject->commentID);
77 $user = new User($comment->objectID);
79 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail', array(
80 'response' => $this->userNotificationObject,
81 'author' => $this->author,
83 'notificationType' => $notificationType
88 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
90 public function getLink() {
91 // @todo: use cache or a single query to retrieve required data
92 $comment = new Comment($this->userNotificationObject->commentID);
93 $user = new User($comment->objectID);
95 return LinkHandler::getInstance()->getLink('User', array('object' => $user), '#wall');
99 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
101 public function getEventHash() {
102 return sha1($this->eventID . '-' . $this->userNotificationObject->commentID);