2 namespace wcf\system\user\notification\event;
3 use wcf\data\user\User;
4 use wcf\system\cache\runtime\UserProfileRuntimeCache;
5 use wcf\system\request\LinkHandler;
6 use wcf\system\user\notification\object\CommentUserNotificationObject;
9 * User notification event for profile comments.
11 * @author Alexander Ebert
12 * @copyright 2001-2016 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 * @package WoltLabSuite\Core\System\User\Notification\Event
16 * @method CommentUserNotificationObject getUserNotificationObject()
18 class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotificationEvent {
22 protected $stackable = true;
27 protected function prepare() {
28 UserProfileRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->objectID);
34 public function getTitle() {
35 $count = count($this->getAuthors());
37 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', [
39 'timesTriggered' => $this->notification->timesTriggered
43 return $this->getLanguage()->get('wcf.user.notification.comment.title');
49 public function getMessage() {
50 $authors = $this->getAuthors();
51 if (count($authors) > 1) {
52 if (isset($authors[0])) {
55 $count = count($authors);
57 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message.stacked', [
58 'author' => $this->author,
59 'authors' => array_values($authors),
61 'others' => $count - 1,
62 'guestTimesTriggered' => $this->notification->guestTimesTriggered
66 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message', [
67 'author' => $this->author
74 public function getEmailMessage($notificationType = 'instant') {
76 'message-id' => 'com.woltlab.wcf.user.profileComment.notification/'.$this->getUserNotificationObject()->commentID,
77 'template' => 'email_notification_userProfileComment',
78 'application' => 'wcf',
80 'owner' => new User($this->getUserNotificationObject()->objectID)
88 public function getLink() {
89 return LinkHandler::getInstance()->getLink('User', ['object' => UserProfileRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID)], '#wall');
95 public function getEventHash() {
96 return sha1($this->eventID . '-' . $this->notification->userID);