ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSessionAppEventListener Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilSessionAppEventListener:
+ Collaboration diagram for ilSessionAppEventListener:

Public Member Functions

 __construct (\ilDBInterface $db, \ilObjectDataCache $objectDataCache, \ilLogger $logger)
 
 withComponent (string $component)
 
 withEvent (string $event)
 
 withParameters (array $parameters)
 
 handle ()
 

Static Public Member Functions

static handleEvent (string $a_component, string $a_event, array $a_parameter)
 Handle an event in a listener. More...
 

Protected Attributes

ilDBInterface $database
 
ilObjectDataCache $objectDataCache
 
ilLogger $logger
 
string $component = ""
 
string $event = ""
 
array $parameters = []
 

Private Member Functions

 handleRegisterEvent ()
 
 handleEnteredEvent ()
 
 handleUnregisterEvent ()
 
 fetchRecipientParticipants ()
 
 sendMail (int $type)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Niels Theen nthee.nosp@m.n@da.nosp@m.tabay.nosp@m..de

Definition at line 25 of file class.ilSessionAppEventListener.php.

Constructor & Destructor Documentation

◆ __construct()

ilSessionAppEventListener::__construct ( \ilDBInterface  $db,
\ilObjectDataCache  $objectDataCache,
\ilLogger  $logger 
)

Definition at line 34 of file class.ilSessionAppEventListener.php.

References $logger, $objectDataCache, and ILIAS\Repository\logger().

38  {
39  $this->database = $db;
40  $this->objectDataCache = $objectDataCache;
41  $this->logger = $logger;
42  }
+ Here is the call graph for this function:

Member Function Documentation

◆ fetchRecipientParticipants()

ilSessionAppEventListener::fetchRecipientParticipants ( )
private

Definition at line 135 of file class.ilSessionAppEventListener.php.

References $id.

Referenced by sendMail().

135  : array
136  {
137  $object = new ilEventParticipants((int) $this->parameters['obj_id']);
138 
139  $recipients = [];
140  $participants = $object->getParticipants();
141  foreach ($participants as $id => $participant) {
142  if ($participant['notification_enabled'] === true) {
143  $recipients[] = $id;
144  }
145  }
146 
147  return $recipients;
148  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ handle()

ilSessionAppEventListener::handle ( )

Definition at line 88 of file class.ilSessionAppEventListener.php.

References Vendor\Package\$e, $session, ILIAS\Repository\event(), ilObjectFactory\getInstanceByObjId(), handleEnteredEvent(), handleRegisterEvent(), handleUnregisterEvent(), and ILIAS\Repository\logger().

88  : void
89  {
90  if ($this->component === 'Services/AccessControl') {
91  if ($this->event === 'deassignUser') {
92  $session = ilObjectFactory::getInstanceByObjId($this->parameters['obj_id'], false);
93  if ($session instanceof ilObjSession) {
94  $session->handleAutoFill();
95  }
96  }
97  }
98 
99 
100  if ('Modules/Session' !== $this->component) {
101  return;
102  }
103 
104  try {
105  if ('register' === $this->event) {
106  $this->handleRegisterEvent();
107  } elseif ('enter' === $this->event) {
108  $this->handleEnteredEvent();
109  } elseif ('unregister' === $this->event) {
110  $this->handleUnregisterEvent();
111  }
112  } catch (\ilException $e) {
113  $this->logger->error($e->getMessage());
114  }
115  }
$session
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

◆ handleEnteredEvent()

ilSessionAppEventListener::handleEnteredEvent ( )
private

Definition at line 123 of file class.ilSessionAppEventListener.php.

References $type, sendMail(), and ilSessionMembershipMailNotification\TYPE_ENTER_NOTIFICATION.

Referenced by handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleEvent()

static ilSessionAppEventListener::handleEvent ( string  $a_component,
string  $a_event,
array  $a_parameter 
)
static

Handle an event in a listener.

Parameters
string$a_componentcomponent, e.g. "Modules/Forum" or "Services/User"
string$a_eventevent e.g. "createUser", "updateUser", "deleteUser", ...
array$a_parameterparameter array (assoc), array("name" => ..., "phone_office" => ...)

Implements ilAppEventListener.

Definition at line 71 of file class.ilSessionAppEventListener.php.

References $DIC.

71  : void
72  {
73  global $DIC;
74 
75  $listener = new static(
76  $DIC->database(),
77  $DIC['ilObjDataCache'],
78  $DIC->logger()->sess()
79  );
80 
81  $listener
82  ->withComponent($a_component)
83  ->withEvent($a_event)
84  ->withParameters($a_parameter)
85  ->handle();
86  }
global $DIC
Definition: feed.php:28

◆ handleRegisterEvent()

ilSessionAppEventListener::handleRegisterEvent ( )
private

Definition at line 117 of file class.ilSessionAppEventListener.php.

References $type, sendMail(), and ilSessionMembershipMailNotification\TYPE_REGISTER_NOTIFICATION.

Referenced by handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleUnregisterEvent()

ilSessionAppEventListener::handleUnregisterEvent ( )
private

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

References $type, sendMail(), and ilSessionMembershipMailNotification\TYPE_UNREGISTER_NOTIFICATION.

Referenced by handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendMail()

ilSessionAppEventListener::sendMail ( int  $type)
private

Definition at line 150 of file class.ilSessionAppEventListener.php.

References fetchRecipientParticipants().

Referenced by handleEnteredEvent(), handleRegisterEvent(), and handleUnregisterEvent().

150  : void
151  {
152  $recipients = $this->fetchRecipientParticipants();
153  if (!empty($recipients)) {
154  $notification = new ilSessionMembershipMailNotification();
155  $notification->setRecipients($recipients);
156  $notification->setType($type);
157  $notification->setRefId($this->parameters['ref_id']);
158  $notification->send((int) $this->parameters['usr_id']);
159  }
160  }
$type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withComponent()

ilSessionAppEventListener::withComponent ( string  $component)

Definition at line 44 of file class.ilSessionAppEventListener.php.

References $component.

45  {
46  $clone = clone $this;
47 
48  $clone->component = $component;
49 
50  return $clone;
51  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ withEvent()

ilSessionAppEventListener::withEvent ( string  $event)

Definition at line 53 of file class.ilSessionAppEventListener.php.

References $event.

54  {
55  $clone = clone $this;
56 
57  $clone->event = $event;
58 
59  return $clone;
60  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ withParameters()

ilSessionAppEventListener::withParameters ( array  $parameters)

Definition at line 62 of file class.ilSessionAppEventListener.php.

References $parameters.

63  {
64  $clone = clone $this;
65 
66  $clone->parameters = $parameters;
67 
68  return $clone;
69  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Field Documentation

◆ $component

string ilSessionAppEventListener::$component = ""
protected

Definition at line 30 of file class.ilSessionAppEventListener.php.

Referenced by withComponent().

◆ $database

ilDBInterface ilSessionAppEventListener::$database
protected

Definition at line 27 of file class.ilSessionAppEventListener.php.

◆ $event

string ilSessionAppEventListener::$event = ""
protected

Definition at line 31 of file class.ilSessionAppEventListener.php.

Referenced by withEvent().

◆ $logger

ilLogger ilSessionAppEventListener::$logger
protected

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

Referenced by __construct().

◆ $objectDataCache

ilObjectDataCache ilSessionAppEventListener::$objectDataCache
protected

Definition at line 28 of file class.ilSessionAppEventListener.php.

Referenced by __construct().

◆ $parameters

array ilSessionAppEventListener::$parameters = []
protected

Definition at line 32 of file class.ilSessionAppEventListener.php.

Referenced by withParameters().


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