afd6ccd6426ed0e59b3e92fcc7ff956380992772
[GitHub/WoltLab/WCF.git] /
1 <?php
2 namespace wcf\system\user\notification\event;
3 use wcf\system\email\mime\MimePartFacade;
4 use wcf\system\email\mime\RecipientAwareTextMimePart;
5 use wcf\system\request\LinkHandler;
6
7 /**
8 * Notification event for followers.
9 *
10 * @author Alexander Ebert
11 * @copyright 2001-2016 WoltLab GmbH
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13 * @package WoltLabSuite\Core\System\User\Notification\Event
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 return [
57 'template' => 'email_notification_userFollowFollowing',
58 'application' => 'wcf'
59 ];
60 }
61
62 /**
63 * @inheritDoc
64 */
65 public function getLink() {
66 return LinkHandler::getInstance()->getLink('User', ['object' => $this->author]);
67 }
68
69 /**
70 * @inheritDoc
71 */
72 public function getEventHash() {
73 return sha1($this->eventID . '-' . $this->userNotificationObject->followUserID);
74 }
75 }