5851a937ec9c32238cde56378d3325dac18ae512
[GitHub/WoltLab/WCF.git] /
1 <?php
2 namespace wcf\system\user\notification\event;
3 use wcf\data\user\User;
4 use wcf\system\request\LinkHandler;
5 use wcf\system\user\notification\event\AbstractUserNotificationEvent;
6 use wcf\system\WCF;
7
8 /**
9 * User notification event for profile commments.
10 *
11 * @author Alexander Ebert
12 * @copyright 2001-2014 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 * @package com.woltlab.wcf
15 * @subpackage system.user.notification.event
16 * @category Community Framework
17 */
18 class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEvent {
19 /**
20 * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
21 */
22 protected $stackable = true;
23
24 /**
25 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
26 */
27 public function getTitle() {
28 $count = count($this->getAuthors());
29 if ($count > 1) {
30 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', array(
31 'count' => $count,
32 'timesTriggered' => $this->timesTriggered
33 ));
34 }
35
36 return $this->getLanguage()->get('wcf.user.notification.comment.title');
37 }
38
39 /**
40 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
41 */
42 public function getMessage() {
43 $authors = array_values($this->getAuthors());
44 $count = count($authors);
45
46 if ($count > 1) {
47 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message.stacked', array(
48 'author' => $this->author,
49 'authors' => $authors,
50 'count' => $count,
51 'others' => $count - 1
52 ));
53 }
54
55 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message', array(
56 'author' => $this->author
57 ));
58 }
59
60 /**
61 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
62 */
63 public function getEmailMessage($notificationType = 'instant') {
64 $user = new User($this->userNotificationObject->objectID);
65
66 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail', array(
67 'comment' => $this->userNotificationObject,
68 'author' => $this->author,
69 'owner' => $user,
70 'notificationType' => $notificationType
71 ));
72 }
73
74 /**
75 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
76 */
77 public function getLink() {
78 return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall');
79 }
80
81 /**
82 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
83 */
84 public function getEventHash() {
85 return sha1($this->eventID . '-' . $this->notification->userID);
86 }
87 }