19 declare(strict_types=1);
    45         if ($rbacReview === null) {
    47             $rbacReview = $DIC->rbac()->review();
    51         if ($logger === null) {
    53             $logger = $DIC->logger()->nota();
    60         if (!array_key_exists($channel, $this->handler)) {
    61             $this->handler[$channel] = [];
    64         $this->handler[$channel][] = 
$handler;
    73             'Sending notification to users {users}: {notification_type} / {id} / {id_type}',
    76                 'notification_type' => $notification->
getType(),
    82         if ($process_async === 
false) {
    91             $user_by_handler = [];
    92             if (isset($types[$notification->
getType()][
'config_type'])) {
    93                 if ($types[$notification->
getType()][
'config_type'] === 
'set_by_user') {
    95                     $channelsByAdmin = 
false;
    96                     foreach ($it as $usr_id => 
$data) {
    97                         if (!isset($channels[
$data[
'channel']])) {
   100                         if (!isset($user_by_handler[$data[
'channel']])) {
   101                             $user_by_handler[$data[
'channel']] = [];
   103                         $user_by_handler[$data[
'channel']][] = $usr_id;
   105                 } elseif ($types[$notification->
getType()][
'config_type'] !== 
'disabled') {
   106                     $channelsByAdmin = 
true;
   107                     if (isset($adminConfig[$notification->
getType()])) {
   108                         foreach ($adminConfig[$notification->
getType()] as $channel) {
   109                             if (!isset($channels[$channel]) || !$channels[$channel]) {
   112                             $user_by_handler[$channel] = $users;
   119                 'User by handler: {user_by_handler}',
   121                     'user_by_handler' => $user_by_handler
   127             foreach ($user_by_handler as $handler => $h_users) {
   128                 $handler = $this->handler[
$handler];
   129                 foreach ($h_users as $userId) {
   130                     if (!isset($userCache[$userId])) {
   135                         $userCache[$userId] = $user;
   137                     $user = $userCache[$userId];
   139                     $instance = $notification->
getUserInstance($user, $lang, $this->defaultLanguage);
   140                     foreach ($handler as $h) {
   142                             'Notify {user} by calling handler {handler}',
   144                                 'user' => $user->getId(),
   145                                 'handler' => get_class($h),
   148                         $h->notify($instance);
   159         if ($process_async === 
false) {
   175         foreach ($roles as $role) {
   176             $users[] = $this->rbacReview->assignedUsers($role);
   178         $users = array_unique(array_merge(...$users));
   180         $this->
toUsers($notification, $users, $process_async);
   190         bool $processAsync = 
false   193         $DIC->notifications()->system()->toUsers($notification, $users, $processAsync);
   199         bool $processAsync = 
false   202         $DIC->notifications()->system()->toListeners($notification, $ref_id, $processAsync);
   211         bool $processAsync = 
false   214         $DIC->notifications()->system()->toRoles($notification, $roles, $processAsync);
   232     public function clear(
string $channel = 
''): void
   235         if ($channel !== 
'') {
   236             $channels = [$this->handler[$channel]] ?? [];
   238         foreach ($channels as 
$c) {
   239             foreach ($c as $handler) {
 
hasDisableAfterDeliverySet()
 
static enableListeners(string $module, int $ref_id)
 
static sendNotificationToRoles(ilNotificationConfig $notification, array $roles, bool $processAsync=false)
 
addHandler(string $channel, ilNotificationHandler $handler)
 
static enableUserListeners(string $module, int $ref_id, array $users)
 
static enqueueByListener(ilNotificationConfig $notification, int $ref_id)
 
static getUsersByListener(string $module, int $sender_id)
 
static getAvailableChannels(array $config_types=[], bool $include_disabled=false)
 
static sendNotificationToUsers(ilNotificationConfig $notification, array $users, bool $processAsync=false)
 
toRoles(ilNotificationConfig $notification, array $roles, bool $process_async=false)
 
static disableListeners(string $module, int $sender_id)
 
readonly ilLogger $logger
 
static getAvailableTypes(array $config_types=[])
 
static sendNotificationToListeners(ilNotificationConfig $notification, int $ref_id, bool $processAsync=false)
 
readonly ilRbacReview $rbacReview
 
static getTranslatedLanguageVariablesOfNotificationParameters(array $vars=[])
 
static enableListeners(string $module, int $sender_id, array $users=[])
 
static loadUserConfig(int $userid)
 
toListeners(ilNotificationConfig $notification, int $ref_id, bool $process_async=false)
 
getUserInstance(ilObjUser $user, array $languageVars, string $defaultLanguage)
 
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id 
 
static enqueueByUsers(ilNotificationConfig $notification, array $usr_ids)
 
toUsers(ilNotificationConfig $notification, array $users, bool $process_async=false)
 
__construct(ilRbacReview $rbacReview=null, ilLogger $logger=null)
 
clear(string $channel='')
 
static getUsersWithCustomConfig(array $usr_ids)