22 require_once
'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
23 require_once
'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
24 require_once
'Services/Notifications/classes/class.ilNotificationMailHandler.php';
34 if (!self::$instance) {
35 self::$instance =
new self();
37 return self::$instance;
47 if (!array_key_exists($channel, $this->handler) || !is_array($this->handler[$channel]))
48 $this->handler[$channel] =
array();
50 $this->handler[$channel][] =
$handler;
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];
169 require_once
'Services/Notifications/classes/class.ilNotificationUserIterator.php';
170 require_once
'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
172 if ($processAsync ==
false) {
174 self::toUsers($notification, $users,
false);
194 require_once
'Services/Notifications/classes/class.ilNotificationUserIterator.php';
195 require_once
'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
200 foreach($roles as $role) {
201 $users[] = $rbacreview->assignedUsers($role);
204 $users = array_unique(call_user_func_array(
'array_merge', $users));
206 self::toUsers($notification, $users, $processAsync);
217 self::getInstance()->toUsers($notification, $users, $processAsync);
228 self::getInstance()->toListeners($notification,
$ref_id, $processAsync);
239 self::getInstance()->toRoles($notification, $roles, $processAsync);
243 require_once
'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
250 require_once
'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
static enqueueByUsers(ilNotificationConfig $notification, array $userids)
addHandler($channel, ilNotificationHandler $handler)
Registers a new handler for the given channel name.
Notification handler for sending notifications the to recipients email address.
toRoles(ilNotificationConfig $notification, array $roles, $processAsync=false)
Send a notification to a list of roles.
wrapper for iterating a list of user settings by providing the user ids
static sendNotificationToUsers(ilNotificationConfig $notification, $users, $processAsync=false)
static enableListeners($module, $ref_id)
toUsers(ilNotificationConfig $notification, $users, $processAsync=false)
Creates the user notifications and send them.
static getUsersWithCustomConfig(array $userid)
static getUsersByListener($module, $sender_id)
Base class for notification handlers.
hasDisableAfterDeliverySet()
Describes a notification and provides methods for publishing this notification.
toListeners(ilNotificationConfig $notification, $ref_id, $processAsync=false)
Sends the notification to all listener which are subscribed to the given ref_id.
static disableListeners($module, $sender_id)
static enqueueByListener(ilNotificationConfig $notification, $ref_id)
Notification handler for senden a notification popup to the recipients browser.
Basic notification handler that dumps basic notification information to stdout.
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.
Main notification handling routines for sending notifications to recipients.
static enableUserListeners($module, $ref_id, array $users)
static getAvailableTypes($config_types=array())
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
static sendNotificationToRoles(ilNotificationConfig $notification, array $roles, $processAsync=false)
static getAvailableChannels($config_types=array(), $includeDisabled=false)
static sendNotificationToListeners(ilNotificationConfig $notification, $ref_id, $processAsync=false)
getUserInstance(ilObjUser $user, $languageVars, $defaultLanguage)
static loadUserConfig($userid)
static enableListeners($module, $sender_id, array $users=array())