02fd3f887501f6821460598f414b5130b8e4235b
[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-2016 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 * @inheritDoc
18 */
19 protected $stackable = true;
20
21 /**
22 * @inheritDoc
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', ['count' => $count]);
28 }
29
30 return $this->getLanguage()->get('wcf.user.notification.follow.title');
31 }
32
33 /**
34 * @inheritDoc
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', [
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', ['author' => $this->author]);
50 }
51
52 /**
53 * @inheritDoc
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', [
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', ['author' => $this->author]);
70 }
71
72 /**
73 * @inheritDoc
74 */
75 public function getLink() {
76 return LinkHandler::getInstance()->getLink('User', ['object' => $this->author]);
77 }
78
79 /**
80 * @inheritDoc
81 */
82 public function getEventHash() {
83 return sha1($this->eventID . '-' . $this->userNotificationObject->followUserID);
84 }
85 }