19 declare(strict_types=1);
37 if (0 === $this->dic->user()->getId() || $this->dic->user()->isAnonymous()) {
41 $leftIntervalTimestamp = $this->dic->user()->getPref(self::MUTED_UNTIL_PREFERENCE_KEY);
46 foreach ($osd_notification_handler->getOSDNotificationsForUser(
47 $this->dic->user()->getId(),
49 time() - $leftIntervalTimestamp,
50 self::NOTIFICATION_TYPE
52 $invitations[] = $osd;
53 if ($latest_time < $osd->getTimeAdded()) {
54 $latest_time = $osd->getTimeAdded();
58 $this->dic->language()->loadLanguageModule(
'chatroom');
60 if ($invitations === []) {
64 $aggregatedItems = [];
65 foreach ($invitations as $invitation) {
67 if (count($invitation->getObject()->links) === 1) {
68 $link = $this->dic->ui()->renderer()->render(
69 $this->dic->ui()->factory()->link()->standard(
70 $invitation->getObject()->shortDescription,
71 $invitation->getObject()->links[0]->getUrl()
75 $aggregatedItems[] = $this->dic->ui()->factory()->item()->notification(
76 $invitation->getObject()->title,
77 $this->dic->ui()->factory()->symbol()->icon()->standard(
Standard::CHTA,
'chat_invitations')
78 )->withDescription($link)
86 $notificationItem = $this->dic->ui()->factory()->item()->notification(
87 $this->dic->ui()->factory()->link()->standard($this->dic->language()->txt(
'chat_invitations'),
'#'),
88 $this->dic->ui()->factory()->symbol()->icon()->standard(
Standard::CHTA,
'chat_invitations')
89 )->withAggregateNotifications($aggregatedItems)
92 $this->dic->language()->txt(
'chat_invitation_nc_inv_x'),
93 count($aggregatedItems)
102 $this->
globalScreen()->notifications()->factory()->standardGroup(
103 $this->
if->identifier(
'chat_invitation_bucket_group')
107 $this->
if->identifier(
'chat_invitation_bucket')
108 )->withNotificationItem($notificationItem)
109 ->withNewAmount(count($invitations))
110 ->withClosedCallable(
111 function () use ($osd_notification_handler):
void {
112 $this->dic->user()->writePref(self::MUTED_UNTIL_PREFERENCE_KEY, (
string) time());
114 $osd_notification_handler->deleteStaleNotificationsForUserAndType(
115 $this->dic->user()->getId(),
116 self::NOTIFICATION_TYPE
Interface AbstractNotificationProvider.
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const MUTED_UNTIL_PREFERENCE_KEY