c8c077960d3b93f4fbe0473e5660ea18050790e9
[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 commment response likes.
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 UserProfileCommentResponseLikeUserNotificationEvent 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.commentResponse.like.title.stacked', array(
31 'count' => $count,
32 'timesTriggered' => $this->timesTriggered
33 ));
34 }
35
36 return $this->getLanguage()->get('wcf.user.notification.commentResponse.like.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 $commentUser = $owner = null;
46 if ($this->additionalData['objectID'] != WCF::getUser()->userID) {
47 $owner = new User($this->additionalData['objectID']);
48 }
49 if ($this->additionalData['commentUserID'] != WCF::getUser()->userID) {
50 $commentUser = new User($this->additionalData['commentUserID']);
51 }
52
53 if ($count > 1) {
54 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.message.stacked', array(
55 'author' => $this->author,
56 'authors' => $authors,
57 'commentUser' => $commentUser,
58 'count' => $count,
59 'others' => max($count - 1, 0),
60 'owner' => $owner
61 ));
62 }
63
64 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.message', array(
65 'author' => $this->author,
66 'comment' => $this->userNotificationObject,
67 'owner' => $owner
68 ));
69 }
70
71 /**
72 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
73 */
74 public function getEmailMessage($notificationType = 'instant') { /* not supported */ }
75
76 /**
77 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
78 */
79 public function getLink() {
80 return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall');
81 }
82
83 /**
84 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
85 */
86 public function getEventHash() {
87 return sha1($this->eventID . '-' . $this->additionalData['commentID']);
88 }
89
90 /**
91 * @see \wcf\system\user\notification\event\IUserNotificationEvent::supportsEmailNotification()
92 */
93 public function supportsEmailNotification() {
94 return false;
95 }
96 }