ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\User\Settings\User\SessionReminder Class Reference
+ Inheritance diagram for ILIAS\User\Settings\User\SessionReminder:
+ Collaboration diagram for ILIAS\User\Settings\User\SessionReminder:

Public Member Functions

 __construct ()
 
 getIdentifier ()
 
 isAvailable ()
 If this function returns false the setting will not be shown, even if it's PropertyAttributes would allow it to be. More...
 
 getLabel (Language $lng)
 
 getSettingsPage ()
 
 getSection ()
 
 getInput (FieldFactory $field_factory, Language $lng, Refinery $refinery, \ilSetting $settings, ?\ilObjUser $user=null)
 
 getLegacyInput (Language $lng, \ilSetting $settings, ?\ilObjUser $user=null)
 You don't need to add a post_var to the input as the User will handle this for you, thus you can also not rely on the post_var anywhere else, as it will be changed. More...
 
 getDefaultValueForDisplay (Language $lng, \ilSetting $settings)
 
 hasUserPersonalizedSetting (\ilSetting $settings, \ilObjUser $user)
 
 persistUserInput (\ilObjUser $user, mixed $input)
 
 retrieveValueFromUser (\ilObjUser $user)
 
 isAvailable ()
 If this function returns false the setting will not be shown, even if it's PropertyAttributes would allow it to be. More...
 
 getSettingsPage ()
 
 getDefaultValueForDisplay (Language $lng, \ilSetting $settings)
 
 hasUserPersonalizedSetting (\ilSetting $settings, \ilObjUser $user)
 
 getInput (FieldFactory $field_factory, Language $lng, Refinery $refinery, \ilSetting $settings, ?\ilObjUser $user=null)
 
 getLegacyInput (Language $lng, \ilSetting $settings, ?\ilObjUser $user=null)
 You don't need to add a post_var to the input as the User will handle this for you, thus you can also not rely on the post_var anywhere else, as it will be changed. More...
 
 persistUserInput (\ilObjUser $user, mixed $input)
 
 getIdentifier ()
 
 getLabel (Language $lng)
 
 getSection ()
 
 retrieveValueFromUser (\ilObjUser $user)
 

Private Attributes

readonly ilSessionReminder $session_reminder
 

Detailed Description

Definition at line 31 of file SessionReminder.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\User\Settings\User\SessionReminder::__construct ( )

Definition at line 35 of file SessionReminder.php.

36 {
37 $this->session_reminder = \ilSessionReminder::byLoggedInUser();
38 }

References ilSessionReminder\byLoggedInUser().

+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultValueForDisplay()

