ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNotificationSystem Class Reference
+ Collaboration diagram for ilNotificationSystem:

Static Public Member Functions

static sendNotificationToUsers (ilNotificationConfig $notification, $users, $processAsync=false)
static sendNotificationToListeners (ilNotificationConfig $notification, $ref_id, $processAsync=false)
static sendNotificationToRoles (ilNotificationConfig $notification, array $roles, $processAsync=false)
static enableListeners ($module, $ref_id)
static enableUserListeners ($module, $ref_id, array $users)

Private Member Functions

 __construct ()
 addHandler ($channel, ilNotificationHandler $handler)
 toUsers (ilNotificationConfig $notification, $users, $processAsync=false)
 toListeners (ilNotificationConfig $notification, $ref_id, $processAsync=false)
 toRoles (ilNotificationConfig $notification, array $roles, $processAsync=false)

Static Private Member Functions

static getInstance ()

Private Attributes

 $handler = array()
 $defaultLanguage = 'en'

Static Private Attributes

static $instance

Detailed Description

Definition at line 3 of file class.ilNotificationSystem.php.

Constructor & Destructor Documentation

ilNotificationSystem::__construct ( )
private

Definition at line 11 of file class.ilNotificationSystem.php.

References addHandler().

{
require_once 'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
require_once 'Services/Notifications/classes/class.ilNotificationMailHandler.php';
$this->addHandler('echo', new ilNotificationEchoHandler());
$this->addHandler('osd', new ilNotificationOSDHandler());
$this->addHandler('mail', new ilNotificationMailHandler());
}

+ Here is the call graph for this function:

Member Function Documentation

ilNotificationSystem::addHandler (   $channel,
ilNotificationHandler  $handler 
)
private

Definition at line 29 of file class.ilNotificationSystem.php.

References $handler.

Referenced by __construct().

{
if (!array_key_exists($channel, $this->handler) || !is_array($this->handler[$channel]))
$this->handler[$channel] = array();
$this->handler[$channel][] = $handler;
}

+ Here is the caller graph for this function:

static ilNotificationSystem::enableListeners (   $module,
  $ref_id 
)
static

Definition at line 157 of file class.ilNotificationSystem.php.

References $ref_id.

Referenced by enableUserListeners().

{
require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
}

+ Here is the caller graph for this function:

static ilNotificationSystem::enableUserListeners (   $module,
  $ref_id,
array  $users 
)
static

Definition at line 162 of file class.ilNotificationSystem.php.

References $ref_id, and enableListeners().

{
if (!$users)
return;
require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
}

+ Here is the call graph for this function:

static ilNotificationSystem::getInstance ( )
staticprivate

Definition at line 22 of file class.ilNotificationSystem.php.

References $instance.

Referenced by sendNotificationToListeners(), sendNotificationToRoles(), and sendNotificationToUsers().

{
if (!self::$instance) {
self::$instance = new self();
}
}

+ Here is the caller graph for this function:

static ilNotificationSystem::sendNotificationToListeners ( ilNotificationConfig  $notification,
  $ref_id,
  $processAsync = false 
)
static

Definition at line 149 of file class.ilNotificationSystem.php.

References $ref_id, and getInstance().

Referenced by ilNotificationConfig\notifyByListeners().

