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\IUserNotificationEvent::getTitle()
23 public function getTitle() {
24 return $this->getLanguage()->get('wcf.user.notification.commentResponseOwner.title');
28 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
30 public function getMessage() {
31 // @todo: use cache or a single query to retrieve required data
32 $comment = new Comment($this->userNotificationObject->commentID);
33 if ($comment->userID) {
34 $commentAuthor = new User($comment->userID);
37 $commentAuthor = new User(null, array(
38 'username' => $comment->username
42 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message', array(
43 'author' => $this->author,
44 'commentAuthor' => $commentAuthor
49 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
51 public function getEmailMessage($notificationType = 'instant') {
52 $comment = new Comment($this->userNotificationObject->commentID);
53 $owner = new User($comment->objectID);
54 if ($comment->userID) {
55 $commentAuthor = new User($comment->userID);
58 $commentAuthor = new User(null, array(
59 'username' => $comment->username
63 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.mail', array(
64 'response' => $this->userNotificationObject,
65 'author' => $this->author,
66 'commentAuthor' => $commentAuthor,
68 'notificationType' => $notificationType
73 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
75 public function getLink() {
76 return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall');