ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilForumAppEventListener Class Reference

Forum listener. More...

+ Inheritance diagram for ilForumAppEventListener:
+ Collaboration diagram for ilForumAppEventListener:

Static Public Member Functions

static sendNotification (ilObjForumNotificationDataProvider $provider, \ilLogger $logger, int $notificationTypes, array $recipients)
 
- Static Public Member Functions inherited from ilAppEventListener
static handleEvent ($a_component, $a_event, $a_parameter)
 Handle an event in a listener. More...
 

Static Protected Attributes

static $ref_ids = array()
 

Static Private Member Functions

static getCachedReferences ($obj_id)
 
static delegateNotification (ilObjForumNotificationDataProvider $provider, $notification_type, \ilLogger $logger)
 

Detailed Description

Forum listener.

Listens to events of other components.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

◆ delegateNotification()

static ilForumAppEventListener::delegateNotification ( ilObjForumNotificationDataProvider  $provider,
  $notification_type,
\ilLogger  $logger 
)
staticprivate
Parameters
ilObjForumNotificationDataProvider$provider
int$notification_type
ilLogger$logger

Definition at line 445 of file class.ilForumAppEventListener.php.

References ilLogger\debug(), ilObjForumNotificationDataProvider\getForumNotificationRecipients(), ilObjForumNotificationDataProvider\getPostActivationRecipients(), ilObjForumNotificationDataProvider\getPostAnsweredRecipients(), ilObjForumNotificationDataProvider\getThreadNotificationRecipients(), ilForumMailNotification\TYPE_POST_ACTIVATION, and ilForumMailNotification\TYPE_POST_ANSWERED.

449  {
450  switch ($notification_type) {
452  self::sendNotification($provider, $logger, $notification_type, $provider->getPostActivationRecipients());
453  break;
454 
456  self::sendNotification($provider, $logger, $notification_type, $provider->getPostAnsweredRecipients());
457  break;
458 
459  default:
460  // get recipients who wants to get forum notifications
461  $logger->debug('Determining subscribers for global forum notifications ...');
462  $frm_recipients = $provider->getForumNotificationRecipients();
463 
464  // get recipients who wants to get thread notifications
465  $logger->debug('Determining subscribers for thread notifications ...');
466  $thread_recipients = $provider->getThreadNotificationRecipients();
467 
468  $recipients = array_unique(array_merge($frm_recipients, $thread_recipients));
469  self::sendNotification($provider, $logger, $notification_type, $recipients);
470 
471  break;
472  }
473  }
+ Here is the call graph for this function:

◆ getCachedReferences()

static ilForumAppEventListener::getCachedReferences (   $obj_id)
staticprivate
Parameters
int$obj_id

Definition at line 432 of file class.ilForumAppEventListener.php.

References ilObject\_getAllReferences().

433  {
434  if (!array_key_exists($obj_id, self::$ref_ids)) {
435  self::$ref_ids[$obj_id] = ilObject::_getAllReferences($obj_id);
436  }
437  return self::$ref_ids[$obj_id];
438  }
static _getAllReferences($a_id)
get all reference ids of object
+ Here is the call graph for this function:

◆ sendNotification()

static ilForumAppEventListener::sendNotification ( ilObjForumNotificationDataProvider  $provider,
\ilLogger  $logger,
int  $notificationTypes,
array  $recipients 
)
static
Parameters
ilObjForumNotificationDataProvider$provider
ilLogger$logger
int$notificationTypes
array$recipients

Definition at line 481 of file class.ilForumAppEventListener.php.

References ilLogger\debug().

486  {
487  if (count($recipients)) {
488  $logger->debug(sprintf(
489  'Will send %s notification(s) to: %s',
490  count($recipients),
491  implode(', ', $recipients)
492  ));
493 
494  $mailNotification = new ilForumMailNotification($provider, $logger);
495  $mailNotification->setType($notificationTypes);
496  $mailNotification->setRecipients($recipients);
497  $mailNotification->send();
498  } else {
499  $logger->debug('No recipients found, skipped notification delivery.');
500  }
501  }
+ Here is the call graph for this function:

Field Documentation

◆ $ref_ids

ilForumAppEventListener::$ref_ids = array()
staticprotected

Definition at line 13 of file class.ilForumAppEventListener.php.


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