19declare(strict_types=1);
37 return 'chat_osc_accept_msg';
42 return (
new \
ilSetting(
'chatroom'))->get(
'enable_osc',
'0') ===
'1';
47 return $lng->txt(
'chat_osc_accept_msg');
52 return AvailablePages::PrivacySettings;
57 return AvailableSections::Main;
61 FieldFactory $field_factory,
67 $chat_settings = new \
ilSetting(
'chatroom');
68 $lng->loadLanguageModule(
'chatroom_adm');
70 if ($chat_settings->get(
'enable_browser_notifications',
'0') !==
'1') {
71 return $field_factory->checkbox(
72 $lng->txt(
'chat_osc_accept_msg'),
73 $lng->txt(
'chat_osc_accept_msg_info')
76 ? $user->getPref(
'chat_osc_accept_msg') ===
'y'
77 : $settings->
get(
'chat_osc_accept_msg') ===
'y'
81 return $field_factory->optionalGroup(
83 self::KEY_ENABLE_BROWSER_NOTIFICATIONS => $field_factory->checkbox(
84 $lng->txt(
'osc_enable_browser_notifications_label'),
86 $lng->txt(
'osc_enable_browser_notifications_info'),
87 (
int) $chat_settings->get(
'conversation_idle_state_in_minutes')
90 $settings->
get(
'usr_settings_disable_chat_osc_accept_msg',
'0') ===
'1'
93 $lng->txt(
'chat_osc_accept_msg'),
94 $lng->txt(
'chat_osc_accept_msg_info')
105 $lng->loadLanguageModule(
'chatroom');
107 $input = new \ilCheckboxInputGUI(
$lng->txt(
'chat_osc_accept_msg'));
110 ? $user->getPref(
'chat_osc_accept_msg') ===
'y'
111 : $settings->
get(
'chat_osc_accept_msg') ===
'y'
121 return $lng->txt(
'chat_osc_accepts_messages_no');
128 $user_value = $this->retrieveValueFromUser($user);
129 return $user_value[$this->getIdentifier()] !==
false;
136 if ($input === null) {
138 $user->
deletePref(self::KEY_ENABLE_BROWSER_NOTIFICATIONS);
139 $this->updateChatServer($user->
getId(),
false);
144 if (\is_bool($input)) {
145 $user->
setPref($this->getIdentifier(), $input ?
'y' :
'n');
146 $this->updateChatServer($user->getId(), $input);
151 if (\is_array($input)) {
152 $user->setPref($this->getIdentifier(),
'y');
154 self::KEY_ENABLE_BROWSER_NOTIFICATIONS,
155 $input[self::KEY_ENABLE_BROWSER_NOTIFICATIONS] ?
'y' :
'n'
157 $this->updateChatServer($user->getId(),
true);
165 if ($user->
getPref($this->getIdentifier()) !==
'y') {
167 $this->getIdentifier() =>
false,
168 self::KEY_ENABLE_BROWSER_NOTIFICATIONS => false
173 $this->getIdentifier() =>
true,
174 self::KEY_ENABLE_BROWSER_NOTIFICATIONS => $user->
getPref(self::KEY_ENABLE_BROWSER_NOTIFICATIONS) ===
'y'
182 $active = $settings->
get($this->getIdentifier()) ===
'y';
183 $notification =
false;
184 if ($user !==
null) {
185 $active = $user->
getPref($this->getIdentifier()) ===
'y';
186 $notification = $user->
getPref(self::KEY_ENABLE_BROWSER_NOTIFICATIONS) ===
'y';
189 if ($active ===
false) {
194 self::KEY_ENABLE_BROWSER_NOTIFICATIONS => $notification
202 'acceptsMessages' => $osc_state,
207 $connector = new \ilChatroomServerConnector($settings);
208 $connector->sendUserConfigChange(json_encode(
$message, JSON_THROW_ON_ERROR));
isAvailable()
If this function returns false the setting will not be shown, even if it's PropertyAttributes would a...
persistUserInput(\ilObjUser $user, mixed $input)
hasUserPersonalizedSetting(\ilSetting $settings, \ilObjUser $user)
getDefaultValueForDisplay(Language $lng, \ilSetting $settings)
buildValueForNotificationGroup(\ilSetting $settings, ?\ilObjUser $user)
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,...
retrieveValueFromUser(\ilObjUser $user)
updateChatServer(int $user_id, bool $osc_state)
const string KEY_ENABLE_BROWSER_NOTIFICATIONS
getInput(FieldFactory $field_factory, Language $lng, Refinery $refinery, \ilSetting $settings, ?\ilObjUser $user=null)
static getDefaultConfiguration()
Instantiates and returns ilChatroomAdmin object using instance_id and settings from settingsTable.
setPref(string $a_keyword, ?string $a_value)
getPref(string $a_keyword)
deletePref(string $keyword)
get(string $a_keyword, ?string $a_default_value=null)
get setting
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))