ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
NotificationsPushProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29use ilLanguage;
30use ilObjUser;
31
33{
34 protected const int TTL = 60;
37
39 {
40 $this->handler = new ilNotificationPushHandler($provider);
41 $this->config = new ilNotificationConfig('push');
42 $this->config->setHandlerParam('setting.user_pref', $provider->getIdentifier());
43 $this->config->setHandlerParam('setting.ttl', (string) $this::TTL);
44 }
45
46 public function push(ilObjUser $user, string $title, string $description = '', ?ilNotificationLink $link = null): bool
47 {
48 $notification = new ilNotificationObject($this->config, $user);
49 $notification->title = $title;
50 $notification->shortDescription = $description;
51 $notification->links = $link ? [$link] : [];
52 $this->handler->notify($notification);
53 return $this->handler->getLastQueueResult() === PushQueueResult::SUCCEEDED;
54 }
55}
push(ilObjUser $user, string $title, string $description='', ?ilNotificationLink $link=null)
This is the lowest common denominator of all popular browsers.
language handling
User class.
$provider
Definition: ltitoken.php:80