2 namespace wcf\system\user\notification\event;
3 use wcf\system\cache\runtime\UserProfileRuntimeCache;
4 use wcf\system\request\LinkHandler;
5 use wcf\system\user\notification\object\CommentUserNotificationObject;
8 * User notification event for profile comments.
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 WoltLabSuite\Core\System\User\Notification\Event
15 * @method CommentUserNotificationObject getUserNotificationObject()
17 class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotificationEvent {
21 protected $stackable = true;
26 protected function prepare() {
27 UserProfileRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->objectID);
33 public function getTitle() {
34 $count = count($this->getAuthors());
36 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', [
38 'timesTriggered' => $this->notification->timesTriggered
42 return $this->getLanguage()->get('wcf.user.notification.comment.title');
48 public function getMessage() {
49 $authors = $this->getAuthors();
50 if (count($authors) > 1) {
51 if (isset($authors[0])) {
54 $count = count($authors);
56 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message.stacked', [
57 'author' => $this->author,
58 'authors' => array_values($authors),
60 'others' => $count - 1,
61 'guestTimesTriggered' => $this->notification->guestTimesTriggered
65 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message', [
66 'author' => $this->author
73 public function getEmailMessage($notificationType = 'instant') {
74 $user = UserProfileRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID);
76 $authors = $this->getAuthors();
77 if (count($authors) > 1) {
78 if (isset($authors[0])) {
81 $count = count($authors);
83 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail.stacked', [
84 'author' => $this->author,
85 'authors' => array_values($authors),
87 'others' => $count - 1,
89 'notificationType' => $notificationType,
90 'guestTimesTriggered' => $this->notification->guestTimesTriggered
94 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail', [
95 'comment' => $this->userNotificationObject,
96 'author' => $this->author,
98 'notificationType' => $notificationType
105 public function getLink() {
106 return LinkHandler::getInstance()->getLink('User', ['object' => UserProfileRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID)], '#wall');
112 public function getEventHash() {
113 return sha1($this->eventID . '-' . $this->notification->userID);