ILIAS  release_7 Revision v7.30-3-g800a261c036
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 448 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.

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

◆ getCachedReferences()

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

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

References ilObject\_getAllReferences().

436  {
437  if (!array_key_exists($obj_id, self::$ref_ids)) {
438  self::$ref_ids[$obj_id] = ilObject::_getAllReferences($obj_id);
439  }
440  return self::$ref_ids[$obj_id];
441  }
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 484 of file class.ilForumAppEventListener.php.

References ilLogger\debug().

489  {
490  if (count($recipients)) {
491  $logger->debug(sprintf(
492  'Will send %s notification(s) to: %s',
493  count($recipients),
494  implode(', ', $recipients)
495  ));
496 
497  $mailNotification = new ilForumMailEventNotificationSender($provider, $logger);
498  $mailNotification->setType($notificationTypes);
499  $mailNotification->setRecipients($recipients);
500  $mailNotification->send();
501  } else {
502  $logger->debug('No recipients found, skipped notification delivery.');
503  }
504  }
+ 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: