ILIAS  release_7 Revision v7.30-3-g800a261c036
ilSessionReminder Class Reference
+ Collaboration diagram for ilSessionReminder:

Public Member Functions

 calculateSecondsUntilExpiration ()
 
 calculateSecondsUntilReminder ()
 
 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 createInstanceWithCurrentUserSession ()
 

Data Fields

const MIN_LEAD_TIME = 2
 
const SUGGESTED_LEAD_TIME = 5
 

Protected Member Functions

 __construct ()
 ilSessionReminder constructor. More...
 
 initWithUserContext ()
 
 isEnoughTimeLeftForReminder ()
 

Protected Attributes

 $user
 
 $lead_time = 0
 
 $expiration_time = 0
 
 $current_time = 0
 
 $seconds_until_expiration = 0
 
 $seconds_until_reminder = 0
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilSessionReminder::__construct ( )
protected

ilSessionReminder constructor.

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

39 {
40 }

Member Function Documentation

◆ calculateSecondsUntilExpiration()

ilSessionReminder::calculateSecondsUntilExpiration ( )

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

85 : void
86 {
88 }
setSecondsUntilExpiration(int $seconds_until_expiration)

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

Referenced by initWithUserContext().

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

◆ calculateSecondsUntilReminder()

ilSessionReminder::calculateSecondsUntilReminder ( )

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

93 : void
94 {
96 }
setSecondsUntilReminder(int $seconds_until_reminder)

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

Referenced by initWithUserContext().

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

◆ createInstanceWithCurrentUserSession()

static ilSessionReminder::createInstanceWithCurrentUserSession ( )
static
Returns
ilSessionReminder

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

45 : self
46 {
47 global $DIC;
48
49 if (isset($DIC['ilUser'])) {
50 $user = $DIC['ilUser'];
51 } else {
52 $user = new ilObjUser();
53 $user->setId(0);
54 }
55
56 $reminder = new self();
57 $reminder->setUser($user);
58 $reminder->initWithUserContext();
59
60 return $reminder;
61 }
global $DIC
Definition: goto.php:24

References $DIC, and $user.

Referenced by ilGlobalPageTemplate\prepareBasicJS().

+ Here is the caller graph for this function:

◆ getCurrentTime()

ilSessionReminder::getCurrentTime ( )
Returns
int

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

174 : int
175 {
176 return $this->current_time;
177 }

References $current_time.

Referenced by calculateSecondsUntilExpiration().

+ Here is the caller graph for this function:

◆ getExpirationTime()

ilSessionReminder::getExpirationTime ( )
Returns
int

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

193 : int
194 {
196 }

References $expiration_time.

Referenced by calculateSecondsUntilExpiration().

+ Here is the caller graph for this function:

◆ getLeadTime()

ilSessionReminder::getLeadTime ( )
Returns
int

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

212 : int
213 {
214 return $this->lead_time;
215 }

References $lead_time.

Referenced by calculateSecondsUntilReminder(), and isEnoughTimeLeftForReminder().

+ Here is the caller graph for this function:

◆ getSecondsUntilExpiration()

ilSessionReminder::getSecondsUntilExpiration ( )
Returns
int

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

231 : int
232 {
234 }

References $seconds_until_expiration.

Referenced by calculateSecondsUntilReminder(), and isEnoughTimeLeftForReminder().

+ Here is the caller graph for this function:

◆ getSecondsUntilReminder()

ilSessionReminder::getSecondsUntilReminder ( )
Returns
int

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

250 : int
251 {
253 }

References $seconds_until_reminder.

◆ getUser()

ilSessionReminder::getUser ( )
Returns
ilObjUser

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

155 : ilObjUser
156 {
157 return $this->user;
158 }

References $user.

Referenced by initWithUserContext(), and isActive().

+ Here is the caller graph for this function:

◆ initWithUserContext()

ilSessionReminder::initWithUserContext ( )
protected

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

