ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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

Container $dic
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMailAppEventListener::__construct ( )

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

References $DIC.

38  {
39  global $DIC;
40  $this->dic = $DIC;
41  }
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ handle()

ilMailAppEventListener::handle ( )

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

References ilMailOptions\BOTH_EMAIL, ilMailGlobalAddressSettingsChangedCommand\execute(), ilMailOptions\FIRST_EMAIL, isRelevantEvent(), and ilMailOptions\SECOND_EMAIL.

76  : void
77  {
78  if (isset($this->parameters['visible_second_email'])
79  && $this->isRelevantEvent()
80  && !(bool) $this->parameters['visible_second_email']->getNewValue()) {
81  switch ((int) ($this->dic->settings()->get('mail_address_option') ?? ilMailOptions::FIRST_EMAIL)) {
84  $globalAddressSettingsChangedCommand = new ilMailGlobalAddressSettingsChangedCommand(
85  $this->dic->database(),
87  );
88  $globalAddressSettingsChangedCommand->execute();
89  break;
90  }
91  }
92  }
+ Here is the call graph for this function:

◆ handleEvent()

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

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

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

◆ isRelevantEvent()

ilMailAppEventListener::isRelevantEvent ( )
private

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

Referenced by handle().

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

◆ withComponent()

ilMailAppEventListener::withComponent ( string  $component)

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

References $component.

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

◆ withEvent()

ilMailAppEventListener::withEvent ( string  $event)

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

References $event.

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

◆ withParameters()

ilMailAppEventListener::withParameters ( array  $parameters)

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

References $parameters.

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

Field Documentation

◆ $component

string ilMailAppEventListener::$component = ''
protected

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

Referenced by withComponent().

◆ $dic

Container ilMailAppEventListener::$dic
private

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

◆ $event

string ilMailAppEventListener::$event = ''
protected

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

Referenced by withEvent().

◆ $parameters

array ilMailAppEventListener::$parameters = []
protected

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

Referenced by withParameters().


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