Merge branch '2.0'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / user / notification / event / UserProfileCommentResponseOwnerUserNotificationEvent.class.php
CommitLineData
285b1d92
MW
1<?php
2namespace wcf\system\user\notification\event;
3use wcf\data\comment\Comment;
4use wcf\data\user\User;
5use wcf\system\request\LinkHandler;
6use wcf\system\user\notification\event\AbstractUserNotificationEvent;
7use wcf\system\WCF;
8
9/**
10 * User notification event for profile's owner for commment responses.
11 *
12 * @author Alexander Ebert
ca4ba303 13 * @copyright 2001-2014 WoltLab GmbH
285b1d92 14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
f4f05aa5 15 * @package com.woltlab.wcf
285b1d92
MW
16 * @subpackage system.user.notification.event
17 * @category Community Framework
18 */
19class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractUserNotificationEvent {
20 /**
0ad90fc3 21 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
285b1d92
MW
22 */
23 public function getTitle() {
24 return $this->getLanguage()->get('wcf.user.notification.commentResponseOwner.title');
25 }
26
27 /**
0ad90fc3 28 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
285b1d92
MW
29 */
30 public function getMessage() {
31 // @todo: use cache or a single query to retrieve required data
32 $comment = new Comment($this->userNotificationObject->commentID);
b9f4bd69
MS
33 if ($comment->userID) {
34 $commentAuthor = new User($comment->userID);
35 }
36 else {
37 $commentAuthor = new User(null, array(
38 'username' => $comment->username
39 ));
40 }
285b1d92
MW
41
42 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message', array(
43 'author' => $this->author,
44 'commentAuthor' => $commentAuthor
45 ));
46 }
47
48 /**
0ad90fc3 49 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
285b1d92 50 */
edfb4729 51 public function getEmailMessage($notificationType = 'instant') {
285b1d92 52 $comment = new Comment($this->userNotificationObject->commentID);
285b1d92 53 $owner = new User($comment->objectID);
b9f4bd69
MS
54 if ($comment->userID) {
55 $commentAuthor = new User($comment->userID);
56 }
57 else {
58 $commentAuthor = new User(null, array(
59 'username' => $comment->username
60 ));
61 }
285b1d92
MW
62
63 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.mail', array(
7331c230 64 'response' => $this->userNotificationObject,
285b1d92
MW
65 'author' => $this->author,
66 'commentAuthor' => $commentAuthor,
7331c230
MW
67 'owner' => $owner,
68 'notificationType' => $notificationType
285b1d92
MW
69 ));
70 }
71
72 /**
0ad90fc3 73 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
285b1d92
MW
74 */
75 public function getLink() {
76 return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall');
77 }
78}