Main notification handling routines for sending notifications to recipients.
Recipients may be
-
a list of user ids
-
roles
-
users which registered a listener to an ref_id
Definition at line 13 of file class.ilNotificationSystem.php.
Creates the user notifications and send them.
If processAsync is true the notifications will be serialized and persisted to the database
- Parameters
-
- Todo:
- was ist hier?
Definition at line 61 of file class.ilNotificationSystem.php.
References $data, $h, $handler, $instance, $lang, array, ilNotificationDatabaseHandler\enqueueByUsers(), ilNotificationDatabaseHandler\getAvailableChannels(), ilNotificationDatabaseHandler\getAvailableTypes(), ilObjectFactory\getInstanceByObjId(), ilNotificationConfig\getLanguageParameters(), ilNotificationConfig\getType(), ilNotificationConfig\getUserInstance(), ilNotificationDatabaseHandler\getUsersWithCustomConfig(), and ilNotificationDatabaseHandler\loadUserConfig().
63 require_once
'Services/Notifications/classes/class.ilNotificationUserIterator.php';
64 require_once
'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
68 if ($processAsync ==
false) {
75 foreach($users as $user_id) {
76 if ($usersWithCustomConfig[$user_id]) {
86 $lang = ilNotificationDatabaseHandler::getTranslatedLanguageVariablesOfNotificationParameters($notification->
getLanguageParameters());
88 $user_by_handler =
array();
92 if ($types[$notification->
getType()][
'config_type'] ==
'set_by_user') {
95 $channelsByAdmin =
false;
98 foreach($it as $usr_id =>
$data) {
100 if (!$channels[
$data[
'channel']])
103 if (!$user_by_handler[$data[
'channel']])
104 $user_by_handler[$data[
'channel']] =
array();
106 $user_by_handler[$data[
'channel']][] = $usr_id;
110 else if ($types[$notification->
getType()][
'config_type'] !=
'disabled') {
111 $channelsByAdmin =
true;
114 if (isset($adminConfig[$notification->
getType()])) {
116 foreach($adminConfig[$notification->
getType()] as $channel) {
117 if (!$channels[$channel])
119 $user_by_handler[$channel] = $users;
126 $userCache =
array();
129 foreach ($user_by_handler as
$handler => $users) {
132 foreach ($users as $userId) {
133 if (!$userCache[$userId]) {
135 if (!$user || !($user instanceof \
ilObjUser)) {
138 $userCache[$userId] = $user;
140 $user = $userCache[$userId];
static enqueueByUsers(ilNotificationConfig $notification, array $userids)
wrapper for iterating a list of user settings by providing the user ids
static getUsersWithCustomConfig(array $userid)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
static getAvailableTypes($config_types=array())
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
static getAvailableChannels($config_types=array(), $includeDisabled=false)
getUserInstance(ilObjUser $user, $languageVars, $defaultLanguage)
static loadUserConfig($userid)