3 declare(strict_types=1);
43 if ($clock === null) {
44 $clock = (new \ILIAS\Data\Factory())->clock()->utc();
51 $this->repo->createOSDNotification($notification->user->getId(), $notification);
59 $notifications = $this->repo->getOSDNotificationsByUser($user_id, $max_age_seconds,
$type);
61 foreach ($notifications as $notification) {
62 if ($append_osd_id_to_link) {
63 foreach ($notification->getObject()->links as $link) {
64 $link->setUrl($this->
appendParamToLink($link->getUrl(),
'osd_id', $notification->getId()));
69 return $notifications;
77 $this->repo->deleteStaleOSDNotificationsForUserAndType($type, $user_id, $this->clock->now()->getTimestamp());
82 $this->repo->deleteStaleOSDNotificationsForUserAndType($provider, $user_id, $this->clock->now()->getTimestamp());
87 return $this->repo->deleteOSDNotificationById($notification_osd_id);
92 return $this->repo->deleteOSDNotificationByIdentification(
101 if (strpos($link,
'?') !==
false) {
102 $link .=
'&' . $param .
'=' . $value;
104 $link .=
'?' . $param .
'=' . $value;
111 $this->repo->deleteAllOSDNotifications();
deleteStaleNotificationsForUserAndType(int $user_id, string $type)
removeOSDNotification(int $notification_osd_id)
getOSDNotificationsForUser(int $user_id, bool $append_osd_id_to_link=true, int $max_age_seconds=0, string $type='')
notify(ilNotificationObject $notification)
__construct(?ilNotificationOSDRepository $repo=null, ?ClockInterface $clock=null)
ilNotificationOSDRepository $repo
removeOSDNotificationByIdentification(string $provider, string $identification, int $user_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
appendParamToLink(string $link, string $param, int $value)
deleteStaleOSDNotificationsForUser(string $provider, int $user_id)