edcdb5b31bb1a0a989865921e15d56b6043d5341
[GitHub/WoltLab/WCF.git] /
1 <?php
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;
7 use wcf\system\WCF;
8
9 /**
10 * User notification event for profile's owner for commment responses.
11 *
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
18 */
19 class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractUserNotificationEvent {
20 /**
21 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
22 */
23 public function getTitle() {
24 return $this->getLanguage()->get('wcf.user.notification.commentResponseOwner.title');
25 }
26
27 /**
28 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
29 */
30 public function getMessage() {
31 // @todo: use cache or a single query to retrieve required data
32 $comment = new Comment($this->userNotificationObject->commentID);
33 $commentAuthor = new User($comment->userID);
34
35 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message', array(
36 'author' => $this->author,
37 'commentAuthor' => $commentAuthor
38 ));
39 }
40
41 /**
42 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
43 */
44 public function getEmailMessage($notificationType = 'instant') {
45 $comment = new Comment($this->userNotificationObject->commentID);
46 $commentAuthor = new User($comment->userID);
47 $owner = new User($comment->objectID);
48
49 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.mail', array(
50 'response' => $this->userNotificationObject,
51 'author' => $this->author,
52 'commentAuthor' => $commentAuthor,
53 'owner' => $owner,
54 'notificationType' => $notificationType
55 ));
56 }
57
58 /**
59 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
60 */
61 public function getLink() {
62 return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall');
63 }
64 }