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