1e7f6ea089a80b4f69604d863dc6fa014458a3bc
[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' => $count - 1
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 $authors = array_values($this->getAuthors());
57 $count = count($authors);
58
59 if ($count > 1) {
60 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.mail.stacked', array(
61 'author' => $this->author,
62 'authors' => $authors,
63 'count' => $count,
64 'others' => $count - 1,
65 'notificationType' => $notificationType
66 ));
67 }
68
69 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.mail', array('author' => $this->author));
70 }
71
72 /**
73 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
74 */
75 public function getLink() {
76 return LinkHandler::getInstance()->getLink('User', array('object' => $this->author));
77 }
78
79 /**
80 * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
81 */
82 public function getEventHash() {
83 return sha1($this->eventID . '-' . $this->userNotificationObject->followUserID);
84 }
85 }