ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSessionAppEventListener Class Reference
+ 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...
 
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

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ fetchRecipientParticipants()

ilSessionAppEventListener::fetchRecipientParticipants ( )
private

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

134 : array
135 {
136 $object = new ilEventParticipants((int) $this->parameters['obj_id']);
137
138 $recipients = [];
139 $participants = $object->getParticipants();
140 foreach ($participants as $id => $participant) {
141 if ($participant['notification_enabled'] === true) {
142 $recipients[] = $id;
143 }
144 }
145
146 return $recipients;
147 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
class ilEventParticipants

References $id, and ILIAS\UI\examples\Prompt\Standard\parameters().

Referenced by sendMail().

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

◆ handle()

ilSessionAppEventListener::handle ( )

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

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

References Vendor\Package\$e, ILIAS\Repository\event(), ilObjectFactory\getInstanceByObjId(), handleEnteredEvent(), handleRegisterEvent(), handleUnregisterEvent(), ILIAS\Repository\logger(), and ILIAS\UI\examples\Prompt\Standard\parameters().

+ Here is the call graph for this function:

◆ handleEnteredEvent()

ilSessionAppEventListener::handleEnteredEvent ( )
private

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

References 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. "components/ILIAS/Forum" or "components/ILIAS/User"
string$a_eventevent e.g. "createUser", "updateUser", "deleteUser", ...
array<string,mixed>$a_parameter parameter array (assoc), array("name" => ..., "phone_office" => ...)

Implements ilAppEventListener.

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

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

References $DIC.

◆ handleRegisterEvent()

ilSessionAppEventListener::handleRegisterEvent ( )
private

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

References 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 128 of file class.ilSessionAppEventListener.php.

References 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 149 of file class.ilSessionAppEventListener.php.

149 : void
150 {
151 $recipients = $this->fetchRecipientParticipants();
152 if (!empty($recipients)) {
153 $notification = new ilSessionMembershipMailNotification();
154 $notification->setRecipients($recipients);
155 $notification->setType($type);
156 $notification->setRefId($this->parameters['ref_id']);
157 $notification->send((int) $this->parameters['usr_id']);
158 }
159 }

References fetchRecipientParticipants(), and ILIAS\UI\examples\Prompt\Standard\parameters().

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

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

◆ withComponent()

ilSessionAppEventListener::withComponent ( string  $component)

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

44 {
45 $clone = clone $this;
46
47 $clone->component = $component;
48
49 return $clone;
50 }

References $component.

◆ withEvent()

ilSessionAppEventListener::withEvent ( string  $event)

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

53 {
54 $clone = clone $this;
55
56 $clone->event = $event;
57
58 return $clone;
59 }

References $event.

◆ withParameters()

ilSessionAppEventListener::withParameters ( array  $parameters)

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

62 {
63 $clone = clone $this;
64
65 $clone->parameters = $parameters;
66
67 return $clone;
68 }

References $parameters.

Field Documentation

◆ $component

string ilSessionAppEventListener::$component = ""
protected

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

Referenced by withComponent().

◆ $database

ilDBInterface ilSessionAppEventListener::$database
protected

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

◆ $event

string ilSessionAppEventListener::$event = ""
protected

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

Referenced by withEvent().

◆ $logger

ilLogger ilSessionAppEventListener::$logger
protected

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

Referenced by __construct().

◆ $objectDataCache

ilObjectDataCache ilSessionAppEventListener::$objectDataCache
protected

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

Referenced by __construct().

◆ $parameters

array ilSessionAppEventListener::$parameters = []
protected

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

Referenced by withParameters().


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