ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilNotificationGUI Class Reference
+ Inheritance diagram for ilNotificationGUI:
+ Collaboration diagram for ilNotificationGUI:

Public Member Functions

 __construct (?ilObjUser $user=null, ?ilGlobalTemplateInterface $template=null, ?ilCtrlInterface $controller=null, ?ilLanguage $language=null, ?Container $dic=null)
 
 executeCommand ()
 
 getHandler (string $type)
 
 getOSDNotificationsObject ()
 
 addHandler (string $channel, ilNotificationHandler $handler)
 
 showSettingsObject ()
 

Private Member Functions

 getAvailableTypes (array $types=[])
 
 getAvailableChannels (array $types=[])
 

Private Attributes

array $handler = []
 
readonly Container $dic
 
readonly ilObjUser $user
 
readonly ilGlobalTemplateInterface $template
 
readonly ilCtrlInterface $controller
 
readonly ilLanguage $language
 

Detailed Description

Author
Ingmar Szmais iszma.nosp@m.is@d.nosp@m.ataba.nosp@m.y.de

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

Constructor & Destructor Documentation

◆ __construct()

ilNotificationGUI::__construct ( ?ilObjUser  $user = null,
?ilGlobalTemplateInterface  $template = null,
?ilCtrlInterface  $controller = null,
?ilLanguage  $language = null,
?Container  $dic = null 
)

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

References $controller, $DIC, $dic, $language, $template, $user, ILIAS\UI\examples\Symbol\Glyph\Language\language(), null, ILIAS\Repository\user(), and ILIAS\DI\Container\user().

46  {
47  if ($dic === null) {
48  global $DIC;
49  $dic = $DIC;
50  }
51  $this->dic = $dic;
52 
53  if ($user === null) {
54  $user = $dic->user();
55  }
56  $this->user = $user;
57 
58  if ($template === null) {
59  $template = $dic->ui()->mainTemplate();
60  }
61  $this->template = $template;
62 
63  if ($controller === null) {
64  $controller = $dic->ctrl();
65  }
66  $this->controller = $controller;
67 
68  if ($language === null) {
69  $language = $dic->language();
70  }
71  $this->language = $language;
72  }
user()
Get the current user.
Definition: Container.php:71
readonly ilObjUser $user
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
readonly Container $dic
readonly ilLanguage $language
global $DIC
Definition: shib_login.php:22
language()
Get interface to the i18n service.
Definition: Container.php:95
readonly ilCtrlInterface $controller
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
ctrl()
Get the interface to the control structure.
Definition: Container.php:63
readonly ilGlobalTemplateInterface $template
ui()
Get the interface to get services from UI framework.
Definition: Container.php:127
+ Here is the call graph for this function:

Member Function Documentation

◆ addHandler()

ilNotificationGUI::addHandler ( string  $channel,
ilNotificationHandler  $handler 
)

Definition at line 130 of file class.ilNotificationGUI.php.

References $handler.

130  : void
131  {
132  if (!array_key_exists($channel, $this->handler)) {
133  $this->handler[$channel] = [];
134  }
135 
136  $this->handler[$channel][] = $handler;
137  }

◆ executeCommand()

ilNotificationGUI::executeCommand ( )

Definition at line 74 of file class.ilNotificationGUI.php.

74  : void
75  {
76  if (!$this->controller->getCmd()) {
77  return;
78  }
79 
80  $cmd = $this->controller->getCmd() . 'Object';
81  $this->$cmd();
82  }

◆ getAvailableChannels()

ilNotificationGUI::getAvailableChannels ( array  $types = [])
private
Parameters
list<string>$types
Returns
array<string, array<string, mixed>>

Definition at line 105 of file class.ilNotificationGUI.php.

Referenced by showSettingsObject().

105  : array
106  {
107  return ilNotificationDatabaseHandler::getAvailableChannels($types);
108  }
+ Here is the caller graph for this function:

◆ getAvailableTypes()

ilNotificationGUI::getAvailableTypes ( array  $types = [])
private
Parameters
list<string>$types
Returns
array<string, array<string, mixed>>

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

