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

Public Member Functions

 __construct (?ilNotificationOSDRepository $repo=null, ?ClockInterface $clock=null)
 
 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)
 
 deleteStaleOSDNotificationsForUser (string $provider, int $user_id)
 
 removeOSDNotification (int $notification_osd_id)
 
 removeOSDNotificationByIdentification (string $provider, string $identification, int $user_id=0)
 
 clear ()
 
- Public Member Functions inherited from ILIAS\Notifications\ilNotificationHandler
 notify (ilNotificationObject $notification)
 
 showSettings (ilPropertyFormGUI $form)
 
 clear ()
 

Private Member Functions

 appendParamToLink (string $link, string $param, int $value)
 

Private Attributes

readonly ilNotificationOSDRepository $repo
 
readonly ClockInterface $clock
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Notifications\ilNotificationOSDHandler::__construct ( ?ilNotificationOSDRepository  $repo = null,
?ClockInterface  $clock = null 
)

Definition at line 36 of file ilNotificationOSDHandler.php.

References ILIAS\Notifications\ilNotificationOSDHandler\$clock, ILIAS\Notifications\ilNotificationOSDHandler\$repo, and null.

37  {
38  if ($repo === null) {
39  $repo = new ilNotificationOSDRepository();
40  }
41  $this->repo = $repo;
42 
43  if ($clock === null) {
44  $clock = (new \ILIAS\Data\Factory())->clock()->utc();
45  }
46  $this->clock = $clock;
47  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
readonly ilNotificationOSDRepository $repo

Member Function Documentation

◆ appendParamToLink()

ILIAS\Notifications\ilNotificationOSDHandler::appendParamToLink ( string  $link,
string  $param,
int  $value 
)
private

Definition at line 103 of file ilNotificationOSDHandler.php.

Referenced by ILIAS\Notifications\ilNotificationOSDHandler\getOSDNotificationsForUser().

103  : string
104  {
105  if (str_contains($link, '?')) {
106  $link .= '&' . $param . '=' . $value;
107  } else {
108  $link .= '?' . $param . '=' . $value;
109  }
110 
111  return $link;
112  }
$param
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ clear()

ILIAS\Notifications\ilNotificationOSDHandler::clear ( )

Definition at line 114 of file ilNotificationOSDHandler.php.

114  : void
115  {
116  $this->repo->deleteAllOSDNotifications();
117  }

◆ deleteStaleNotificationsForUserAndType()

ILIAS\Notifications\ilNotificationOSDHandler::deleteStaleNotificationsForUserAndType ( int  $user_id,
string  $type 
)
Deprecated:

Definition at line 79 of file ilNotificationOSDHandler.php.

79  : void
80  {
81  $this->repo->deleteStaleOSDNotificationsForUserAndType($type, $user_id, $this->clock->now()->getTimestamp());
82  }

◆ deleteStaleOSDNotificationsForUser()

ILIAS\Notifications\ilNotificationOSDHandler::deleteStaleOSDNotificationsForUser ( string  $provider,
int  $user_id 
)

Definition at line 84 of file ilNotificationOSDHandler.php.

84  : void
85  {
86  $this->repo->deleteStaleOSDNotificationsForUserAndType($provider, $user_id, $this->clock->now()->getTimestamp());
87  }
$provider
Definition: ltitoken.php:80

◆ getOSDNotificationsForUser()

ILIAS\Notifications\ilNotificationOSDHandler::getOSDNotificationsForUser ( int  $user_id,
bool  $append_osd_id_to_link = true,
int  $max_age_seconds = 0,
string  $type = '' 
)
Returns
list<ilOSDNotificationObject>

Definition at line 57 of file ilNotificationOSDHandler.php.

References ILIAS\Notifications\ilNotificationOSDHandler\appendParamToLink().

62  : array {
63  $notifications = $this->repo->getOSDNotificationsByUser($user_id, $max_age_seconds, $type);
64 
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()));
69  }
70  }
71  }
72 
73  return $notifications;
74  }
appendParamToLink(string $link, string $param, int $value)
+ Here is the call graph for this function:

◆ notify()

ILIAS\Notifications\ilNotificationOSDHandler::notify ( ilNotificationObject  $notification)

Definition at line 49 of file ilNotificationOSDHandler.php.

49  : void
50  {
51  $this->repo->createOSDNotification($notification->user->getId(), $notification);
52  }

◆ removeOSDNotification()

ILIAS\Notifications\ilNotificationOSDHandler::removeOSDNotification ( int  $notification_osd_id)

Definition at line 89 of file ilNotificationOSDHandler.php.

89  : bool
90  {
91  return $this->repo->deleteOSDNotificationById($notification_osd_id);
92  }

◆ removeOSDNotificationByIdentification()

ILIAS\Notifications\ilNotificationOSDHandler::removeOSDNotificationByIdentification ( string  $provider,
string  $identification,
int  $user_id = 0 
)

Definition at line 94 of file ilNotificationOSDHandler.php.

References $user_id.

94  : bool
95  {
96  return $this->repo->deleteOSDNotificationByIdentification(
97  $provider,
98  $identification,
99  $user_id
100  );
101  }
$provider
Definition: ltitoken.php:80

Field Documentation

◆ $clock

readonly ClockInterface ILIAS\Notifications\ilNotificationOSDHandler::$clock
private

◆ $repo

readonly ilNotificationOSDRepository ILIAS\Notifications\ilNotificationOSDHandler::$repo
private

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