ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilMailAppEventListener Class Reference
+ Inheritance diagram for ilMailAppEventListener:
+ Collaboration diagram for ilMailAppEventListener:

Public Member Functions

 __construct ()
 
 withComponent (string $component)
 
 withEvent (string $event)
 
 withParameters (array $parameters)
 
 handle ()
 

Static Public Member Functions

static handleEvent ($a_component, $a_event, $a_parameter)
 
- Static Public Member Functions inherited from ilAppEventListener
static handleEvent (string $a_component, string $a_event, array $a_parameter)
 Handle an event in a listener. More...
 

Protected Attributes

string $component = ''
 
string $event = ''
 
array $parameters = []
 

Private Member Functions

 isRelevantEvent ()
 

Private Attributes

readonly Container $dic
 

Detailed Description

Definition at line 24 of file class.ilMailAppEventListener.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailAppEventListener::__construct ( )

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

References $DIC.

33  {
34  global $DIC;
35  $this->dic = $DIC;
36  }
global $DIC
Definition: shib_login.php:26

Member Function Documentation

◆ handle()

ilMailAppEventListener::handle ( )

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

References ilMailOptions\BOTH_EMAIL, ilMailGlobalAddressSettingsChangedCommand\execute(), ilMailOptions\FIRST_EMAIL, isRelevantEvent(), ILIAS\UI\examples\Prompt\Standard\parameters(), and ilMailOptions\SECOND_EMAIL.

71  : void
72  {
73  if (isset($this->parameters['visible_second_email'])
74  && $this->isRelevantEvent()
75  && !(bool) $this->parameters['visible_second_email']->getNewValue()) {
76  switch ((int) ($this->dic->settings()->get('mail_address_option') ?? ilMailOptions::FIRST_EMAIL)) {
80  $this->dic->database(),
82  );
83  $command->execute();
84  break;
85  }
86  }
87  }
final const int SECOND_EMAIL
parameters()
description: > This shows how different states are being used in the same Prompt according to parame...
Definition: parameters.php:39
final const int BOTH_EMAIL
final const int FIRST_EMAIL
+ Here is the call graph for this function:

◆ handleEvent()

static ilMailAppEventListener::handleEvent (   $a_component,
  $a_event,
  $a_parameter 
)
static

Definition at line 92 of file class.ilMailAppEventListener.php.

92  : void
93  {
94  $listener = new self();
95  $listener
96  ->withComponent($a_component)
97  ->withEvent($a_event)
98  ->withParameters($a_parameter)
99  ->handle();
100  }

◆ isRelevantEvent()

ilMailAppEventListener::isRelevantEvent ( )
private

Definition at line 65 of file class.ilMailAppEventListener.php.

Referenced by handle().

65  : bool
66  {
67  return $this->component === 'components/ILIAS/User'
68  && $this->event === 'onUserFieldAttributesChanged';
69  }
+ Here is the caller graph for this function:

◆ withComponent()

ilMailAppEventListener::withComponent ( string  $component)

Definition at line 38 of file class.ilMailAppEventListener.php.

References $component.

38  : self
39  {
40  $clone = clone $this;
41 
42  $clone->component = $component;
43 
44  return $clone;
45  }

◆ withEvent()

ilMailAppEventListener::withEvent ( string  $event)

Definition at line 47 of file class.ilMailAppEventListener.php.

References $event.

47  : self
48  {
49  $clone = clone $this;
50 
51  $clone->event = $event;
52 
53  return $clone;
54  }

◆ withParameters()

ilMailAppEventListener::withParameters ( array  $parameters)

Definition at line 56 of file class.ilMailAppEventListener.php.

References $parameters.

56  : self
57  {
58  $clone = clone $this;
59 
60  $clone->parameters = $parameters;
61 
62  return $clone;
63  }

Field Documentation

◆ $component

string ilMailAppEventListener::$component = ''
protected

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

Referenced by withComponent().

◆ $dic

readonly Container ilMailAppEventListener::$dic
private

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

◆ $event

string ilMailAppEventListener::$event = ''
protected

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

Referenced by withEvent().

◆ $parameters

array ilMailAppEventListener::$parameters = []
protected

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

Referenced by withParameters().


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