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

Public Member Functions

 __construct (private ilObjUser $user, private ClockInterface $clock, private ilSetting $settings)
 
 getGlobalSessionReminderLeadTime ()
 
 getEffectiveLeadTime ()
 
 getMaxPossibleLeadTime ()
 
 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 LEAD_TIME_DISABLED = 0
 
const MIN_LEAD_TIME = 1
 
const SUGGESTED_LEAD_TIME = 5
 

Private Member Functions

 buildValidLeadTime (int $lead_time)
 
 init ()
 
 calculateSecondsUntilExpiration ()
 
 calculateSecondsUntilReminder ()
 
 isEnoughTimeLeftForReminder ()
 

Private Attributes

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 ( private ilObjUser  $user,
private ClockInterface  $clock,
private ilSetting  $settings 
)

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

References init().

40  {
41  $this->init();
42  }
+ Here is the call graph for this function:

Member Function Documentation

◆ buildValidLeadTime()

ilSessionReminder::buildValidLeadTime ( int  $lead_time)
private

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

References getMaxPossibleLeadTime().

Referenced by getEffectiveLeadTime(), and getGlobalSessionReminderLeadTime().

71  : int
72  {
73  $min_value = self::MIN_LEAD_TIME;
74  $max_value = $this->getMaxPossibleLeadTime();
75 
76  if ($lead_time !== self::LEAD_TIME_DISABLED &&
77  ($lead_time < $min_value || $lead_time > $max_value)) {
78  $lead_time = self::SUGGESTED_LEAD_TIME;
79  }
80 
81  return $lead_time !== self::LEAD_TIME_DISABLED ? min(
82  max(
83  $min_value,
85  ),
86  $max_value
87  ) : self::LEAD_TIME_DISABLED;
88  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ byLoggedInUser()

static ilSessionReminder::byLoggedInUser ( )
static

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

References $DIC.

Referenced by ilUserFieldSettingsTableGUI\fillRow(), ilObjUserGUI\getValues(), ilObjUserGUI\initForm(), ilPersonalSettingsGUI\initGeneralSettingsForm(), and ilGlobalPageTemplate\prepareBasicJS().

44  : self
45  {
46  global $DIC;
47 
48  if (isset($DIC['ilUser'])) {
49  $user = $DIC->user();
50  } else {
51  $user = new ilObjUser();
52  $user->setId(0);
53  }
54 
55  $reminder = new self(
56  $user,
57  (new DataFactory())->clock()->utc(),
58  $DIC->settings()
59  );
60 
61  return $reminder;
62  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ calculateSecondsUntilExpiration()

ilSessionReminder::calculateSecondsUntilExpiration ( )
private

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

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

Referenced by init().

120  : void
121  {
122  $this->setSecondsUntilExpiration($this->getExpirationTime() - $this->getCurrentTime());
123  }
setSecondsUntilExpiration(int $seconds_until_expiration)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateSecondsUntilReminder()

ilSessionReminder::calculateSecondsUntilReminder ( )
private

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

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

Referenced by init().

125  : void
126  {
128  }
setSecondsUntilReminder(int $seconds_until_reminder)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentTime()

ilSessionReminder::getCurrentTime ( )

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

References $current_time.

Referenced by calculateSecondsUntilExpiration().

163  : int
164  {
165  return $this->current_time;
166  }
+ Here is the caller graph for this function:

◆ getEffectiveLeadTime()

ilSessionReminder::getEffectiveLeadTime ( )

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

References ilObjUser\_lookupPref(), buildValidLeadTime(), getGlobalSessionReminderLeadTime(), ILIAS\Survey\Mode\getId(), and getUser().

Referenced by init(), and isActive().

90  : int
91  {
92  return $this->buildValidLeadTime(
94  $this->getUser()->getId(),
95  'session_reminder_lead_time'
97  );
98  }
static _lookupPref(int $a_usr_id, string $a_keyword)
buildValidLeadTime(int $lead_time)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExpirationTime()

ilSessionReminder::getExpirationTime ( )

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

References $expiration_time.

Referenced by calculateSecondsUntilExpiration().

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

◆ getGlobalSessionReminderLeadTime()

ilSessionReminder::getGlobalSessionReminderLeadTime ( )

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

References buildValidLeadTime(), and ILIAS\Repository\settings().

Referenced by getEffectiveLeadTime().

64  : int
65  {
66  return $this->buildValidLeadTime(
67  (int) $this->settings->get('session_reminder_lead_time')
68  );
69  }
buildValidLeadTime(int $lead_time)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLeadTime()

ilSessionReminder::getLeadTime ( )

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

References $lead_time.

Referenced by calculateSecondsUntilReminder(), and isEnoughTimeLeftForReminder().

187  : int
188  {
189  return $this->lead_time;
190  }
+ Here is the caller graph for this function:

◆ getMaxPossibleLeadTime()

ilSessionReminder::getMaxPossibleLeadTime ( )

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

References ilSession\getSessionExpireValue().

Referenced by buildValidLeadTime().

100  : int
101  {
103 
104  return max(self::MIN_LEAD_TIME, ($expires / 60) - 1);
105  }
static getSessionExpireValue()
Returns the session expiration value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSecondsUntilExpiration()

ilSessionReminder::getSecondsUntilExpiration ( )

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

References $seconds_until_expiration.

Referenced by calculateSecondsUntilReminder(), and isEnoughTimeLeftForReminder().

199  : int
200  {
202  }
+ Here is the caller graph for this function:

◆ getSecondsUntilReminder()

ilSessionReminder::getSecondsUntilReminder ( )

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

References $seconds_until_reminder.

211  : int
212  {
214  }

◆ getUser()

ilSessionReminder::getUser ( )

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

Referenced by getEffectiveLeadTime(), and isActive().

151  : ilObjUser
152  {
153  return $this->user;
154  }
+ Here is the caller graph for this function:

◆ init()

ilSessionReminder::init ( )
private

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

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

Referenced by __construct().

107  : void
108  {
109  $this->setLeadTime(
110  $this->getEffectiveLeadTime() * 60
111  );
112 
113  $this->setExpirationTime(ilSession::getIdleValue() + $this->clock->now()->getTimestamp());
114  $this->setCurrentTime($this->clock->now()->getTimestamp());
115 
118  }
setCurrentTime(int $current_time)
static getIdleValue()
Returns the idle time in seconds.
setExpirationTime(int $expiration_time)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isActive()

ilSessionReminder::isActive ( )

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

References getEffectiveLeadTime(), getUser(), and isEnoughTimeLeftForReminder().

135  : bool
136  {
137  return
138  !$this->getUser()->isAnonymous() &&
139  $this->getUser()->getId() > 0 &&
140  $this->getEffectiveLeadTime() !== self::LEAD_TIME_DISABLED &&
142  }
+ Here is the call graph for this function:

◆ isEnoughTimeLeftForReminder()

ilSessionReminder::isEnoughTimeLeftForReminder ( )
private

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

References getLeadTime(), and getSecondsUntilExpiration().

Referenced by isActive().

130  : bool
131  {
132  return $this->getLeadTime() < $this->getSecondsUntilExpiration();
133  }
+ 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 156 of file class.ilSessionReminder.php.

References $current_time.

Referenced by init().

156  : self
157  {
158  $this->current_time = $current_time;
159 
160  return $this;
161  }
+ Here is the caller graph for this function:

◆ setExpirationTime()

ilSessionReminder::setExpirationTime ( int  $expiration_time)

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

References $expiration_time.

Referenced by init().

168  : self
169  {
170  $this->expiration_time = $expiration_time;
171 
172  return $this;
173  }
+ Here is the caller graph for this function:

◆ setLeadTime()

ilSessionReminder::setLeadTime ( int  $lead_time)

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

References $lead_time.

Referenced by init().

180  : self
181  {
182  $this->lead_time = $lead_time;
183 
184  return $this;
185  }
+ Here is the caller graph for this function:

◆ setSecondsUntilExpiration()

ilSessionReminder::setSecondsUntilExpiration ( int  $seconds_until_expiration)

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

References $seconds_until_expiration.

Referenced by calculateSecondsUntilExpiration().

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

◆ setSecondsUntilReminder()

ilSessionReminder::setSecondsUntilReminder ( int  $seconds_until_reminder)

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

References $seconds_until_reminder.

Referenced by calculateSecondsUntilReminder().

204  : self
205  {
206  $this->seconds_until_reminder = $seconds_until_reminder;
207 
208  return $this;
209  }
+ Here is the caller graph for this function:

◆ setUser()

ilSessionReminder::setUser ( ilObjUser  $user)

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

References ILIAS\Repository\user().

144  : self
145  {
146  $this->user = $user;
147 
148  return $this;
149  }
+ Here is the call graph for this function:

Field Documentation

◆ $current_time

int ilSessionReminder::$current_time = 0
private

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

Referenced by getCurrentTime(), and setCurrentTime().

◆ $expiration_time

int ilSessionReminder::$expiration_time = 0
private

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

Referenced by getExpirationTime(), and setExpirationTime().

◆ $lead_time

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

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

Referenced by getSecondsUntilReminder(), and setSecondsUntilReminder().

◆ LEAD_TIME_DISABLED

◆ MIN_LEAD_TIME

const ilSessionReminder::MIN_LEAD_TIME = 1

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

◆ SUGGESTED_LEAD_TIME

const ilSessionReminder::SUGGESTED_LEAD_TIME = 5

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