19 declare(strict_types=1);
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();
105 $this->identifiers_to_handle = $this->dic->http()->request()->getQueryParams()[self::NOTIFICATION_IDENTIFIERS] ?? [];
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') {
109 case self::MODE_OPENED:
112 case self::MODE_CLOSED:
115 case self::MODE_RERENDER:
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();
$single_identifier_to_handle
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const MODE_CLOSED
Value of the MODE GET param, if the Notification Center has been closed.
const ITEM_ID
NAME of the GET param, to indicate the item ID of the closed item.
handleOpened()
Loops through all available open callable provided by the notification providers. ...
const NOTIFICATION_IDENTIFIERS
Used to read the identifiers out of the GET param later.
const MODE_OPENED
Value of the MODE GET param, if the Notification Center has been opened.
const NOTIFY_ENDPOINT
Location of the endpoint handling async notification requests.
const MODE
Name of the GET param used in the async calls.
static ofString($string)
Creates a new stream with an initial value.
handleClosed()
Runs the closed callable if such a callable is provided.
Exercise XML Parser which completes/updates a given file by an xml string.
$administrative_notifications
const MODE_RERENDER
Value of the MODE GET param, if the Notification Center should be rerendered.