25 require_once
'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
26 require_once
'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
27 require_once
'Services/Notifications/classes/class.ilNotificationMailHandler.php';
43 if (!self::$instance) {
44 self::$instance =
new self();
46 return self::$instance;
57 if (!array_key_exists($channel, $this->handler) || !is_array($this->handler[$channel])) {
58 $this->handler[$channel] = array();
61 $this->handler[$channel][] =
$handler;
74 require_once
'Services/Notifications/classes/class.ilNotificationUserIterator.php';
75 require_once
'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
79 if ($processAsync ==
false) {
86 foreach (
$users as $user_id) {
87 if ($usersWithCustomConfig[$user_id]) {
97 $lang = ilNotificationDatabaseHandler::getTranslatedLanguageVariablesOfNotificationParameters($notification->
getLanguageParameters());
99 $user_by_handler = array();
103 if ($types[$notification->
getType()][
'config_type'] ==
'set_by_user') {
106 $channelsByAdmin =
false;
109 foreach ($it as $usr_id =>
$data) {
111 if (!$channels[
$data[
'channel']]) {
115 if (!$user_by_handler[$data[
'channel']]) {
116 $user_by_handler[$data[
'channel']] = array();
119 $user_by_handler[$data[
'channel']][] = $usr_id;
123 elseif ($types[$notification->
getType()][
'config_type'] !=
'disabled') {
124 $channelsByAdmin =
true;
127 if (isset($adminConfig[$notification->
getType()])) {
128 foreach ($adminConfig[$notification->
getType()] as $channel) {
129 if (!$channels[$channel]) {
132 $user_by_handler[$channel] =
$users;
138 $userCache = array();
144 foreach (
$users as $userId) {
145 if (!$userCache[$userId]) {
150 $userCache[$userId] =
$user;
152 $user = $userCache[$userId];
182 require_once
'Services/Notifications/classes/class.ilNotificationUserIterator.php';
183 require_once
'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
185 if ($processAsync ==
false) {
187 self::toUsers($notification,
$users,
false);
206 require_once
'Services/Notifications/classes/class.ilNotificationUserIterator.php';
207 require_once
'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
210 foreach ($roles as $role) {
211 $users[] = $this->rbacReview->assignedUsers($role);
214 $users = array_unique(call_user_func_array(
'array_merge',
$users));
216 self::toUsers($notification,
$users, $processAsync);
228 self::getInstance()->toUsers($notification,
$users, $processAsync);
240 self::getInstance()->toListeners($notification, $ref_id, $processAsync);
252 self::getInstance()->toRoles($notification, $roles, $processAsync);
257 require_once
'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
266 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()
if($modEnd===false) $module
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)
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
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)
__construct(\ilRbacReview $rbacReview=null)
static enableListeners($module, $sender_id, array $users=array())
class ilRbacReview Contains Review functions of core Rbac.