2 namespace wcf\system\user\notification\event;
3 use wcf\system\cache\runtime\CommentRuntimeCache;
4 use wcf\system\cache\runtime\UserProfileRuntimeCache;
5 use wcf\system\request\LinkHandler;
8 * User notification event for profile commment responses.
10 * @author Alexander Ebert
11 * @copyright 2001-2016 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 {
21 protected $stackable = true;
26 protected function prepare() {
27 CommentRuntimeCache::getInstance()->cacheObjectID($this->userNotificationObject->commentID);
28 UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['objectID']);
29 UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['userID']);
35 public function getTitle() {
36 $count = count($this->getAuthors());
38 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.title.stacked', [
40 'timesTriggered' => $this->notification->timesTriggered
44 return $this->getLanguage()->get('wcf.user.notification.commentResponse.title');
50 public function getMessage() {
51 $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID);
52 $owner = UserProfileRuntimeCache::getInstance()->getObject($comment->objectID);
54 $authors = $this->getAuthors();
55 if (count($authors) > 1) {
56 if (isset($authors[0])) {
59 $count = count($authors);
61 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message.stacked', [
62 'authors' => array_values($authors),
64 'others' => $count - 1,
66 'guestTimesTriggered' => $this->notification->guestTimesTriggered
70 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message', [
71 'author' => $this->author,
79 public function getEmailMessage($notificationType = 'instant') {
80 $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID);
81 $owner = UserProfileRuntimeCache::getInstance()->getObject($comment->objectID);
83 $authors = $this->getAuthors();
84 if (count($authors) > 1) {
85 if (isset($authors[0])) {
88 $count = count($authors);
90 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail.stacked', [
91 'author' => $this->author,
92 'authors' => array_values($authors),
94 'notificationType' => $notificationType,
95 'others' => $count - 1,
97 'response' => $this->userNotificationObject,
98 'guestTimesTriggered' => $this->notification->guestTimesTriggered
102 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail', [
103 'response' => $this->userNotificationObject,
104 'author' => $this->author,
106 'notificationType' => $notificationType
113 public function getLink() {
114 $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID);
115 $user = UserProfileRuntimeCache::getInstance()->getObject($comment->objectID);
117 return LinkHandler::getInstance()->getLink('User', ['object' => $user], '#wall');
123 public function getEventHash() {
124 return sha1($this->eventID . '-' . $this->userNotificationObject->commentID);