ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Calendar\UserSettings\TimeZone Class Reference
+ Inheritance diagram for ILIAS\Calendar\UserSettings\TimeZone:
+ Collaboration diagram for ILIAS\Calendar\UserSettings\TimeZone:

Public Member Functions

 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)
 

Detailed Description

Definition at line 31 of file TimeZone.php.

Member Function Documentation

◆ getDefaultValueForDisplay()

ILIAS\Calendar\UserSettings\TimeZone::getDefaultValueForDisplay ( Language  $lng,
\ilSetting  $settings 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 94 of file TimeZone.php.

97 : string {
98 return \ilCalendarUtil::_getShortTimeZoneList()[\ilCalendarSettings::_getInstance()->getDefaultTimeZone()];
99 }

◆ getIdentifier()

ILIAS\Calendar\UserSettings\TimeZone::getIdentifier ( )

Implements ILIAS\User\Property.

Definition at line 33 of file TimeZone.php.

33 : string
34 {
35 return 'timezone';
36 }

◆ getInput()

ILIAS\Calendar\UserSettings\TimeZone::getInput ( FieldFactory  $field_factory,
Language  $lng,
Refinery  $refinery,
\ilSetting  $settings,
?\ilObjUser  $user = null 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 58 of file TimeZone.php.

64 : Input {
65 $lng->loadLanguageModule('dateplaner');
66 return $field_factory->select(
67 $lng->txt('cal_user_timezone'),
69 $lng->txt('cal_timezone_info')
70 )->withValue(
71 $user !== null
72 ? $this->retrieveValueFromUser($user)
73 : \ilCalendarSettings::_getInstance()->getDefaultTimeZone()
74 );
75 }
retrieveValueFromUser(\ilObjUser $user)
Definition: TimeZone.php:120
static _getShortTimeZoneList()
get short timezone list
global $lng
Definition: privfeed.php:31

◆ getLabel()

ILIAS\Calendar\UserSettings\TimeZone::getLabel ( Language  $lng)

Implements ILIAS\User\Property.

Definition at line 43 of file TimeZone.php.

43 : string
44 {
45 return $lng->txt('cal_user_timezone');
46 }

References $lng.

◆ getLegacyInput()

ILIAS\Calendar\UserSettings\TimeZone::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 77 of file TimeZone.php.

82 $lng->loadLanguageModule('dateplaner');
83 $input = new \ilSelectInputGUI($lng->txt('cal_user_timezone'));
84 $input->setOptions(\ilCalendarUtil::_getShortTimeZoneList());
85 $input->setInfo($lng->txt('cal_timezone_info'));
86 $input->setValue(
87 $user !== null
88 ? $this->retrieveValueFromUser($user)
89 : \ilCalendarSettings::_getInstance()->getDefaultTimeZone()
90 );
91 return $input;
92 }
This class represents a property in a property form.

◆ getSection()

ILIAS\Calendar\UserSettings\TimeZone::getSection ( )

Implements ILIAS\User\Property.

Definition at line 53 of file TimeZone.php.

54 {
55 return AvailableSections::DateTime;
56 }

◆ getSettingsPage()

ILIAS\Calendar\UserSettings\TimeZone::getSettingsPage ( )

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 48 of file TimeZone.php.

49 {
50 return AvailablePages::MainSettings;
51 }

◆ hasUserPersonalizedSetting()

ILIAS\Calendar\UserSettings\TimeZone::hasUserPersonalizedSetting ( \ilSetting  $settings,
\ilObjUser  $user 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 101 of file TimeZone.php.

104 : bool {
105 return $this->retrieveValueFromUser($user) !== \ilCalendarSettings::_getInstance()->getDefaultTimeZone();
106 }

◆ isAvailable()

ILIAS\Calendar\UserSettings\TimeZone::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 38 of file TimeZone.php.

38 : bool
39 {
40 return true;
41 }

◆ persistUserInput()

ILIAS\Calendar\UserSettings\TimeZone::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 108 of file TimeZone.php.

111 : \ilObjUser {
112 $calendar_settings = \ilCalendarUserSettings::_getInstance($user->getId());
113 $calendar_settings->setTimeZone(
114 $input !== null ? $input : \ilCalendarSettings::_getInstance()->getDefaultTimeZone()
115 );
116 $calendar_settings->save();
117 return $user;
118 }
User class.

◆ retrieveValueFromUser()

ILIAS\Calendar\UserSettings\TimeZone::retrieveValueFromUser ( \ilObjUser  $user)

Implements ILIAS\User\Property.

Definition at line 120 of file TimeZone.php.

120 : string
121 {
122 return $user->getTimeZone();
123 }

References ilObjUser\getTimeZone().

+ Here is the call graph for this function:

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