ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSessionReminder Class Reference
+ Collaboration diagram for ilSessionReminder:

Public Member Functions

 calculateSecondsUntilExpiration ()
 
 calculateSecondsUntilReminder ()
 
 isActive ()
 
 setUser ($user)
 
 getUser ()
 
 setCurrentTime ($current_time)
 
 getCurrentTime ()
 
 setExpirationTime ($expiration_time)
 
 getExpirationTime ()
 
 setLeadTime ($lead_time)
 
 getLeadTime ()
 
 setSecondsUntilExpiration ($seconds_until_expiration)
 
 getSecondsUntilExpiration ()
 
 setSecondsUntilReminder ($seconds_until_reminder)
 
 getSecondsUntilReminder ()
 

Data Fields

const MIN_LEAD_TIME = 2
 
const SUGGESTED_LEAD_TIME = 5
 

Protected Member Functions

 __construct ()
 Constructor. More...
 
 initWithUserContext ()
 
 isEnoughtTimeLeftForReminder ()
 

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

Constructor.

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

References $DIC, and $ilUser.

56  {
57  }

Member Function Documentation

◆ calculateSecondsUntilExpiration()

ilSessionReminder::calculateSecondsUntilExpiration ( )

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

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

Referenced by initWithUserContext().

101  {
102  $this->setSecondsUntilExpiration($this->getExpirationTime() - $this->getCurrentTime());
103  }
setSecondsUntilExpiration($seconds_until_expiration)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateSecondsUntilReminder()

ilSessionReminder::calculateSecondsUntilReminder ( )

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

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

Referenced by initWithUserContext().

109  {
111  }
setSecondsUntilReminder($seconds_until_reminder)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentTime()

ilSessionReminder::getCurrentTime ( )
Returns
int

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

References $current_time.

Referenced by calculateSecondsUntilExpiration().

183  {
184  return $this->current_time;
185  }
+ Here is the caller graph for this function:

◆ getExpirationTime()

ilSessionReminder::getExpirationTime ( )
Returns
int

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

References $expiration_time.

Referenced by calculateSecondsUntilExpiration().

201  {
202  return $this->expiration_time;
203  }
+ Here is the caller graph for this function:

◆ getLeadTime()

ilSessionReminder::getLeadTime ( )
Returns
int

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

References $lead_time.

Referenced by calculateSecondsUntilReminder(), and isEnoughtTimeLeftForReminder().

219  {
220  return $this->lead_time;
221  }
+ Here is the caller graph for this function:

◆ getSecondsUntilExpiration()

ilSessionReminder::getSecondsUntilExpiration ( )
Returns
int

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

References $seconds_until_expiration.

Referenced by calculateSecondsUntilReminder(), and isEnoughtTimeLeftForReminder().

+ Here is the caller graph for this function:

◆ getSecondsUntilReminder()

ilSessionReminder::getSecondsUntilReminder ( )
Returns
int

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

References $seconds_until_reminder.

255  {
257  }

◆ getUser()

ilSessionReminder::getUser ( )
Returns
ilObjUser

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

References $user.

Referenced by initWithUserContext(), and isActive().

165  {
166  return $this->user;
167  }
+ Here is the caller graph for this function:

◆ initWithUserContext()

ilSessionReminder::initWithUserContext ( )
protected
Todo:
: php7: done

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

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

83  {
84  $this->setLeadTime(max(self::MIN_LEAD_TIME, (float) $this->getUser()->getPref('session_reminder_lead_time')) * 60);
85 
89  include_once './Services/Authentication/classes/class.ilSession.php';
90  $this->setExpirationTime(ilSession::getIdleValue(true) + time());
91  $this->setCurrentTime(time());
92 
95  }
setExpirationTime($expiration_time)
static getIdleValue($fixedMode=false)
Returns the idle time in seconds.
+ Here is the call graph for this function:

◆ isActive()

ilSessionReminder::isActive ( )
Returns
bool

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

References $DIC, $ilSetting, getUser(), isEnoughtTimeLeftForReminder(), and ilSession\SESSION_HANDLING_FIXED.

125  {
126  return
127  self::isGloballyActivated() &&
128  $this->getUser()->getId() != ANONYMOUS_USER_ID &&
129  (int) $this->getUser()->getPref('session_reminder_enabled') &&
131  }
+ Here is the call graph for this function:

◆ isEnoughtTimeLeftForReminder()

ilSessionReminder::isEnoughtTimeLeftForReminder ( )
protected
Returns
bool

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

References getLeadTime(), and getSecondsUntilExpiration().

Referenced by isActive().

117  {
118  return $this->getLeadTime() < $this->getSecondsUntilExpiration();
119  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCurrentTime()

ilSessionReminder::setCurrentTime (   $current_time)
Parameters
int$current_time
Returns
ilSessionReminder

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

References $current_time.

Referenced by initWithUserContext().

174  {
175  $this->current_time = $current_time;
176  return $this;
177  }
+ Here is the caller graph for this function:

◆ setExpirationTime()

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

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

References $expiration_time.

Referenced by initWithUserContext().

192  {
193  $this->expiration_time = $expiration_time;
194  return $this;
195  }
+ Here is the caller graph for this function:

◆ setLeadTime()

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

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

References $lead_time.

Referenced by initWithUserContext().

210  {
211  $this->lead_time = $lead_time;
212  return $this;
213  }
+ Here is the caller graph for this function:

◆ setSecondsUntilExpiration()

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

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

References $seconds_until_expiration.

Referenced by calculateSecondsUntilExpiration().

228  {
229  $this->seconds_until_expiration = $seconds_until_expiration;
230  return $this;
231  }
+ Here is the caller graph for this function:

◆ setSecondsUntilReminder()

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

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

References $seconds_until_reminder.

Referenced by calculateSecondsUntilReminder().

246  {
247  $this->seconds_until_reminder = $seconds_until_reminder;
248  return $this;
249  }
+ Here is the caller graph for this function:

◆ setUser()

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

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

References $user, and user().

156  {
157  $this->user = $user;
158  return $this;
159  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

Field Documentation

◆ $current_time

ilSessionReminder::$current_time = 0
protected

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

Referenced by getCurrentTime(), and setCurrentTime().

◆ $expiration_time

ilSessionReminder::$expiration_time = 0
protected

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

Referenced by getExpirationTime(), and setExpirationTime().

◆ $lead_time

ilSessionReminder::$lead_time = 0
protected

Definition at line 30 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 50 of file class.ilSessionReminder.php.

Referenced by getSecondsUntilReminder(), and setSecondsUntilReminder().

◆ $user

ilSessionReminder::$user
protected

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

Referenced by 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: