f72869945899bb880fd6d3ba4a857f4a36bc3925
[GitHub/WoltLab/WCF.git] /
1 <?php
2 namespace wcf\system\user\notification\event;
3 use wcf\data\user\User;
4 use wcf\system\comment\CommentDataHandler;
5 use wcf\system\request\LinkHandler;
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 AbstractSharedUserNotificationEvent {
19 /**
20 * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
21 */
22 protected $stackable = true;
23
24 /**
25 * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::prepare()
26 */
27 protected function prepare() {
28 CommentDataHandler::getInstance()->cacheUserID($this->additionalData['objectID']);
29 }
30
31 /**
32 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
33 */
34 public function getTitle() {
35 $count = count($this->getAuthors());
36 if ($count > 1) {
37 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.title.stacked', array(
38 'count' => $count,
39 'timesTriggered' => $this->timesTriggered
40 ));
41 }
42
43 return $this->getLanguage()->get('wcf.user.notification.comment.like.title');
44 }
45
46 /**
47 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
48 */
49 public function getMessage() {
50 $authors = array_values($this->getAuthors());
51 $count = count($authors);
52 $owner = null;
53 if ($this->additionalData['objectID'] != WCF::getUser()->userID) {
54 $owner = CommentDataHandler::getInstance()->getUser($this->additionalData['objectID']);
55 }
56
57 if ($count > 1) {
58 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.message.stacked', array(
59 'author' => $this->author,
60 'authors' => $authors,
61 'comment' => $this->userNotificationObject,
62 'count' => $count,
63 'others' => $count - 1,
64 'owner' => $owner
65 ));
66 }
67
68 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.message', array(
69 'author' => $this->author,
70 'comment' => $this->userNotificationObject,
71 'owner' => $owner
72 ));
73 }
74
75 /**
76 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
77 */
78 public function getEmailMessage($notificationType = 'instant') { /* not supported */ }
79
80 /**
81 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
82 */
83 public function getLink() {
84 return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall');
85 }
86
87 /**
88 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
89 */
90 public function getEventHash() {
91 return sha1($this->eventID . '-' . $this->additionalData['objectID']);
92 }
93
94 /**
95 * @see \wcf\system\user\notification\event\IUserNotificationEvent::supportsEmailNotification()
96 */
97 public function supportsEmailNotification() {
98 return false;
99 }
100 }