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;
10 * User notification event for profile's owner for commment responses.
12 * @author Alexander Ebert
13 * @copyright 2001-2014 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package com.woltlab.wcf
16 * @subpackage system.user.notification.event
17 * @category Community Framework
19 class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractUserNotificationEvent {
21 * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
23 protected $stackable = true;
26 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
28 public function getTitle() {
29 $count = count($this->getAuthors());
31 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.title.stacked', array(
33 'timesTriggered' => $this->timesTriggered
37 return $this->getLanguage()->get('wcf.user.notification.commentResponseOwner.title');
41 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
43 public function getMessage() {
44 // @todo: use cache or a single query to retrieve required data
45 $comment = new Comment($this->userNotificationObject->commentID);
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.commentResponseOwner.message.stacked', array(
59 'authors' => $authors,
61 'others' => max($count - 1, 0)
65 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message', array(
66 'author' => $this->author,
67 'commentAuthor' => $commentAuthor
72 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
74 public function getEmailMessage($notificationType = 'instant') {
75 $comment = new Comment($this->userNotificationObject->commentID);
76 $owner = new User($comment->objectID);
77 if ($comment->userID) {
78 $commentAuthor = new User($comment->userID);
81 $commentAuthor = new User(null, array(
82 'username' => $comment->username
86 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.mail', array(
87 'response' => $this->userNotificationObject,
88 'author' => $this->author,
89 'commentAuthor' => $commentAuthor,
91 'notificationType' => $notificationType
96 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
98 public function getLink() {
99 return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall');
103 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
105 public function getEventHash() {
106 return sha1($this->eventID . '-' . $this->userNotificationObject->commentID);