19declare(strict_types=1);
40 $lng->loadLanguageModule(
'forum');
42 return $lng->txt(
'forum');
47 $lng->loadLanguageModule(
'forum');
49 return $lng->txt(
'frm_forum_push_notification_info');
59 int $notification_type,
65 !
$DIC->settings()->get(
'forum_notification',
'0') ||
66 new ilSetting(
'notifications')->
get(
'enable_push') !==
'1'
71 $mail_recipients = [];
73 foreach ($recipients as $recipient_id) {
74 if ($this->
sendPush($recipient_id, $provider, $notification_type)) {
75 $logger->debug(sprintf(
'Push notification sent to user "%s".', $recipient_id));
77 $logger->debug(sprintf(
'Push notification not sent to user "%s". Fallback to mail if possible.', $recipient_id));
78 $mail_recipients[] = $recipient_id;
82 return $mail_recipients;
88 int $notification_type
95 if (isset($this->lang_cache[$user->getLanguage()])) {
96 $lng = $this->lang_cache[$user->getLanguage()];
99 $lng->loadLanguageModule(
'forum');
100 $this->lang_cache[$user->getLanguage()] =
$lng;
103 $content = $this->buildPushContent($provider, $notification_type,
$lng);
104 if ($content ===
null) {
108 return $this->getPushProvider()->push(
111 $content[
'description'],
112 $this->buildPushLink($provider,
$lng)
121 int $notification_type,
124 $subject_key = $this->getSubjectLanguageKey($notification_type);
125 if ($subject_key ===
null) {
129 $container_text =
'';
131 $container_text =
' (' .
137 $lng->txt($subject_key),
143 $description = match ($notification_type) {
145 $lng->txt(
'thread_deleted_by'),
150 $lng->txt(
'frm_noti_new_post'),
156 $lng->txt(
'post_updated_by'),
161 $lng->txt(
'post_censored_by'),
166 $lng->txt(
'post_uncensored_by'),
170 $lng->txt(
'post_deleted_by'),
177 if ($description ===
null) {
183 'description' => $description,
189 return match ($notification_type) {
description of a localized parameter this information is used locate translations while processing no...
const TYPE_POST_UNCENSORED
const TYPE_THREAD_DELETED
const TYPE_POST_ACTIVATION
buildPushLink(ilForumNotificationMailData $provider, ilLanguage $lng)
buildPushContent(ilForumNotificationMailData $provider, int $notification_type, ilLanguage $lng)
getIdentifier()
Return a unique identifier.
getName(ilLanguage $lng)
Return the presentation name of the provider.
NotificationsPushProvider $push_provider
getDescription(ilLanguage $lng)
Return the description of the provider.
filterMailRecipients(array $recipients, ilForumNotificationMailData $provider, int $notification_type, ilLogger $logger)
sendPush(int $recipient_id, ilForumNotificationMailData $provider, int $notification_type)
getSubjectLanguageKey(int $notification_type)
static _getLanguageOfUser(int $a_usr_id)
Get language object of user.
Component logger with individual log levels by component id.
Class ilObjectFactory This class offers methods to get instances of the type-specific object classes ...
Interface ilForumNotificationMailData.
providesClosestContainer()
getPostUpdateUserName(ilLanguage $user_lang)