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