3 namespace wcf\system\user\notification\event
;
5 use wcf\data\article\category\ArticleCategory
;
6 use wcf\data\user\UserProfile
;
7 use wcf\system\user\notification\
object\ArticleUserNotificationObject
;
10 * Notification event for new articles.
12 * @author Joshua Ruesweg
13 * @copyright 2001-2019 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
16 * @method ArticleUserNotificationObject getUserNotificationObject()
18 class ArticleUserNotificationEvent
extends AbstractUserNotificationEvent
implements ITestableUserNotificationEvent
20 use TTestableUserNotificationEvent
;
21 use TTestableArticleUserNotificationEvent
;
22 use TTestableCategorizedUserNotificationEvent
;
27 public function getTitle(): string
29 return $this->getLanguage()->get('wcf.user.notification.article.title');
35 public function getMessage()
37 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.article.message', [
38 'article' => $this->userNotificationObject
,
39 'author' => $this->author
,
46 public function getEmailMessage($notificationType = 'instant')
48 if ($this->getUserNotificationObject()->isMultilingual
) {
49 $articleContent = $this->getUserNotificationObject()
50 ->getArticleContents()[$this->getLanguage()->languageID
];
52 $articleContent = $this->getUserNotificationObject()
53 ->getArticleContents()[0];
57 'message-id' => 'com.woltlab.wcf.article/' . $this->getUserNotificationObject()->articleID
,
58 'template' => 'email_notification_article',
59 'application' => 'wcf',
61 'article' => $this->getUserNotificationObject(),
62 'articleContent' => $articleContent,
63 'languageVariablePrefix' => 'wcf.user.notification.article',
64 'author' => $this->author
,
72 public function getLink(): string
74 return $this->getUserNotificationObject()->getLink();
80 public function checkAccess()
82 return $this->getUserNotificationObject()->canRead();
88 public static function canBeTriggeredByGuests()
95 * @return ArticleUserNotificationObject[]
97 public static function getTestObjects(UserProfile
$recipient, UserProfile
$author)
100 new ArticleUserNotificationObject(
101 self
::getTestArticle(self
::createTestCategory(ArticleCategory
::OBJECT_TYPE_NAME
), $author)