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