ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Notifications\Provider\NotificationsToastProvider Class Reference
+ Inheritance diagram for ILIAS\Notifications\Provider\NotificationsToastProvider:
+ Collaboration diagram for ILIAS\Notifications\Provider\NotificationsToastProvider:

Public Member Functions

 getToasts ()
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\Toast\Provider\AbstractToastProvider
 __construct (Container $dic)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (protected Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getToasts ()
 

Protected Member Functions

 getIconByType (string $type)
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\Toast\Provider\AbstractToastProvider
Container $dic
 
Factory $ui_factory
 
IdentificationProviderInterface $if
 
ToastFactory $toast_factory
 

Detailed Description

Author
Ingmar Szmais iszma.nosp@m.is@d.nosp@m.ataba.nosp@m.y.de

Definition at line 38 of file NotificationsToastProvider.php.

Member Function Documentation

◆ getIconByType()

ILIAS\Notifications\Provider\NotificationsToastProvider::getIconByType ( string  $type)
protected

Definition at line 86 of file NotificationsToastProvider.php.

References ILIAS\UI\Component\Symbol\Icon\Standard\BDGA, ILIAS\UI\Component\Symbol\Icon\Standard\CADM, ILIAS\UI\Component\Symbol\Icon\Standard\CHTA, ILIAS\UI\Component\Symbol\Icon\Standard\LSO, ILIAS\Badge\GlobalScreen\BadgeNotificationProvider\NOTIFICATION_TYPE, ILIAS\Chatroom\GlobalScreen\ChatInvitationNotificationProvider\NOTIFICATION_TYPE, ILIAS\Contact\Provider\ContactNotificationProvider\NOTIFICATION_TYPE, and ilLSCompletionNotificationProvider\NOTIFICATION_TYPE.

Referenced by ILIAS\Notifications\Provider\NotificationsToastProvider\getToasts().

+ Here is the caller graph for this function:

◆ getToasts()

ILIAS\Notifications\Provider\NotificationsToastProvider::getToasts ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Scope\Toast\Provider\ToastProvider.

Definition at line 43 of file NotificationsToastProvider.php.

43 : array
44 {
45 $settings = new ilSetting('notifications');
46 $toasts = [];
47
48 $osd_repository = new ilNotificationOSDRepository($this->dic->database());
49 $osd_notification_handler = new ilNotificationOSDHandler($osd_repository);
50
51 foreach ($osd_notification_handler->getOSDNotificationsForUser(
52 $this->dic->user()->getId(),
53 true,
54 time() - ($this->dic->http()->request()->getQueryParams()['max_age'] ?? time())
55 ) as $notification) {
56 $type = $notification->getType();
57 $toast = $this->toast_factory
58 ->standard(
59 $this->if->identifier((string) $notification->getId()),
60 $notification->getObject()->title
61 )
62 ->withIcon($this->getIconByType($notification->getType()))
63 ->withDescription($notification->getObject()->shortDescription)
64 ->withClosedCallable(static function () use ($osd_repository, $notification) {
65 $osd_repository->deleteOSDNotificationById($notification->getId());
66 });
67
68 foreach ($notification->getObject()->links as $id => $link) {
69 $toast = $toast->withAdditionToastAction(
70 $this->toast_factory->action(
71 $notification->getId() . '_link_' . $id,
72 $link->getTitle(),
73 function () use ($link, $osd_repository, $notification): void {
74 $osd_repository->deleteOSDNotificationById($notification->getId());
75 $this->dic->ctrl()->redirectToURL($link->getUrl());
76 }
77 )
78 );
79 }
80 $toasts[] = $toast;
81 }
82
83 return $toasts;
84 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
ILIAS Setting Class.
if(!file_exists('../ilias.ini.php'))

References $id, ILIAS\Notifications\Provider\NotificationsToastProvider\getIconByType(), and if.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: