19declare(strict_types=1);
25use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
56 public const MODE =
"mode";
100 public function run() : void
102 $this->notification_groups = $this->dic->globalScreen()->collector()->notifications()->getNotifications();
103 $this->administrative_notifications = $this->dic->globalScreen()->collector()->notifications(
104 )->getAdministrativeNotifications();
106 $this->single_identifier_to_handle = $this->dic->http()->request()->getQueryParams()[
self::ITEM_ID] ??
null;
108 switch ($this->dic->http()->request()->getQueryParams()[self::MODE] ??
'none') {
128 foreach ($this->notification_groups as $notification_group) {
129 foreach ($notification_group->getNotifications() as $notification) {
131 $this->hash($notification->getProviderIdentification()->serialize()),
132 $this->identifiers_to_handle,
135 $notification->getOpenedCallable()();
139 $this->hash($notification_group->getProviderIdentification()->serialize()),
140 $this->identifiers_to_handle,
143 $notification_group->getOpenedCallable()();
153 foreach ($this->notification_groups as $notification_group) {
154 foreach ($notification_group->getNotifications() as $notification) {
155 if ($this->single_identifier_to_handle !== $this->hash(
156 $notification->getProviderIdentification()->serialize()
160 if (!$notification->hasClosedCallable()) {
163 $notification->getClosedCallable()();
166 foreach ($this->administrative_notifications as $administrative_notification) {
167 if ($this->single_identifier_to_handle !== $this->hash(
168 $administrative_notification->getProviderIdentification()->serialize()
172 if (!$administrative_notification->hasClosedCallable()) {
175 $administrative_notification->getClosedCallable()();
187 foreach ($this->notification_groups as $group) {
188 $notifications[] = $group->getRenderer($this->dic->ui()->factory())->getNotificationComponentForItem(
191 if ($group->getNewNotificationsCount() > 0) {
195 $this->dic->http()->saveResponse(
196 $this->dic->http()->response()
200 'html' => $this->dic->ui()->renderer()->renderAsync($notifications),
201 'symbol' => $this->dic->ui()->renderer()->render(
202 $this->dic->ui()->factory()->symbol()->glyph()->notification()->withCounter(
203 $this->dic->ui()->factory()->counter()->novelty($amount)
211 $this->dic->http()->sendResponse();
212 $this->dic->http()->close();
An exception for terminatinating execution or to throw for unit testing.
Customizing of pimple-DIC for ILIAS.
Class Streams Stream factory which enables the user to create streams without the knowledge of the co...
static ofString($string)
Creates a new stream with an initial value.
const MODE_CLOSED
Value of the MODE GET param, if the Notification Center has been closed.
const NOTIFICATION_IDENTIFIERS
Used to read the identifiers out of the GET param later.
$single_identifier_to_handle
const MODE_RERENDER
Value of the MODE GET param, if the Notification Center should be rerendered.
const ITEM_ID
NAME of the GET param, to indicate the item ID of the closed item.
const NOTIFY_ENDPOINT
Location of the endpoint handling async notification requests.
const MODE_OPENED
Value of the MODE GET param, if the Notification Center has been opened.
handleOpened()
Loops through all available open callable provided by the notification providers.
const MODE
Name of the GET param used in the async calls.
handleClosed()
Runs the closed callable if such a callable is provided.
$administrative_notifications
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...