ILIAS\User\Settings\User\SessionReminder::getDefaultValueForDisplay ( Language  $lng,
\ilSetting  $settings 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 120 of file SessionReminder.php.

123 : string {
124 return $this->session_reminder->getGlobalSessionReminderLeadTime() . ' ' . $lng->txt('minutes');
125 }
global $lng
Definition: privfeed.php:31

◆ getIdentifier()

ILIAS\User\Settings\User\SessionReminder::getIdentifier ( )

Implements ILIAS\User\Property.

Definition at line 40 of file SessionReminder.php.

40 : string
41 {
42 return 'session_reminder';
43 }

Referenced by ILIAS\User\Settings\User\SessionReminder\getLabel().

+ Here is the caller graph for this function:

◆ getInput()

ILIAS\User\Settings\User\SessionReminder::getInput ( FieldFactory  $field_factory,
Language  $lng,
Refinery  $refinery,
\ilSetting  $settings,
?\ilObjUser  $user = null 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 65 of file SessionReminder.php.

71 : Input {
72 return $field_factory->numeric(
73 $lng->txt('session_reminder_input'),
74 sprintf(
75 $lng->txt('session_reminder_lead_time_info'),
79 )
80 )->withAdditionalTransformation(
81 $refinery->int()->isGreaterThanOrEqual(
83 )
84 )->withAdditionalTransformation(
85 $refinery->int()->isLessThanOrEqual(
86 $this->session_reminder->getMaxPossibleLeadTime()
87 )
88 )->withValue(
89 $user !== null
90 ? $this->retrieveValueFromUser($user)
91 : $this->session_reminder->getGlobalSessionReminderLeadTime()
92 );
93 }
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static getSessionExpireValue()
Returns the session expiration value.

◆ getLabel()

ILIAS\User\Settings\User\SessionReminder::getLabel ( Language  $lng)

Implements ILIAS\User\Property.

Definition at line 50 of file SessionReminder.php.

50 : string
51 {
52 return $lng->txt($this->getIdentifier());
53 }

References $lng, and ILIAS\User\Settings\User\SessionReminder\getIdentifier().

+ Here is the call graph for this function:

◆ getLegacyInput()

ILIAS\User\Settings\User\SessionReminder::getLegacyInput ( Language  $lng,
\ilSetting  $settings,
?\ilObjUser  $user = null 
)

You don't need to add a post_var to the input as the User will handle this for you, thus you can also not rely on the post_var anywhere else, as it will be changed.

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 95 of file SessionReminder.php.

100 $input = new \ilNumberInputGUI($lng->txt('session_reminder_input'));
101 $input->setInfo(
102 sprintf(
103 $lng->txt('session_reminder_lead_time_info'),
107 )
108 );
109 $input->setSize(3);
110 $input->setMinValue(\ilSessionReminder::LEAD_TIME_DISABLED);
111 $input->setMaxValue($this->session_reminder->getMaxPossibleLeadTime());
112 $input->setValue(
113 $user !== null
114 ? (string) $this->retrieveValueFromUser($user)
115 : (string) $this->session_reminder->getGlobalSessionReminderLeadTime()
116 );
117 return $input;
118 }
This class represents a property in a property form.

◆ getSection()

ILIAS\User\Settings\User\SessionReminder::getSection ( )

◆ getSettingsPage()

ILIAS\User\Settings\User\SessionReminder::getSettingsPage ( )

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 55 of file SessionReminder.php.

56 {
57 return AvailablePages::MainSettings;
58 }

◆ hasUserPersonalizedSetting()

ILIAS\User\Settings\User\SessionReminder::hasUserPersonalizedSetting ( \ilSetting  $settings,
\ilObjUser  $user 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 127 of file SessionReminder.php.

130 : bool {
131 return $this->retrieveValueFromUser($user) !== $this->session_reminder->getGlobalSessionReminderLeadTime();
132 }

◆ isAvailable()

ILIAS\User\Settings\User\SessionReminder::isAvailable ( )

If this function returns false the setting will not be shown, even if it's PropertyAttributes would allow it to be.

This is meant e.g. to check if the chat server is configured or the badges enabled. Settings that are not available will also not be available on the table to define their PropertyAttributes

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 45 of file SessionReminder.php.

45 : bool
46 {
47 return true;
48 }

◆ persistUserInput()

ILIAS\User\Settings\User\SessionReminder::persistUserInput ( \ilObjUser  $user,
mixed  $input 
)
Parameters
mixed$inputNull will be handed in, if the user wants to use the system default. If you are able to set the preference on the user without saving it, you can rely on the User-object being saved after the call to this function. If your input has different structures depending on its provenience (KS-Input, Legacy-Input, ...), the function needs to be able to handle them all.

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 134 of file SessionReminder.php.

137 : \ilObjUser {
138 $user->setPref(
139 'session_reminder_lead_time',
140 $input !== null ? (string) $input : (string) $this->session_reminder->getGlobalSessionReminderLeadTime()
141 );
142 return $user;
143 }
User class.
setPref(string $a_keyword, ?string $a_value)

◆ retrieveValueFromUser()

ILIAS\User\Settings\User\SessionReminder::retrieveValueFromUser ( \ilObjUser  $user)

Implements ILIAS\User\Property.

Definition at line 145 of file SessionReminder.php.

145 : int
146 {
147 return $this->session_reminder->getEffectiveLeadTime();
148 }

Field Documentation

◆ $session_reminder

readonly ilSessionReminder ILIAS\User\Settings\User\SessionReminder::$session_reminder
private

Definition at line 33 of file SessionReminder.php.


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