{
self::getInstance()->toListeners($notification, $ref_id, $processAsync);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilNotificationSystem::sendNotificationToRoles ( ilNotificationConfig  $notification,
array  $roles,
  $processAsync = false 
)
static

Definition at line 153 of file class.ilNotificationSystem.php.

References getInstance().

Referenced by ilNotificationConfig\notifyByRoles().

{
self::getInstance()->toRoles($notification, $roles, $processAsync);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilNotificationSystem::sendNotificationToUsers ( ilNotificationConfig  $notification,
  $users,
  $processAsync = false 
)
static

Definition at line 145 of file class.ilNotificationSystem.php.

References getInstance().

Referenced by ilNotificationConfig\notifyByUsers(), and ilNotificationOSDHandler\removeNotification().

{
self::getInstance()->toUsers($notification, $users, $processAsync);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNotificationSystem::toListeners ( ilNotificationConfig  $notification,
  $ref_id,
  $processAsync = false 
)
private

Definition at line 113 of file class.ilNotificationSystem.php.

References $ref_id, ilNotificationDatabaseHandler\disableListeners(), ilNotificationDatabaseHandler\enqueueByListener(), ilNotificationConfig\getType(), ilNotificationDatabaseHandler\getUsersByListener(), ilNotificationConfig\hasDisableAfterDeliverySet(), and toUsers().

{
require_once 'Services/Notifications/classes/class.ilNotificationUserIterator.php';
require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
if ($processAsync == false) {
self::toUsers($notification, $users, false);
if ($notification->hasDisableAfterDeliverySet()) {
}
}
else {
}
}

+ Here is the call graph for this function:

ilNotificationSystem::toRoles ( ilNotificationConfig  $notification,
array  $roles,
  $processAsync = false 
)
private

Definition at line 129 of file class.ilNotificationSystem.php.

References toUsers().

{
require_once 'Services/Notifications/classes/class.ilNotificationUserIterator.php';
require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
global $rbacreview;
$users = array();
foreach($roles as $role) {
$users[] = $rbacreview->assignedUsers($role);
}
$users = array_unique(call_user_func_array('array_merge', $users));
self::toUsers($notification, $users, $processAsync);
}

+ Here is the call graph for this function:

ilNotificationSystem::toUsers ( ilNotificationConfig  $notification,
  $users,
  $processAsync = false 
)
private
Todo:
was ist hier?

Definition at line 36 of file class.ilNotificationSystem.php.

References $data, $handler, $instance, $lang, $usr_id, ilNotificationDatabaseHandler\enqueueByUsers(), ilNotificationDatabaseHandler\getAvailableChannels(), ilNotificationDatabaseHandler\getAvailableTypes(), ilNotificationConfig\getLanguageParameters(), ilNotificationConfig\getType(), ilNotificationConfig\getUserInstance(), ilNotificationDatabaseHandler\getUsersWithCustomConfig(), and ilNotificationDatabaseHandler\loadUserConfig().

Referenced by toListeners(), and toRoles().

{
require_once 'Services/Notifications/classes/class.ilNotificationUserIterator.php';
require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
if ($processAsync == false) {
foreach($users as $user_id) {
if ($usersWithCustomConfig[$user_id]) {
}
}
$lang = ilNotificationDatabaseHandler::getTranslatedLanguageVariablesOfNotificationParameters($notification->getLanguageParameters());
$user_by_handler = array();
if ($types[$notification->getType()]['config_type'] == 'set_by_user') {
$it = new ilNotificationUserIterator($notification->getType(), $users);
$channelsByAdmin = false;
foreach($it as $usr_id => $data) {
if (!$channels[$data['channel']])
continue;
if (!$user_by_handler[$data['channel']])
$user_by_handler[$data['channel']] = array();
$user_by_handler[$data['channel']][] = $usr_id;
}
}
else if ($types[$notification->getType()]['config_type'] != 'disabled') {
$channelsByAdmin = true;
//$user_by_handler = array();
if (isset($adminConfig[$notification->getType()])) {
foreach($adminConfig[$notification->getType()] as $channel) {
if (!$channels[$channel])
continue;
$user_by_handler[$channel] = $users;
}
}
}
$userCache = array();
foreach($user_by_handler as $handler => $users) {
$handler = $this->handler[$handler];
foreach($users as $userId) {
if (!$userCache[$userId]) {
$userCache[$userId] = new ilObjUser($userId);
}
$user = $userCache[$userId];
$instance = $notification->getUserInstance($user, $lang, $this->defaultLanguage);
foreach($handler as $h) {
$h->notify($instance);
}
}
}
}
else {
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilNotificationSystem::$defaultLanguage = 'en'
private

Definition at line 9 of file class.ilNotificationSystem.php.

ilNotificationSystem::$handler = array()
private

Definition at line 7 of file class.ilNotificationSystem.php.

Referenced by addHandler(), and toUsers().

ilNotificationSystem::$instance
staticprivate

Definition at line 5 of file class.ilNotificationSystem.php.

Referenced by getInstance(), and toUsers().


The documentation for this class was generated from the following file: