2 namespace wcf\system\user\notification\event;
3 use wcf\system\cache\runtime\UserProfileRuntimeCache;
4 use wcf\system\request\LinkHandler;
7 * User notification event for profile comments.
9 * @author Alexander Ebert
10 * @copyright 2001-2016 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package WoltLabSuite\Core\System\User\Notification\Event
14 class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotificationEvent {
18 protected $stackable = true;
23 protected function prepare() {
24 UserProfileRuntimeCache::getInstance()->cacheObjectID($this->userNotificationObject->objectID);
30 public function getTitle() {
31 $count = count($this->getAuthors());
33 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', [
35 'timesTriggered' => $this->notification->timesTriggered
39 return $this->getLanguage()->get('wcf.user.notification.comment.title');
45 public function getMessage() {
46 $authors = $this->getAuthors();
47 if (count($authors) > 1) {
48 if (isset($authors[0])) {
51 $count = count($authors);
53 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message.stacked', [
54 'author' => $this->author,
55 'authors' => array_values($authors),
57 'others' => $count - 1,
58 'guestTimesTriggered' => $this->notification->guestTimesTriggered
62 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message', [
63 'author' => $this->author
70 public function getEmailMessage($notificationType = 'instant') {
71 $user = UserProfileRuntimeCache::getInstance()->getObject($this->userNotificationObject->objectID);
73 $authors = $this->getAuthors();
74 if (count($authors) > 1) {
75 if (isset($authors[0])) {
78 $count = count($authors);
80 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail.stacked', [
81 'author' => $this->author,
82 'authors' => array_values($authors),
84 'others' => $count - 1,
86 'notificationType' => $notificationType,
87 'guestTimesTriggered' => $this->notification->guestTimesTriggered
91 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail', [
92 'comment' => $this->userNotificationObject,
93 'author' => $this->author,
95 'notificationType' => $notificationType
102 public function getLink() {
103 return LinkHandler::getInstance()->getLink('User', ['object' => UserProfileRuntimeCache::getInstance()->getObject($this->userNotificationObject->objectID)], '#wall');
109 public function getEventHash() {
110 return sha1($this->eventID . '-' . $this->notification->userID);