882ac722054e04dbc5ccd66ae3e7f86e2214890e
[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 WoltLabSuite\Core\System\User\Notification\Event
12 */
13 class UserFollowFollowingUserNotificationEvent extends AbstractUserNotificationEvent {
14 /**
15 * @inheritDoc
16 */
17 protected $stackable = true;
18
19 /**
20 * @inheritDoc
21 */
22 public function getTitle() {
23 $count = count($this->getAuthors());
24 if ($count > 1) {
25 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.title.stacked', ['count' => $count]);
26 }
27
28 return $this->getLanguage()->get('wcf.user.notification.follow.title');
29 }
30
31 /**
32 * @inheritDoc
33 */
34 public function getMessage() {
35 $authors = array_values($this->getAuthors());
36 $count = count($authors);
37
38 if ($count > 1) {
39 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.message.stacked', [
40 'author' => $this->author,
41 'authors' => $authors,
42 'count' => $count,
43 'others' => $count - 1
44 ]);
45 }
46
47 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.message', ['author' => $this->author]);
48 }
49
50 /**
51 * @inheritDoc
52 */
53 public function getEmailMessage($notificationType = 'instant') {
54 return [
55 'template' => 'email_notification_userFollowFollowing',
56 'application' => 'wcf'
57 ];
58 }
59
60 /**
61 * @inheritDoc
62 */
63 public function getLink() {
64 return LinkHandler::getInstance()->getLink('User', ['object' => $this->author]);
65 }
66
67 /**
68 * @inheritDoc
69 */
70 public function getEventHash() {
71 return sha1($this->eventID . '-' . $this->userNotificationObject->followUserID);
72 }
73 }