3 namespace wcf\system\user\notification\event
;
5 use wcf\data\article\Article
;
6 use wcf\data\article\category\ArticleCategory
;
7 use wcf\data\user\UserProfile
;
8 use wcf\system\user\notification\
object\ArticleUserNotificationObject
;
11 * Notification event for new articles.
13 * @author Joshua Ruesweg
14 * @copyright 2001-2019 WoltLab GmbH
15 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
16 * @package WoltLabSuite\Core\System\User\Notification\Object\Type
18 * @method ArticleUserNotificationObject getUserNotificationObject()
20 class ArticleUserNotificationEvent
extends AbstractUserNotificationEvent
implements ITestableUserNotificationEvent
22 use TTestableUserNotificationEvent
;
23 use TTestableArticleUserNotificationEvent
;
24 use TTestableCategorizedUserNotificationEvent
;
29 public function getTitle()
31 return $this->getLanguage()->get('wcf.user.notification.article.title');
37 public function getMessage()
39 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.article.message', [
40 'article' => $this->userNotificationObject
,
41 'author' => $this->author
,
48 public function getEmailMessage($notificationType = 'instant')
50 if ($this->getUserNotificationObject()->isMultilingual
) {
51 $articleContent = $this->getUserNotificationObject()
52 ->getArticleContents()[$this->getLanguage()->languageID
];
54 $articleContent = $this->getUserNotificationObject()
55 ->getArticleContents()[0];
59 'message-id' => 'com.woltlab.wcf.article/' . $this->getUserNotificationObject()->articleID
,
60 'template' => 'email_notification_article',
61 'application' => 'wcf',
63 'article' => $this->getUserNotificationObject(),
64 'articleContent' => $articleContent,
65 'languageVariablePrefix' => 'wcf.user.notification.article',
66 'author' => $this->author
,
74 public function getLink()
76 return $this->getUserNotificationObject()->getLink();
82 public function checkAccess()
84 return $this->getUserNotificationObject()->canRead();
90 public static function canBeTriggeredByGuests()
99 public static function getTestObjects(UserProfile
$recipient, UserProfile
$author)
102 new ArticleUserNotificationObject(
103 self
::getTestArticle(self
::createTestCategory(ArticleCategory
::OBJECT_TYPE_NAME
), $author)