3declare(strict_types=1);
59 if ($template ===
null) {
64 if ($controller ===
null) {
82 if (!$this->controller->getCmd()) {
86 $cmd = $this->controller->getCmd() .
'Object';
95 return $this->handler[
$type];
100 return ilNotificationDatabaseHandler::getAvailableTypes($types);
105 return ilNotificationDatabaseHandler::getAvailableChannels($types);
112 foreach ($this->dic->globalScreen()->collector()->toasts()->getToasts() as $toast) {
113 $renderer = $toast->getRenderer();
114 $toasts[] = $renderer->getToastComponentForItem($toast);
117 $this->dic->http()->saveResponse(
118 $this->dic->http()->response()
119 ->withBody(Streams::ofString(
120 $this->dic->ui()->renderer()->renderAsync($toasts)
123 $this->dic->http()->sendResponse();
124 $this->dic->http()->close();
129 if (!array_key_exists($channel, $this->handler) || !is_array($this->handler[$channel])) {
130 $this->handler[$channel] = [];
133 $this->handler[$channel][] =
$handler;
138 $userTypes = ilNotificationDatabaseHandler::loadUserConfig($this->
user->getId());
140 $this->
language->loadLanguageModule(
'notification');
143 $chk =
new ilCheckboxInputGUI($this->
language->txt(
'enable_custom_notification_configuration'),
'enable_custom_notification_configuration');
145 $chk->setChecked($this->dic->refinery()->kindlyTo()->int()->transform($this->user->getPref(
'use_custom_notification_setting')) === 1);
146 $form->addItem($chk);
148 $form->setFormAction($this->controller->getFormAction($this,
'showSettingsObject'));
149 $form->addCommandButton(
'saveCustomizingOption', $this->
language->txt(
'save'));
150 $form->addCommandButton(
'showSettings', $this->
language->txt(
'cancel'));
154 $table->setFormAction($this->controller->getFormAction($this,
'saveSettings'));
158 $this->dic->refinery()->kindlyTo()->int()->transform(
159 $this->user->getPref(
'use_custom_notification_setting')
162 $table->addCommandButton(
'saveSettings', $this->
language->txt(
'save'));
163 $table->addCommandButton(
'showSettings', $this->
language->txt(
'cancel'));
164 $table->setEditable(
true);
166 $table->setEditable(
false);
169 $this->
template->setContent($form->getHtml() . $table->getHTML());
Customizing of pimple-DIC for ILIAS.
user()
Get the current user.
language()
Get interface to the i18n service.
ui()
Get the interface to get services from UI framework.
ctrl()
Get the interface to the control structure.
ilCtrlInterface $controller
getOSDNotificationsObject()
addHandler(string $channel, ilNotificationHandler $handler)
getAvailableChannels(array $types=[])
getAvailableTypes(array $types=[])
__construct(?ilObjUser $user=null, ?ilGlobalTemplateInterface $template=null, ?ilCtrlInterface $controller=null, ?ilLanguage $language=null, ?Container $dic=null)
ilGlobalTemplateInterface $template
static enableWebAccessWithoutSession(bool $enable_web_access_without_session)
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...