ILIAS  release_8 Revision v8.24
ilSessionReminder Class Reference
+ Collaboration diagram for ilSessionReminder:

Public Member Functions

 __construct (ilObjUser $user, ClockInterface $clock)
 
 isActive ()
 
 setUser (ilObjUser $user)
 
 getUser ()
 
 setCurrentTime (int $current_time)
 
 getCurrentTime ()
 
 setExpirationTime (int $expiration_time)
 
 getExpirationTime ()
 
 setLeadTime (int $lead_time)
 
 getLeadTime ()
 
 setSecondsUntilExpiration (int $seconds_until_expiration)
 
 getSecondsUntilExpiration ()
 
 setSecondsUntilReminder (int $seconds_until_reminder)
 
 getSecondsUntilReminder ()
 

Static Public Member Functions

static byLoggedInUser ()
 

Data Fields

const MIN_LEAD_TIME = 2
 
const SUGGESTED_LEAD_TIME = 5
 

Private Member Functions

 init ()
 
 calculateSecondsUntilExpiration ()
 
 calculateSecondsUntilReminder ()
 
 isEnoughTimeLeftForReminder ()
 

Private Attributes

ClockInterface $clock
 
ilObjUser $user
 
int $lead_time = self::SUGGESTED_LEAD_TIME
 
int $expiration_time = 0
 
int $current_time = 0
 
int $seconds_until_expiration = 0
 
int $seconds_until_reminder = 0
 

Detailed Description

Definition at line 24 of file class.ilSessionReminder.php.

Constructor & Destructor Documentation

◆ __construct()

ilSessionReminder::__construct ( ilObjUser  $user,
ClockInterface  $clock 
)

Definition at line 75 of file class.ilSessionReminder.php.

76 {
77 $this->user = $user;
78 $this->clock = $clock;
79
80 $this->init();
81 }

