ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Notifications\Provider\NotificationsToastProvider Class Reference
+ Inheritance diagram for ILIAS\Notifications\Provider\NotificationsToastProvider:
+ Collaboration diagram for ILIAS\Notifications\Provider\NotificationsToastProvider:

Public Member Functions

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

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 ilLSCompletionNotificationProvider\NOTIFICATION_TYPE.

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

86  : Icon
87  {
88  $name = 'default';
89  switch ($type) {
90  case BadgeNotificationProvider::NOTIFICATION_TYPE:
91  $name = Standard::BDGA;
92  break;
93  case ChatInvitationNotificationProvider::NOTIFICATION_TYPE:
94  $name = Standard::CHTA;
95  break;
96  case ContactNotificationProvider::NOTIFICATION_TYPE:
97  $name = Standard::CADM;
98  break;
100  $name = Standard::LSO;
101  break;
102 
103  }
104  return $this->dic->ui()->factory()->symbol()->icon()->standard($name, $type);
105  }
+ Here is the caller graph for this function:

◆ getToasts()

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

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

Definition at line 43 of file NotificationsToastProvider.php.

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

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  }
if(!file_exists('../ilias.ini.php'))
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

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