ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilSessionReminder Class Reference
+ Collaboration diagram for ilSessionReminder:

Public Member Functions

 __construct (ilObjUser $user, ClockInterface $clock, 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

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

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ buildValidLeadTime()

ilSessionReminder::buildValidLeadTime ( int  $lead_time)
private

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

References getMaxPossibleLeadTime().

Referenced by getEffectiveLeadTime(), and getGlobalSessionReminderLeadTime().

77  : int
78  {
79  $min_value = self::MIN_LEAD_TIME;
80  $max_value = $this->getMaxPossibleLeadTime();
81 
82  if (
83  $lead_time !== self::LEAD_TIME_DISABLED &&
84  ($lead_time < $min_value || $lead_time > $max_value)
85  ) {
86  $lead_time = self::SUGGESTED_LEAD_TIME;
87  }
88 
89  return $lead_time !== self::LEAD_TIME_DISABLED ? min(
90  max(
91  $min_value,
93  ),
94  $max_value
95  ) : self::LEAD_TIME_DISABLED;
96  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ byLoggedInUser()

static ilSessionReminder::byLoggedInUser ( )
static

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

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

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

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

◆ calculateSecondsUntilExpiration()

ilSessionReminder::calculateSecondsUntilExpiration ( )
private

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

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

Referenced by init().

128  : void
129  {
130  $this->setSecondsUntilExpiration($this->getExpirationTime() - $this->getCurrentTime());
131  }
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 133 of file class.ilSessionReminder.php.

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

Referenced by init().

133  : void
134  {
136  }
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 171 of file class.ilSessionReminder.php.

References $current_time.

Referenced by calculateSecondsUntilExpiration().

171  : int
172  {
173  return $this->current_time;
174  }
+ Here is the caller graph for this function:

◆ getEffectiveLeadTime()

ilSessionReminder::getEffectiveLeadTime ( )

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

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

Referenced by init(), and isActive().

98  : int
99  {
100  return $this->buildValidLeadTime(
102  $this->getUser()->getId(),
103  'session_reminder_lead_time'
105  );
106  }
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 183 of file class.ilSessionReminder.php.

References $expiration_time.

Referenced by calculateSecondsUntilExpiration().

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

◆ getGlobalSessionReminderLeadTime()

ilSessionReminder::getGlobalSessionReminderLeadTime ( )

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

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

Referenced by getEffectiveLeadTime().

70  : int
71  {
72  return $this->buildValidLeadTime(
73  (int) $this->settings->get('session_reminder_lead_time')
74  );
75  }
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 195 of file class.ilSessionReminder.php.

References $lead_time.

Referenced by calculateSecondsUntilReminder(), and isEnoughTimeLeftForReminder().

195  : int
196  {
197  return $this->lead_time;
198  }
+ Here is the caller graph for this function:

◆ getMaxPossibleLeadTime()

ilSessionReminder::getMaxPossibleLeadTime ( )

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

References ilSession\getSessionExpireValue().

Referenced by buildValidLeadTime().

108  : int
109  {
111 
112  return max(self::MIN_LEAD_TIME, ($expires / 60) - 1);
113  }
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 207 of file class.ilSessionReminder.php.

References $seconds_until_expiration.

Referenced by calculateSecondsUntilReminder(), and isEnoughTimeLeftForReminder().

207  : int
208  {
210  }
+ Here is the caller graph for this function:

◆ getSecondsUntilReminder()

ilSessionReminder::getSecondsUntilReminder ( )

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

References $seconds_until_reminder.

219  : int
220  {
222  }

◆ getUser()

ilSessionReminder::getUser ( )

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

References $user.

Referenced by getEffectiveLeadTime(), and isActive().

159  : ilObjUser
160  {
161  return $this->user;
162  }
+ Here is the caller graph for this function:

◆ init()

ilSessionReminder::init ( )
private

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

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

Referenced by __construct().

115  : void
116  {
117  $this->setLeadTime(
118  $this->getEffectiveLeadTime() * 60
119  );
120 
121  $this->setExpirationTime(ilSession::getIdleValue() + $this->clock->now()->getTimestamp());
122  $this->setCurrentTime($this->clock->now()->getTimestamp());
123 
126  }
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 143 of file class.ilSessionReminder.php.

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

143  : bool
144  {
145  return
146  !$this->getUser()->isAnonymous() &&
147  $this->getUser()->getId() > 0 &&
148  $this->getEffectiveLeadTime() !== self::LEAD_TIME_DISABLED &&
150  }
+ Here is the call graph for this function:

◆ isEnoughTimeLeftForReminder()

ilSessionReminder::isEnoughTimeLeftForReminder ( )
private

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

References getLeadTime(), and getSecondsUntilExpiration().

Referenced by isActive().

138  : bool
139  {
140  return $this->getLeadTime() < $this->getSecondsUntilExpiration();
141  }
+ 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 164 of file class.ilSessionReminder.php.

References $current_time.

Referenced by init().

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)

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

References $expiration_time.

Referenced by init().

176  : self
177  {
178  $this->expiration_time = $expiration_time;
179 
180  return $this;
181  }
+ Here is the caller graph for this function:

◆ setLeadTime()

ilSessionReminder::setLeadTime ( int  $lead_time)

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

References $lead_time.

Referenced by init().

188  : self
189  {
190  $this->lead_time = $lead_time;
191 
192  return $this;
193  }
+ Here is the caller graph for this function:

◆ setSecondsUntilExpiration()

ilSessionReminder::setSecondsUntilExpiration ( int  $seconds_until_expiration)

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

References $seconds_until_expiration.

Referenced by calculateSecondsUntilExpiration().

200  : self
201  {
202  $this->seconds_until_expiration = $seconds_until_expiration;
203 
204  return $this;
205  }
+ Here is the caller graph for this function:

◆ setSecondsUntilReminder()

ilSessionReminder::setSecondsUntilReminder ( int  $seconds_until_reminder)

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

References $seconds_until_reminder.

Referenced by calculateSecondsUntilReminder().

212  : self
213  {
214  $this->seconds_until_reminder = $seconds_until_reminder;
215 
216  return $this;
217  }
+ Here is the caller graph for this function:

◆ setUser()

ilSessionReminder::setUser ( ilObjUser  $user)

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

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

152  : self
153  {
154  $this->user = $user;
155 
156  return $this;
157  }
+ 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 34 of file class.ilSessionReminder.php.

Referenced by getCurrentTime(), and setCurrentTime().

◆ $expiration_time

int ilSessionReminder::$expiration_time = 0
private

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

Referenced by getExpirationTime(), and setExpirationTime().

◆ $lead_time

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

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

Referenced by getSecondsUntilReminder(), and setSecondsUntilReminder().

◆ $settings

ilSetting ilSessionReminder::$settings
private

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

Referenced by __construct().

◆ $user

ilObjUser ilSessionReminder::$user
private

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

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

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