ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilForumNotificationEventsFormGUI Class Reference
+ Collaboration diagram for ilForumNotificationEventsFormGUI:

Public Member Functions

array __construct (private string $action, private ?array $predefined_values, private \ILIAS\UI\Factory $ui_factory, private ilLanguage $lng)
 
 getValueForEvent (string $event)
 
 getValidEvents ()
 
 build ()
 

Private Attributes

array $events
 

Detailed Description

Definition at line 21 of file class.ilForumNotificationEventsFormGUI.php.

Constructor & Destructor Documentation

◆ __construct()

array ilForumNotificationEventsFormGUI::__construct ( private string  $action,
private ?array  $predefined_values,
private \ILIAS\UI\Factory  $ui_factory,
private ilLanguage  $lng 
)

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

37  {
38  }

Member Function Documentation

◆ build()

ilForumNotificationEventsFormGUI::build ( )

Definition at line 57 of file class.ilForumNotificationEventsFormGUI.php.

References ILIAS\LTI\ToolProvider\$key, and ILIAS\Repository\lng().

Referenced by ilForumSettingsGUI\saveEventsForUser().

58  {
59  $items = [];
60 
61  foreach (array_keys($this->events) as $key) {
62  $checkbox = $this->ui_factory->input()->field()->checkbox($this->lng->txt($key));
63  if ($this->predefined_values !== null && isset($this->predefined_values[$key])) {
64  $checkbox = $checkbox->withValue($this->predefined_values[$key]);
65  }
66 
67  $items[$key] = $checkbox;
68  }
69 
70  $hidden = $this->ui_factory->input()->field()->hidden();
71  if ($this->predefined_values !== null && isset($this->predefined_values['hidden_value'])) {
72  $hidden = $hidden->withValue((string) $this->predefined_values['hidden_value']);
73  }
74  $items['hidden_value'] = $hidden;
75 
76  return $this->ui_factory->input()->container()->form()->standard(
77  $this->action,
78  $items
79  );
80  }
This describes commonalities between all forms.
Definition: Form.php:32
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidEvents()

ilForumNotificationEventsFormGUI::getValidEvents ( )
Returns
list<string>

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

52  : array
53  {
54  return array_keys($this->events);
55  }

◆ getValueForEvent()

ilForumNotificationEventsFormGUI::getValueForEvent ( string  $event)

Definition at line 40 of file class.ilForumNotificationEventsFormGUI.php.

40  : int
41  {
42  if (isset($this->events[$event])) {
43  return $this->events[$event];
44  }
45 
46  throw new InvalidArgumentException(sprintf('Event "%s" is not supported.', $event));
47  }

Field Documentation

◆ $events

array ilForumNotificationEventsFormGUI::$events
private
Initial value:
= [

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


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