19 declare(strict_types=1);
58 if ($template ===
null) {
59 $template = $dic->ui()->mainTemplate();
63 if ($controller ===
null) {
64 $controller = $dic->ctrl();
68 if ($language ===
null) {
69 $language = $dic->language();
76 if (!$this->controller->getCmd()) {
80 $cmd = $this->controller->getCmd() .
'Object';
89 return $this->handler[$type] ??
null;
98 return ilNotificationDatabaseHandler::getAvailableTypes($types);
107 return ilNotificationDatabaseHandler::getAvailableChannels($types);
115 foreach ($this->dic->globalScreen()->collector()->toasts()->getToasts() as $toast) {
117 $toasts[] =
$renderer->getToastComponentForItem($toast);
120 $this->dic->http()->saveResponse(
121 $this->dic->http()->response()
122 ->withBody(Streams::ofString(
123 $this->dic->ui()->renderer()->renderAsync($toasts)
126 $this->dic->http()->sendResponse();
127 $this->dic->http()->close();
132 if (!array_key_exists($channel, $this->handler)) {
133 $this->handler[$channel] = [];
136 $this->handler[$channel][] =
$handler;
141 $userTypes = ilNotificationDatabaseHandler::loadUserConfig($this->
user->getId());
143 $this->
language->loadLanguageModule(
'notification');
146 $chk =
new ilCheckboxInputGUI($this->
language->txt(
'enable_custom_notification_configuration'),
'enable_custom_notification_configuration');
148 $chk->setChecked($this->dic->refinery()->kindlyTo()->int()->transform($this->
user->getPref(
'use_custom_notification_setting')) === 1);
149 $form->addItem($chk);
151 $form->setFormAction($this->controller->getFormAction($this,
'showSettingsObject'));
152 $form->addCommandButton(
'saveCustomizingOption', $this->
language->txt(
'save'));
153 $form->addCommandButton(
'showSettings', $this->
language->txt(
'cancel'));
157 $table->setFormAction($this->controller->getFormAction($this,
'saveSettings'));
161 $this->dic->refinery()->kindlyTo()->int()->transform(
162 $this->
user->getPref(
'use_custom_notification_setting')
165 $table->addCommandButton(
'saveSettings', $this->
language->txt(
'save'));
166 $table->addCommandButton(
'showSettings', $this->
language->txt(
'cancel'));
167 $table->setEditable(
true);
169 $table->setEditable(
false);
172 $this->
template->setContent($form->getHtml() . $table->getHTML());
getOSDNotificationsObject()
static enableWebAccessWithoutSession(bool $enable_web_access_without_session)
user()
Get the current user.
getAvailableChannels(array $types=[])
addHandler(string $channel, ilNotificationHandler $handler)
__construct(?ilObjUser $user=null, ?ilGlobalTemplateInterface $template=null, ?ilCtrlInterface $controller=null, ?ilLanguage $language=null, ?Container $dic=null)
Customizing of pimple-DIC for ILIAS.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAvailableTypes(array $types=[])
readonly ilLanguage $language
readonly ilCtrlInterface $controller
language()
description: > Example for rendring a language glyph.
readonly ilGlobalTemplateInterface $template