66 : void
67 {
68 $this->setLeadTime(
69 ((int) max(
70 self::MIN_LEAD_TIME,
71 (float) $this->getUser()->getPref('session_reminder_lead_time')
72 )) * 60
73 );
74
75 $this->setExpirationTime(ilSession::getIdleValue(true) + time());
76 $this->setCurrentTime(time());
77
80 }
setCurrentTime(int $current_time)
setExpirationTime(int $expiration_time)
static getIdleValue($fixedMode=false)
Returns the idle time in seconds.

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

+ Here is the call graph for this function:

◆ isActive()

ilSessionReminder::isActive ( )
Returns
bool

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

109 : bool
110 {
111 return (
112 self::isGloballyActivated() &&
113 !$this->getUser()->isAnonymous() &&
114 (int) $this->getUser()->getId() > 0 &&
115 (int) $this->getUser()->getPref('session_reminder_enabled') &&
117 );
118 }

References getUser(), and isEnoughTimeLeftForReminder().

+ Here is the call graph for this function:

◆ isEnoughTimeLeftForReminder()

ilSessionReminder::isEnoughTimeLeftForReminder ( )
protected
Returns
bool

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

101 : bool
102 {
103 return $this->getLeadTime() < $this->getSecondsUntilExpiration();
104 }

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)
Parameters
int$current_time
Returns
$this

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

164 : self
165 {
166 $this->current_time = $current_time;
167
168 return $this;
169 }

References $current_time.

Referenced by initWithUserContext().

+ Here is the caller graph for this function:

◆ setExpirationTime()

ilSessionReminder::setExpirationTime ( int  $expiration_time)
Parameters
int$expiration_time
Returns
$this

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

183 : self
184 {
185 $this->expiration_time = $expiration_time;
186
187 return $this;
188 }

References $expiration_time.

Referenced by initWithUserContext().

+ Here is the caller graph for this function:

◆ setLeadTime()

ilSessionReminder::setLeadTime ( int  $lead_time)
Parameters
int$lead_time
Returns
$this

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

202 : self
203 {
204 $this->lead_time = $lead_time;
205
206 return $this;
207 }

References $lead_time.

Referenced by initWithUserContext().

+ Here is the caller graph for this function:

◆ setSecondsUntilExpiration()

ilSessionReminder::setSecondsUntilExpiration ( int  $seconds_until_expiration)
Parameters
int$seconds_until_expiration
Returns
$this

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

221 : self
222 {
223 $this->seconds_until_expiration = $seconds_until_expiration;
224
225 return $this;
226 }

References $seconds_until_expiration.

Referenced by calculateSecondsUntilExpiration().

+ Here is the caller graph for this function:

◆ setSecondsUntilReminder()

ilSessionReminder::setSecondsUntilReminder ( int  $seconds_until_reminder)
Parameters
int$seconds_until_reminder
Returns
$this

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

240 : self
241 {
242 $this->seconds_until_reminder = $seconds_until_reminder;
243
244 return $this;
245 }

References $seconds_until_reminder.

Referenced by calculateSecondsUntilReminder().

+ Here is the caller graph for this function:

◆ setUser()

ilSessionReminder::setUser ( ilObjUser  $user)
Parameters
ilObjUser$user
Returns
$this

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

145 : self
146 {
147 $this->user = $user;
148
149 return $this;
150 }
user()
Definition: user.php:4

References $user, and user().

+ Here is the call graph for this function:

Field Documentation

◆ $current_time

ilSessionReminder::$current_time = 0
protected

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

Referenced by getCurrentTime(), and setCurrentTime().

◆ $expiration_time

ilSessionReminder::$expiration_time = 0
protected

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

Referenced by getExpirationTime(), and setExpirationTime().

◆ $lead_time

ilSessionReminder::$lead_time = 0
protected

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

Referenced by getLeadTime(), and setLeadTime().

◆ $seconds_until_expiration

ilSessionReminder::$seconds_until_expiration = 0
protected

◆ $seconds_until_reminder

ilSessionReminder::$seconds_until_reminder = 0
protected

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

Referenced by getSecondsUntilReminder(), and setSecondsUntilReminder().

◆ $user

ilSessionReminder::$user
protected

◆ 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: