ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMailAppEventListener Class Reference

Class ilMailAppEventListener. More...

+ 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

Constructor & Destructor Documentation

◆ __construct()

ilMailAppEventListener::__construct ( )

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

References $DIC.

37  {
38  global $DIC;
39  $this->dic = $DIC;
40  }
global $DIC
Definition: shib_login.php:22

Member Function Documentation

◆ handle()

ilMailAppEventListener::handle ( )

Definition at line 75 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.

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

◆ handleEvent()

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

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

96  : void
97  {
98  $listener = new self();
99  $listener
100  ->withComponent($a_component)
101  ->withEvent($a_event)
102  ->withParameters($a_parameter)
103  ->handle();
104  }

◆ isRelevantEvent()

ilMailAppEventListener::isRelevantEvent ( )
private

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

Referenced by handle().

69  : bool
70  {
71  return $this->component === 'components/ILIAS/User'
72  && $this->event === 'onUserFieldAttributesChanged';
73  }
+ Here is the caller graph for this function:

◆ withComponent()

ilMailAppEventListener::withComponent ( string  $component)

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

References $component.

42  : self
43  {
44  $clone = clone $this;
45 
46  $clone->component = $component;
47 
48  return $clone;
49  }

◆ withEvent()

ilMailAppEventListener::withEvent ( string  $event)

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

References $event.

51  : self
52  {
53  $clone = clone $this;
54 
55  $clone->event = $event;
56 
57  return $clone;
58  }

◆ withParameters()

ilMailAppEventListener::withParameters ( array  $parameters)

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

References $parameters.

60  : self
61  {
62  $clone = clone $this;
63 
64  $clone->parameters = $parameters;
65 
66  return $clone;
67  }

Field Documentation

◆ $component

string ilMailAppEventListener::$component = ''
protected

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

Referenced by withComponent().

◆ $dic

readonly Container ilMailAppEventListener::$dic
private

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

◆ $event

string ilMailAppEventListener::$event = ''
protected

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

Referenced by withEvent().

◆ $parameters

array ilMailAppEventListener::$parameters = []
protected

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

Referenced by withParameters().


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