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