Referenced by showSettingsObject().

96  : array
97  {
98  return ilNotificationDatabaseHandler::getAvailableTypes($types);
99  }
+ Here is the caller graph for this function:

◆ getHandler()

ilNotificationGUI::getHandler ( string  $type)
Returns
list<ilNotificationHandler>|null

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

References null.

87  : ?array
88  {
89  return $this->handler[$type] ?? null;
90  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getOSDNotificationsObject()

ilNotificationGUI::getOSDNotificationsObject ( )

Definition at line 110 of file class.ilNotificationGUI.php.

References $renderer, and ilSession\enableWebAccessWithoutSession().

110  : void
111  {
113 
114  $toasts = [];
115  foreach ($this->dic->globalScreen()->collector()->toasts()->getToasts() as $toast) {
116  $renderer = $toast->getRenderer();
117  $toasts[] = $renderer->getToastComponentForItem($toast);
118  }
119 
120  $this->dic->http()->saveResponse(
121  $this->dic->http()->response()
122  ->withBody(Streams::ofString(
123  $this->dic->ui()->renderer()->renderAsync($toasts)
124  ))
125  );
126  $this->dic->http()->sendResponse();
127  $this->dic->http()->close();
128  }
static enableWebAccessWithoutSession(bool $enable_web_access_without_session)
$renderer
+ Here is the call graph for this function:

◆ showSettingsObject()

ilNotificationGUI::showSettingsObject ( )

Definition at line 139 of file class.ilNotificationGUI.php.

References getAvailableChannels(), getAvailableTypes(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), and ILIAS\Repository\user().

139  : void
140  {
141  $userTypes = ilNotificationDatabaseHandler::loadUserConfig($this->user->getId());
142 
143  $this->language->loadLanguageModule('notification');
144 
145  $form = new ilPropertyFormGUI();
146  $chk = new ilCheckboxInputGUI($this->language->txt('enable_custom_notification_configuration'), 'enable_custom_notification_configuration');
147  $chk->setValue('1');
148  $chk->setChecked($this->dic->refinery()->kindlyTo()->int()->transform($this->user->getPref('use_custom_notification_setting')) === 1);
149  $form->addItem($chk);
150 
151  $form->setFormAction($this->controller->getFormAction($this, 'showSettingsObject'));
152  $form->addCommandButton('saveCustomizingOption', $this->language->txt('save'));
153  $form->addCommandButton('showSettings', $this->language->txt('cancel'));
154 
155  $table = new ilNotificationSettingsTable($this, 'a title', $this->getAvailableChannels(['set_by_user']), $userTypes);
156 
157  $table->setFormAction($this->controller->getFormAction($this, 'saveSettings'));
158  $table->setData($this->getAvailableTypes(['set_by_user']));
159 
160  if (
161  $this->dic->refinery()->kindlyTo()->int()->transform(
162  $this->user->getPref('use_custom_notification_setting')
163  ) === 1
164  ) {
165  $table->addCommandButton('saveSettings', $this->language->txt('save'));
166  $table->addCommandButton('showSettings', $this->language->txt('cancel'));
167  $table->setEditable(true);
168  } else {
169  $table->setEditable(false);
170  }
171 
172  $this->template->setContent($form->getHtml() . $table->getHTML());
173  }
getAvailableChannels(array $types=[])
getAvailableTypes(array $types=[])
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:

Field Documentation

◆ $controller

readonly ilCtrlInterface ilNotificationGUI::$controller
private

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

Referenced by __construct().

◆ $dic

readonly Container ilNotificationGUI::$dic
private

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

Referenced by __construct().

◆ $handler

array ilNotificationGUI::$handler = []
private

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

Referenced by addHandler().

◆ $language

readonly ilLanguage ilNotificationGUI::$language
private

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

Referenced by __construct().

◆ $template

readonly ilGlobalTemplateInterface ilNotificationGUI::$template
private

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

Referenced by __construct().

◆ $user

readonly ilObjUser ilNotificationGUI::$user
private

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

Referenced by __construct().


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