19 declare(strict_types=1);
33 $current_user = $this->dic[
'ilUser'];
35 if ($current_user->getId() === 0 || $current_user->isAnonymous()) {
40 $left_interval_timestamp = $current_user->getPref(self::NOTIFICATION_TIME_PREFERENCE_KEY);
41 $notifications = $osd_notification_handler->getOSDNotificationsForUser(
42 $current_user->getId(),
44 time() - $left_interval_timestamp,
45 self::NOTIFICATION_TYPE
48 if (count($notifications) === 0) {
52 $icon = $this->dic[
'ui.factory']->symbol()->icon()->standard(Standard::LSO,
'lso_completion');
53 $item_factory = $this->dic[
'ui.factory']->item();
54 $lng = $this->dic[
'lng'];
55 $lng->loadLanguageModule(
'lso');
58 $group = $this->
globalScreen()->notifications()->factory()->standardGroup(
59 $this->
if->identifier(
'lso_bucket_group')
63 foreach ($notifications as $notification) {
64 $lso_title = $notification->getObject()->title;
65 $title = sprintf(
$lng->txt(
'notification_lso_completed_title'), $lso_title);
66 $notification_item = $item_factory->notification($title, $icon);
68 $group->addNotification(
70 $this->
if->identifier(
'lso_bucket')
72 ->withNotificationItem($notification_item)
74 function () use ($current_user, $osd_notification_handler):
void {
75 $current_user->writePref(self::NOTIFICATION_TIME_PREFERENCE_KEY, (
string) time());
76 $osd_notification_handler->deleteStaleNotificationsForUserAndType(
77 $current_user->getId(),
78 self::NOTIFICATION_TYPE
82 ->withNewAmount(count($notifications))
Interface AbstractNotificationProvider.
standard()
description: > This is an example, of how the Notification Slate is generated by assigning Notificat...
if(!file_exists('../ilias.ini.php'))
const NOTIFICATION_TIME_PREFERENCE_KEY