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