References $clock, $user, init(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ byLoggedInUser()

static ilSessionReminder::byLoggedInUser ( )
static

Definition at line 37 of file class.ilSessionReminder.php.

37 : self
38 {
39 global $DIC;
40
41 if (isset($DIC['ilUser'])) {
42 $user = $DIC->user();
43 } else {
44 $user = new ilObjUser();
45 $user->setId(0);
46 }
47
48 $reminder = new self(
49 $user,
50 (new DataFactory())->clock()->utc()
51 );
52
53 return $reminder;
54 }
User class.
setId(int $id)
global $DIC
Definition: feed.php:28

References $DIC, $user, and ilObject\setId().

Referenced by ilGlobalPageTemplate\prepareBasicJS().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateSecondsUntilExpiration()

ilSessionReminder::calculateSecondsUntilExpiration ( )
private

Definition at line 99 of file class.ilSessionReminder.php.

99 : void
100 {
102 }
setSecondsUntilExpiration(int $seconds_until_expiration)

References getCurrentTime(), getExpirationTime(), and setSecondsUntilExpiration().

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateSecondsUntilReminder()

ilSessionReminder::calculateSecondsUntilReminder ( )
private

Definition at line 104 of file class.ilSessionReminder.php.

104 : void
105 {
107 }
setSecondsUntilReminder(int $seconds_until_reminder)

References getLeadTime(), getSecondsUntilExpiration(), and setSecondsUntilReminder().

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentTime()

ilSessionReminder::getCurrentTime ( )

Definition at line 144 of file class.ilSessionReminder.php.

144 : int
145 {
146 return $this->current_time;
147 }

References $current_time.

Referenced by calculateSecondsUntilExpiration().

+ Here is the caller graph for this function:

◆ getExpirationTime()

ilSessionReminder::getExpirationTime ( )

Definition at line 156 of file class.ilSessionReminder.php.

156 : int
157 {
159 }

References $expiration_time.

Referenced by calculateSecondsUntilExpiration().

+ Here is the caller graph for this function:

◆ getLeadTime()

ilSessionReminder::getLeadTime ( )

Definition at line 168 of file class.ilSessionReminder.php.

168 : int
169 {
170 return $this->lead_time;
171 }

References $lead_time.

Referenced by calculateSecondsUntilReminder(), and isEnoughTimeLeftForReminder().

+ Here is the caller graph for this function:

◆ getSecondsUntilExpiration()

ilSessionReminder::getSecondsUntilExpiration ( )

Definition at line 180 of file class.ilSessionReminder.php.

180 : int
181 {
183 }

References $seconds_until_expiration.

Referenced by calculateSecondsUntilReminder(), and isEnoughTimeLeftForReminder().

+ Here is the caller graph for this function:

◆ getSecondsUntilReminder()

ilSessionReminder::getSecondsUntilReminder ( )

Definition at line 192 of file class.ilSessionReminder.php.

192 : int
193 {
195 }

References $seconds_until_reminder.

◆ getUser()

ilSessionReminder::getUser ( )

Definition at line 132 of file class.ilSessionReminder.php.

132 : ilObjUser
133 {
134 return $this->user;
135 }

References $user.

Referenced by init(), and isActive().

+ Here is the caller graph for this function:

◆ init()

ilSessionReminder::init ( )
private

Definition at line 83 of file class.ilSessionReminder.php.

83 : void
84 {
85 $this->setLeadTime(
86 ((int) max(
87 self::MIN_LEAD_TIME,
88 (float) $this->getUser()->getPref('session_reminder_lead_time')
89 )) * 60
90 );
91
92 $this->setExpirationTime(ilSession::getIdleValue(true) + $this->clock->now()->getTimestamp());
93 $this->setCurrentTime($this->clock->now()->getTimestamp());
94
97 }
setCurrentTime(int $current_time)
setExpirationTime(int $expiration_time)
static getIdleValue(bool $fixedMode=false)
Returns the idle time in seconds.

References calculateSecondsUntilExpiration(), calculateSecondsUntilReminder(), ilSession\getIdleValue(), getUser(), setCurrentTime(), setExpirationTime(), and setLeadTime().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isActive()

ilSessionReminder::isActive ( )

Definition at line 114 of file class.ilSessionReminder.php.

114 : bool
115 {
116 return (
117 self::isGloballyActivated() &&
118 !$this->getUser()->isAnonymous() &&
119 $this->getUser()->getId() > 0 &&
120 (int) $this->getUser()->getPref('session_reminder_enabled') &&
122 );
123 }

References ILIAS\Survey\Mode\getId(), getUser(), and isEnoughTimeLeftForReminder().

+ Here is the call graph for this function:

◆ isEnoughTimeLeftForReminder()

ilSessionReminder::isEnoughTimeLeftForReminder ( )
private

Definition at line 109 of file class.ilSessionReminder.php.

109 : bool
110 {
111 return $this->getLeadTime() < $this->getSecondsUntilExpiration();
112 }

References getLeadTime(), and getSecondsUntilExpiration().

Referenced by isActive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCurrentTime()

ilSessionReminder::setCurrentTime ( int  $current_time)

Definition at line 137 of file class.ilSessionReminder.php.

137 : self
138 {
139 $this->current_time = $current_time;
140
141 return $this;
142 }

References $current_time.

Referenced by init().

+ Here is the caller graph for this function:

◆ setExpirationTime()

ilSessionReminder::setExpirationTime ( int  $expiration_time)

Definition at line 149 of file class.ilSessionReminder.php.

149 : self
150 {
151 $this->expiration_time = $expiration_time;
152
153 return $this;
154 }

References $expiration_time.

Referenced by init().

+ Here is the caller graph for this function:

◆ setLeadTime()

ilSessionReminder::setLeadTime ( int  $lead_time)

Definition at line 161 of file class.ilSessionReminder.php.

161 : self
162 {
163 $this->lead_time = $lead_time;
164
165 return $this;
166 }

References $lead_time.

Referenced by init().

+ Here is the caller graph for this function:

◆ setSecondsUntilExpiration()

ilSessionReminder::setSecondsUntilExpiration ( int  $seconds_until_expiration)

Definition at line 173 of file class.ilSessionReminder.php.

173 : self
174 {
175 $this->seconds_until_expiration = $seconds_until_expiration;
176
177 return $this;
178 }

References $seconds_until_expiration.

Referenced by calculateSecondsUntilExpiration().

+ Here is the caller graph for this function:

◆ setSecondsUntilReminder()

ilSessionReminder::setSecondsUntilReminder ( int  $seconds_until_reminder)

Definition at line 185 of file class.ilSessionReminder.php.

185 : self
186 {
187 $this->seconds_until_reminder = $seconds_until_reminder;
188
189 return $this;
190 }

References $seconds_until_reminder.

Referenced by calculateSecondsUntilReminder().

+ Here is the caller graph for this function:

◆ setUser()

ilSessionReminder::setUser ( ilObjUser  $user)

Definition at line 125 of file class.ilSessionReminder.php.

125 : self
126 {
127 $this->user = $user;
128
129 return $this;
130 }

References $user, and ILIAS\Repository\user().

+ Here is the call graph for this function:

Field Documentation

◆ $clock

ClockInterface ilSessionReminder::$clock
private

Definition at line 29 of file class.ilSessionReminder.php.

Referenced by __construct().

◆ $current_time

int ilSessionReminder::$current_time = 0
private

Definition at line 33 of file class.ilSessionReminder.php.

Referenced by getCurrentTime(), and setCurrentTime().

◆ $expiration_time

int ilSessionReminder::$expiration_time = 0
private

Definition at line 32 of file class.ilSessionReminder.php.

Referenced by getExpirationTime(), and setExpirationTime().

◆ $lead_time

int ilSessionReminder::$lead_time = self::SUGGESTED_LEAD_TIME
private

Definition at line 31 of file class.ilSessionReminder.php.

Referenced by getLeadTime(), and setLeadTime().

◆ $seconds_until_expiration

int ilSessionReminder::$seconds_until_expiration = 0
private

◆ $seconds_until_reminder

int ilSessionReminder::$seconds_until_reminder = 0
private

Definition at line 35 of file class.ilSessionReminder.php.

Referenced by getSecondsUntilReminder(), and setSecondsUntilReminder().

◆ $user

ilObjUser ilSessionReminder::$user
private

Definition at line 30 of file class.ilSessionReminder.php.

Referenced by __construct(), byLoggedInUser(), getUser(), and setUser().

◆ MIN_LEAD_TIME

const ilSessionReminder::MIN_LEAD_TIME = 2

◆ SUGGESTED_LEAD_TIME

const ilSessionReminder::SUGGESTED_LEAD_TIME = 5

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