19declare(strict_types=1);
44 $clock = (new \ILIAS\Data\Factory())->clock()->utc();
51 $this->repo->createOSDNotification($notification->user->getId(), $notification);
59 bool $append_osd_id_to_link =
true,
60 int $max_age_seconds = 0,
63 $notifications = $this->repo->getOSDNotificationsByUser(
$user_id, $max_age_seconds, $type);
65 foreach ($notifications as $notification) {
66 if ($append_osd_id_to_link) {
67 foreach ($notification->getObject()->links as $link) {
68 $link->setUrl($this->
appendParamToLink($link->getUrl(),
'osd_id', $notification->getId()));
73 return $notifications;
81 $this->repo->deleteStaleOSDNotificationsForUserAndType($type,
$user_id, $this->clock->now()->getTimestamp());
86 $this->repo->deleteStaleOSDNotificationsForUserAndType(
$provider,
$user_id, $this->clock->now()->getTimestamp());
91 return $this->repo->deleteOSDNotificationById($notification_osd_id);
96 return $this->repo->deleteOSDNotificationByIdentification(
105 if (str_contains($link,
'?')) {
106 $link .=
'&' .
$param .
'=' . $value;
108 $link .=
'?' .
$param .
'=' . $value;
116 $this->repo->deleteAllOSDNotifications();
readonly ilNotificationOSDRepository $repo
notify(ilNotificationObject $notification)
getOSDNotificationsForUser(int $user_id, bool $append_osd_id_to_link=true, int $max_age_seconds=0, string $type='')
deleteStaleNotificationsForUserAndType(int $user_id, string $type)
__construct(?ilNotificationOSDRepository $repo=null, ?ClockInterface $clock=null)
removeOSDNotificationByIdentification(string $provider, string $identification, int $user_id=0)
deleteStaleOSDNotificationsForUser(string $provider, int $user_id)
removeOSDNotification(int $notification_osd_id)
appendParamToLink(string $link, string $param, int $value)
readonly ClockInterface $clock