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

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 BroadcastTyping.php.

Member Function Documentation

◆ getDefaultValueForDisplay()

ILIAS\Chatroom\UserSettings\BroadcastTyping::getDefaultValueForDisplay ( Language  $lng,
\ilSetting  $settings 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 95 of file BroadcastTyping.php.

98 : string {
99 return $settings->get($this->getIdentifier()) === 'y'
100 ? $lng->txt('chat_use_typing_broadcast')
101 : $lng->txt('chat_no_use_typing_broadcast');
102 }
global $lng
Definition: privfeed.php:31

◆ getIdentifier()

ILIAS\Chatroom\UserSettings\BroadcastTyping::getIdentifier ( )

Implements ILIAS\User\Property.

Definition at line 33 of file BroadcastTyping.php.

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

Referenced by ILIAS\Chatroom\UserSettings\BroadcastTyping\getLabel().

+ Here is the caller graph for this function:

◆ getInput()

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

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 58 of file BroadcastTyping.php.

64 : Input {
65 $lng->loadLanguageModule('chatroom_adm');
66
67 return $field_factory->checkbox(
68 $lng->txt('chat_broadcast_typing'),
69 $lng->txt('chat_broadcast_typing_info')
70 )->withValue(
71 $user !== null
72 ? $user->getPref('chat_broadcast_typing') === 'y'
73 : $settings->get('chat_broadcast_typing') === 'y'
74 );
75 }

◆ getLabel()

ILIAS\Chatroom\UserSettings\BroadcastTyping::getLabel ( Language  $lng)

Implements ILIAS\User\Property.

Definition at line 43 of file BroadcastTyping.php.

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

References $lng, and ILIAS\Chatroom\UserSettings\BroadcastTyping\getIdentifier().

+ Here is the call graph for this function:

◆ getLegacyInput()

ILIAS\Chatroom\UserSettings\BroadcastTyping::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 BroadcastTyping.php.

82 $lng->loadLanguageModule('chatroom_adm');
83
84 $input = new \ilCheckboxInputGUI($lng->txt('chat_broadcast_typing'));
85 $input->setInfo($lng->txt('chat_broadcast_typing_info'));
86 $input->setChecked(
87 $user !== null
88 ? $user->getPref('chat_broadcast_typing') === 'y'
89 : $settings->get('chat_broadcast_typing') === 'y'
90 );
91
92 return $input;
93 }
This class represents a property in a property form.

◆ getSection()

ILIAS\Chatroom\UserSettings\BroadcastTyping::getSection ( )

Implements ILIAS\User\Property.

Definition at line 53 of file BroadcastTyping.php.

54 {
55 return AvailableSections::Main;
56 }

◆ getSettingsPage()

ILIAS\Chatroom\UserSettings\BroadcastTyping::getSettingsPage ( )

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 48 of file BroadcastTyping.php.

49 {
50 return AvailablePages::PrivacySettings;
51 }

◆ hasUserPersonalizedSetting()

ILIAS\Chatroom\UserSettings\BroadcastTyping::hasUserPersonalizedSetting ( \ilSetting  $settings,
\ilObjUser  $user 
)

Implements ILIAS\User\Settings\SettingDefinition.

Definition at line 104 of file BroadcastTyping.php.

107 : bool {
108 return $this->retrieveValueFromUser($user) !== $settings->get($this->getIdentifier());
109 }

◆ isAvailable()

ILIAS\Chatroom\UserSettings\BroadcastTyping::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 BroadcastTyping.php.

38 : bool
39 {
40 return (new \ilSetting('chatroom'))->get('chat_enabled', '0') === '1';
41 }
ILIAS Setting Class.

◆ persistUserInput()

ILIAS\Chatroom\UserSettings\BroadcastTyping::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 111 of file BroadcastTyping.php.

114 : \ilObjUser {
115 if ($input === null) {
116 $user->deletePref($this->getIdentifier());
117
118 return $user;
119 }
120
121 $user->setPref($this->getIdentifier(), $input ? 'y' : 'n');
122
123 return $user;
124 }
User class.
deletePref(string $keyword)

References ilObjUser\deletePref().

+ Here is the call graph for this function:

◆ retrieveValueFromUser()

ILIAS\Chatroom\UserSettings\BroadcastTyping::retrieveValueFromUser ( \ilObjUser  $user)

Implements ILIAS\User\Property.

Definition at line 126 of file BroadcastTyping.php.

126 : ?bool
127 {
128 $value = $user->getPref($this->getIdentifier());
129
130 return $value !== null ? $value === 'y' : null;
131 }

References ilObjUser\getPref().

+ Here is the call graph for this function:

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