ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

Referenced by initWithUserContext().

85  : void
86  {
88  }
setSecondsUntilExpiration(int $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 93 of file class.ilSessionReminder.php.

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

Referenced by initWithUserContext().

93  : void
94  {
96  }
setSecondsUntilReminder(int $seconds_until_reminder)
+ 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.

References $DIC, and $user.

Referenced by ilGlobalPageTemplate\prepareBasicJS().

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
+ Here is the caller graph for this function:

◆ getCurrentTime()

ilSessionReminder::getCurrentTime ( )
Returns
int

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

References $current_time.

Referenced by calculateSecondsUntilExpiration().

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

◆ getExpirationTime()

ilSessionReminder::getExpirationTime ( )
Returns
int

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

References $expiration_time.

Referenced by calculateSecondsUntilExpiration().

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

◆ getLeadTime()

ilSessionReminder::getLeadTime ( )
Returns
int

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

References $lead_time.

Referenced by calculateSecondsUntilReminder(), and isEnoughTimeLeftForReminder().

212  : int
213  {
214  return $this->lead_time;
215  }
+ Here is the caller graph for this function:

◆ getSecondsUntilExpiration()

ilSessionReminder::getSecondsUntilExpiration ( )
Returns
int

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

References $seconds_until_expiration.

Referenced by calculateSecondsUntilReminder(), and isEnoughTimeLeftForReminder().

231  : int
232  {
234  }
+ Here is the caller graph for this function:

◆ getSecondsUntilReminder()

ilSessionReminder::getSecondsUntilReminder ( )
Returns
int

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

References $seconds_until_reminder.

250  : int
251  {
253  }

◆ getUser()

ilSessionReminder::getUser ( )
Returns
ilObjUser

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

References $user.

Referenced by initWithUserContext(), and isActive().

155  : ilObjUser
156  {
157  return $this->user;
158  }
+ Here is the caller graph for this function:

◆ initWithUserContext()

ilSessionReminder::initWithUserContext ( )
protected

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

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

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)
static getIdleValue($fixedMode=false)
Returns the idle time in seconds.
setExpirationTime(int $expiration_time)
+ Here is the call graph for this function:

◆ isActive()

ilSessionReminder::isActive ( )
Returns
bool

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

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

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  }
+ Here is the call graph for this function:

◆ isEnoughTimeLeftForReminder()

ilSessionReminder::isEnoughTimeLeftForReminder ( )
protected
Returns
bool

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

References getLeadTime(), and getSecondsUntilExpiration().

Referenced by isActive().

101  : bool
102  {
103  return $this->getLeadTime() < $this->getSecondsUntilExpiration();
104  }
+ 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.

References $current_time.

Referenced by initWithUserContext().

164  : self
165  {
166  $this->current_time = $current_time;
167 
168  return $this;
169  }
+ 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.

References $expiration_time.

Referenced by initWithUserContext().

183  : self
184  {
185  $this->expiration_time = $expiration_time;
186 
187  return $this;
188  }
+ 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.

References $lead_time.

Referenced by initWithUserContext().

202  : self
203  {
204  $this->lead_time = $lead_time;
205 
206  return $this;
207  }
+ 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.

References $seconds_until_expiration.

Referenced by calculateSecondsUntilExpiration().

221  : self
222  {
223  $this->seconds_until_expiration = $seconds_until_expiration;
224 
225  return $this;
226  }
+ 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.

References $seconds_until_reminder.

Referenced by calculateSecondsUntilReminder().

240  : self
241  {
242  $this->seconds_until_reminder = $seconds_until_reminder;
243 
244  return $this;
245  }
+ 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.

References $user, and user().

145  : self
146  {
147  $this->user = $user;
148 
149  return $this;
150  }
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 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: