ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilUserPrivacySettingsGUI Class Reference

User privacy settings (currently located under "Profile and Privacy") More...

+ Collaboration diagram for ilUserPrivacySettingsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 workWithUserSetting (string $setting)
 
 userSettingVisible (string $setting)
 
 showPrivacySettings (\ILIAS\UI\Component\Input\Container\Form\Standard $form=null)
 
 initPrivacySettingsForm ()
 Init form. More...
 
 shouldDisplayChatSection ()
 
 shouldDisplayNotificationSection ()
 
 savePrivacySettings ()
 

Protected Member Functions

 isAwarnessSettingVisible ()
 Is awareness tool setting visible. More...
 
 isContactSettingVisible ()
 Is contact setting visible. More...
 
 populateWithAwarenessSettingsSection (array &$formSections)
 
 populateWithContactsSettingsSection (array &$formSections)
 
 populateWithNotificationSettingsSection (array &$formSections)
 
 populateWithChatSettingsSection (array &$formSections)
 
 appendChatJsToTemplate (ilGlobalTemplateInterface $pageTemplate)
 

Protected Attributes

ilLanguage $lng
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $main_tpl
 
ilUserSettingsConfig $user_settings_config
 
ilObjUser $user
 
ilSetting $settings
 
Psr Http Message RequestInterface $request
 
ilProfileChecklistStatus $checklist_status
 
ilPersonalProfileMode $profile_mode
 
ilSetting $chatSettings
 
ilSetting $notificationSettings
 
ilAppEventHandler $event
 

Private Member Functions

 shouldShowOnScreenChatOptions ()
 
 shouldShowChatTypingBroadcastOption ()
 
 shouldShowNotificationOptions ()
 

Private Attributes

const PROP_ENABLE_OSC = 'chat_osc_accept_msg'
 
const PROP_ENABLE_BROWSER_NOTIFICATIONS = 'chat_osc_browser_notifications'
 
const PROP_ENABLE_SOUND = 'osd_play_sound'
 
const PROP_ENABLE_BROADCAST_TYPING = 'chat_broadcast_typing'
 
ILIAS UI Factory $uiFactory
 
ILIAS UI Renderer $uiRenderer
 
ILIAS Refinery Factory $refinery
 

Detailed Description

User privacy settings (currently located under "Profile and Privacy")

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 25 of file class.ilUserPrivacySettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserPrivacySettingsGUI::__construct ( )

Definition at line 48 of file class.ilUserPrivacySettingsGUI.php.

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\settings(), and ILIAS\Repository\user().

49  {
50  global $DIC;
51 
52  $this->main_tpl = $DIC->ui()->mainTemplate();
53  $this->lng = $DIC->language();
54  $this->ctrl = $DIC->ctrl();
55  $this->lng->loadLanguageModule("user");
56  $this->user = $DIC->user();
57  $this->refinery = $DIC->refinery();
58  $this->uiFactory = $DIC->ui()->factory();
59  $this->uiRenderer = $DIC->ui()->renderer();
60  $this->chatSettings = new ilSetting('chatroom');
61  $this->notificationSettings = new ilSetting('notifications');
62  $this->event = $DIC->event();
63 
64  $this->request = $DIC->http()->request();
65 
66  $this->user_settings_config = new ilUserSettingsConfig();
67  $this->settings = $DIC->settings();
68  $this->checklist_status = new ilProfileChecklistStatus();
69  $this->profile_mode = new ilPersonalProfileMode($this->user, $this->settings);
70  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Member Function Documentation

◆ appendChatJsToTemplate()

ilUserPrivacySettingsGUI::appendChatJsToTemplate ( ilGlobalTemplateInterface  $pageTemplate)
protected

Definition at line 495 of file class.ilUserPrivacySettingsGUI.php.

References $tpl, ilGlobalTemplateInterface\addJavaScript(), ilUtil\getImagePath(), ILIAS\Repository\lng(), and shouldShowOnScreenChatOptions().

Referenced by showPrivacySettings().

497  : ilTemplate {
498  $tpl = new ilTemplate('tpl.personal_chat_settings_form.html', true, true, 'Modules/Chatroom');
499  if ($this->shouldShowOnScreenChatOptions() && $this->chatSettings->get('enable_browser_notifications', '0')) {
500  $pageTemplate->addJavaScript('./Services/Notifications/js/browser_notifications.js');
501 
502  $tpl->setVariable('ALERT_IMAGE_SRC', ilUtil::getImagePath('icon_alert.svg'));
503  $tpl->setVariable('BROWSER_NOTIFICATION_TOGGLE_LABEL', $this->lng->txt('osc_enable_browser_notifications_label'));
504 
505  $this->lng->toJSMap([
506  'osc_browser_noti_no_permission_error' => $this->lng->txt('osc_browser_noti_no_permission_error'),
507  'osc_browser_noti_no_support_error' => $this->lng->txt('osc_browser_noti_no_support_error'),
508  'osc_browser_noti_req_permission_error' => $this->lng->txt('osc_browser_noti_req_permission_error'),
509  ], $pageTemplate);
510  }
511 
512  return $tpl;
513  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilUserPrivacySettingsGUI::executeCommand ( )

Definition at line 72 of file class.ilUserPrivacySettingsGUI.php.

References ILIAS\Repository\ctrl().

72  : void
73  {
74  $next_class = $this->ctrl->getNextClass();
75 
76  switch ($next_class) {
77  default:
78  $cmd = $this->ctrl->getCmd("showPrivacySettings");
79  $this->$cmd();
80  break;
81  }
82  $this->main_tpl->printToStdout();
83  }
+ Here is the call graph for this function:

◆ initPrivacySettingsForm()

ilUserPrivacySettingsGUI::initPrivacySettingsForm ( )

Init form.

Definition at line 160 of file class.ilUserPrivacySettingsGUI.php.

References ILIAS\Repository\ctrl(), populateWithAwarenessSettingsSection(), populateWithChatSettingsSection(), populateWithContactsSettingsSection(), populateWithNotificationSettingsSection(), and ILIAS\Repository\refinery().

Referenced by savePrivacySettings(), and showPrivacySettings().

161  {
162  $sections = [];
163 
164  $this->populateWithAwarenessSettingsSection($sections);
165  $this->populateWithContactsSettingsSection($sections);
166  $this->populateWithChatSettingsSection($sections);
167  $this->populateWithNotificationSettingsSection($sections);
168 
169  $form_action = $this->ctrl->getLinkTarget($this, "savePrivacySettings");
170 
171  return $this->uiFactory->input()
172  ->container()
173  ->form()
174  ->standard($form_action, $sections)
175  ->withAdditionalTransformation($this->refinery->custom()->transformation(static function (array $values): array {
176  return array_merge(...array_values($values));
177  }));
178  }
populateWithContactsSettingsSection(array &$formSections)
populateWithNotificationSettingsSection(array &$formSections)
populateWithAwarenessSettingsSection(array &$formSections)
This describes a standard form.
Definition: Standard.php:26
populateWithChatSettingsSection(array &$formSections)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAwarnessSettingVisible()

ilUserPrivacySettingsGUI::isAwarnessSettingVisible ( )
protected

Is awareness tool setting visible.

Definition at line 142 of file class.ilUserPrivacySettingsGUI.php.

References userSettingVisible().

Referenced by populateWithAwarenessSettingsSection(), savePrivacySettings(), and showPrivacySettings().

142  : bool
143  {
144  $awrn_set = new ilSetting("awrn");
145 
146  return $awrn_set->get("awrn_enabled", '0') && $this->userSettingVisible("hide_own_online_status");
147  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isContactSettingVisible()

ilUserPrivacySettingsGUI::isContactSettingVisible ( )
protected

Is contact setting visible.

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

References ilBuddySystem\getInstance(), and userSettingVisible().

Referenced by populateWithContactsSettingsSection(), savePrivacySettings(), and showPrivacySettings().

152  : bool
153  {
154  return ilBuddySystem::getInstance()->isEnabled() && $this->userSettingVisible('bs_allow_to_contact_me');
155  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateWithAwarenessSettingsSection()

ilUserPrivacySettingsGUI::populateWithAwarenessSettingsSection ( array &  $formSections)
protected

Definition at line 210 of file class.ilUserPrivacySettingsGUI.php.

References isAwarnessSettingVisible(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), ILIAS\Repository\user(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by initPrivacySettingsForm().

212  : void {
213  if (!$this->isAwarnessSettingVisible()) {
214  return;
215  }
216 
217  $this->lng->loadLanguageModule("awrn");
218 
219  $default = ($this->settings->get('hide_own_online_status') === "n")
220  ? $this->lng->txt("user_awrn_show")
221  : $this->lng->txt("user_awrn_hide");
222 
223  $options = [
224  "x" => $this->lng->txt("user_awrn_default") . " (" . $default . ")",
225  "n" => $this->lng->txt("user_awrn_show"),
226  "y" => $this->lng->txt("user_awrn_hide")
227  ];
228  $val = $this->user->prefs["hide_own_online_status"] ?? "";
229  if ($val == "") {
230  $val = "x";
231  }
232 
233  $fields["hide_own_online_status"] = $this->uiFactory->input()
234  ->field()
235  ->select(
236  $this->lng->txt("awrn_user_show"),
237  $options,
238  $this->lng->txt("awrn_hide_from_awareness_info")
239  )
240  ->withValue($val)
241  ->withRequired(true)
242  ->withDisabled(
243  $this->settings->get('usr_settings_disable_hide_own_online_status', '0') === '1' ? true : false
244  );
245 
246  $formSections['awrn_sec'] = $this->uiFactory->input()->field()->section($fields, $this->lng->txt('obj_awra'));
247  }
isAwarnessSettingVisible()
Is awareness tool setting visible.
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateWithChatSettingsSection()

ilUserPrivacySettingsGUI::populateWithChatSettingsSection ( array &  $formSections)
protected

Definition at line 299 of file class.ilUserPrivacySettingsGUI.php.

References ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\settings(), shouldDisplayChatSection(), shouldShowChatTypingBroadcastOption(), shouldShowOnScreenChatOptions(), ILIAS\Repository\user(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ilUtil\yn2tf().

Referenced by initPrivacySettingsForm().

301  : void {
302  if (!$this->shouldDisplayChatSection()) {
303  return;
304  }
305 
306  $fieldFactory = $this->uiFactory->input()->field();
307  $fields = [];
308 
309  $this->lng->loadLanguageModule('chatroom_adm');
310  $checkboxStateToBooleanTrafo = $this->refinery->custom()->transformation(static function ($v) {
311  if (is_array($v)) {
312  return $v;
313  }
314 
315  if (is_bool($v)) {
316  return $v;
317  }
318 
319  return $v === 'checked';
320  });
321 
322  if ($this->shouldShowOnScreenChatOptions()) {
323  $oscAvailable = $this->settings->get('usr_settings_disable_chat_osc_accept_msg', '0') === '1' ? true : false;
324  $oscSubFormGroup = [];
325 
326  if ($this->chatSettings->get('enable_browser_notifications', '0')) {
327  $enabledBrowserNotifications = $fieldFactory
328  ->checkbox(
329  $this->lng->txt('osc_enable_browser_notifications_label'),
330  sprintf(
331  $this->lng->txt('osc_enable_browser_notifications_info'),
332  (int) $this->chatSettings->get('conversation_idle_state_in_minutes')
333  )
334  )
335  ->withAdditionalTransformation($checkboxStateToBooleanTrafo)
336  ->withDisabled($oscAvailable);
337 
338  $oscSubFormGroup[self::PROP_ENABLE_BROWSER_NOTIFICATIONS] = $enabledBrowserNotifications;
339 
340  $groupValue = null;
341  if (ilUtil::yn2tf((string) $this->user->getPref('chat_osc_accept_msg'))) {
342  $groupValue = [
343  self::PROP_ENABLE_BROWSER_NOTIFICATIONS => ilUtil::yn2tf((string) $this->user->getPref('chat_osc_browser_notifications')),
344  ];
345  }
346  $enabledOsc = $fieldFactory
347  ->optionalGroup(
348  $oscSubFormGroup,
349  $this->lng->txt('chat_osc_accept_msg'),
350  $this->lng->txt('chat_osc_accept_msg_info')
351  )
352  ->withAdditionalTransformation($checkboxStateToBooleanTrafo)
353  ->withDisabled($oscAvailable)
354  ->withValue($groupValue);
355  } else {
356  $enabledOsc = $fieldFactory
357  ->checkbox(
358  $this->lng->txt('chat_osc_accept_msg'),
359  $this->lng->txt('chat_osc_accept_msg_info')
360  )
361  ->withAdditionalTransformation($checkboxStateToBooleanTrafo)
362  ->withDisabled($oscAvailable)
363  ->withValue(ilUtil::yn2tf((string) $this->user->getPref('chat_osc_accept_msg')));
364  }
365 
366  $fields[self::PROP_ENABLE_OSC] = $enabledOsc;
367  }
368 
370  $fields[self::PROP_ENABLE_BROADCAST_TYPING] = $fieldFactory
371  ->checkbox($this->lng->txt('chat_broadcast_typing'), $this->lng->txt('chat_broadcast_typing_info'))
372  ->withAdditionalTransformation($checkboxStateToBooleanTrafo)
373  ->withValue(ilUtil::yn2tf((string) $this->user->getPref('chat_broadcast_typing')));
374  }
375 
376  if ($fields !== []) {
377  $formSections['chat_sec'] = $this->uiFactory->input()->field()->section(
378  $fields,
379  $this->lng->txt('chat_settings')
380  );
381  }
382  }
static yn2tf(string $a_yn)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateWithContactsSettingsSection()

ilUserPrivacySettingsGUI::populateWithContactsSettingsSection ( array &  $formSections)
protected

Definition at line 249 of file class.ilUserPrivacySettingsGUI.php.

References isContactSettingVisible(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), ILIAS\Repository\user(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by initPrivacySettingsForm().

251  : void {
252  if (!$this->isContactSettingVisible()) {
253  return;
254  }
255 
256  $this->lng->loadLanguageModule('buddysystem');
257  $bs_allow_contact_me = isset($this->user->prefs['bs_allow_to_contact_me']) ?
258  $this->user->prefs['bs_allow_to_contact_me'] === 'y' : false;
259  $fields["bs_allow_to_contact_me"] = $this->uiFactory->input()
260  ->field()
261  ->checkbox(
262  $this->lng->txt("buddy_allow_to_contact_me"),
263  $this->lng->txt("buddy_allow_to_contact_me_info")
264  )
265  ->withValue($bs_allow_contact_me)
266  ->withDisabled(
267  $this->settings->get('usr_settings_disable_bs_allow_to_contact_me', '0') === '1' ? true : false
268  );
269 
270  $formSections['contacts_sec'] = $this->uiFactory->input()->field()->section($fields, $this->lng->txt('mm_contacts'));
271  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:59
isContactSettingVisible()
Is contact setting visible.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateWithNotificationSettingsSection()

ilUserPrivacySettingsGUI::populateWithNotificationSettingsSection ( array &  $formSections)
protected
Parameters
Section[]$formSections

Definition at line 276 of file class.ilUserPrivacySettingsGUI.php.

References ILIAS\Repository\lng(), shouldDisplayNotificationSection(), shouldShowNotificationOptions(), ILIAS\Repository\user(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by initPrivacySettingsForm().

276  : void
277  {
278  if (!$this->shouldDisplayNotificationSection()) {
279  return;
280  }
281 
282  $fields = [];
283 
284  if ($this->shouldShowNotificationOptions()) {
285  $this->lng->loadLanguageModule('notifications_adm');
286  $fields[self::PROP_ENABLE_SOUND] = $this->uiFactory->input()->field()
287  ->checkbox($this->lng->txt('osd_play_sound'), $this->lng->txt('osd_play_sound_desc'))
288  ->withValue((bool) $this->user->getPref('osd_play_sound'));
289  }
290 
291  if ($fields !== []) {
292  $formSections['notification_sec'] = $this->uiFactory->input()->field()->section(
293  $fields,
294  $this->lng->txt('notification_settings')
295  );
296  }
297  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePrivacySettings()

ilUserPrivacySettingsGUI::savePrivacySettings ( )

Definition at line 384 of file class.ilUserPrivacySettingsGUI.php.

References $ctrl, $lng, $request, $user, initPrivacySettingsForm(), ILIAS\Repository\int(), isAwarnessSettingVisible(), isContactSettingVisible(), ilCtrl\redirect(), ilObjUser\setPref(), ILIAS\Repository\settings(), shouldDisplayChatSection(), shouldDisplayNotificationSection(), shouldShowChatTypingBroadcastOption(), shouldShowNotificationOptions(), shouldShowOnScreenChatOptions(), showPrivacySettings(), ilProfileChecklistStatus\STEP_VISIBILITY_OPTIONS, ilUtil\tf2yn(), ilLanguage\txt(), ilObjUser\update(), ILIAS\Repository\user(), workWithUserSetting(), and ilUtil\yn2tf().

384  : void
385  {
387  $form = $this->initPrivacySettingsForm();
388  $lng = $this->lng;
389  $user = $this->user;
390  $ctrl = $this->ctrl;
391 
392  if ($request->getMethod() === "POST") {
393  $form = $form->withRequest($request);
394  $formData = $form->getData();
395 
396  if ($this->isAwarnessSettingVisible() && $this->workWithUserSetting("hide_own_online_status")) {
397  $val = $formData["hide_own_online_status"] ?? 'x';
398  if ($val == "x") {
399  $val = "";
400  }
401  $user->setPref(
402  "hide_own_online_status",
403  $val
404  );
405  }
406  if ($this->isContactSettingVisible() && $this->workWithUserSetting("bs_allow_to_contact_me")) {
407  if ($formData["bs_allow_to_contact_me"]) {
408  $user->setPref("bs_allow_to_contact_me", "y");
409  } else {
410  $user->setPref("bs_allow_to_contact_me", "n");
411  }
412  }
413 
414  $user->update();
415 
416  if ($this->shouldDisplayNotificationSection()) {
417  if ($this->shouldShowNotificationOptions()) {
418  $oldPlaySoundValue = (int) $this->user->getPref('osd_play_sound');
419  $playASound = (int) ($formData[self::PROP_ENABLE_SOUND] ?? 0);
420 
421  if ($oldPlaySoundValue !== $playASound) {
422  $this->user->setPref('osd_play_sound', (string) $playASound);
423  }
424  }
425  }
426 
427  if ($this->shouldDisplayChatSection()) {
428  $preferencesUpdated = false;
429 
430  if ($this->shouldShowOnScreenChatOptions()) {
431  $oldEnableOscValue = ilUtil::yn2tf((string) $this->user->getPref('chat_osc_accept_msg'));
432  $enableOsc = $formData[self::PROP_ENABLE_OSC] ?? null;
433  if (!is_bool($enableOsc)) {
434  $enableOsc = is_array($enableOsc);
435  }
436 
437  if ($this->settings->get('usr_settings_disable_chat_osc_accept_msg', '0') !== '1') {
438  $preferencesUpdated = true;
439  if ($oldEnableOscValue !== $enableOsc) {
440  $this->user->setPref('chat_osc_accept_msg', ilUtil::tf2yn($enableOsc));
441  $preferencesUpdated = true;
442  }
443  }
444 
445  if ($enableOsc && $this->chatSettings->get('enable_browser_notifications', '0')) {
446  $oldBrowserNotificationValue = ilUtil::yn2tf((string) $this->user->getPref('chat_osc_browser_notifications'));
447 
448  $sendBrowserNotifications = false;
449  if (is_array($formData[self::PROP_ENABLE_OSC]) &&
450  true === $formData[self::PROP_ENABLE_OSC][self::PROP_ENABLE_BROWSER_NOTIFICATIONS]) {
451  $sendBrowserNotifications = true;
452  }
453 
454  if ($oldBrowserNotificationValue !== $sendBrowserNotifications) {
455  $this->user->setPref(
456  'chat_osc_browser_notifications',
457  ilUtil::tf2yn($sendBrowserNotifications)
458  );
459  $preferencesUpdated = true;
460  }
461  }
462  }
463 
465  $oldBroadcastTypingValue = ilUtil::yn2tf((string) $this->user->getPref('chat_broadcast_typing'));
466  $broadcastTyping = (bool) ($formData[self::PROP_ENABLE_BROADCAST_TYPING] ?? false);
467 
468  if ($oldBroadcastTypingValue !== $broadcastTyping) {
469  $this->user->setPref('chat_broadcast_typing', ilUtil::tf2yn($broadcastTyping));
470  $preferencesUpdated = true;
471  }
472  }
473 
474  if ($preferencesUpdated) {
475  $this->user->writePrefs();
476 
477  $this->event->raise(
478  'Modules/Chatroom',
479  'chatSettingsChanged',
480  [
481  'user' => $this->user
482  ]
483  );
484  }
485  }
486 
487  $this->checklist_status->saveStepSucess(ilProfileChecklistStatus::STEP_VISIBILITY_OPTIONS);
488  $this->main_tpl->setOnScreenMessage('success', $lng->txt('msg_obj_modified'), true);
489  $ctrl->redirect($this, '');
490  }
491 
492  $this->showPrivacySettings($form);
493  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
static tf2yn(bool $a_tf)
showPrivacySettings(\ILIAS\UI\Component\Input\Container\Form\Standard $form=null)
isAwarnessSettingVisible()
Is awareness tool setting visible.
setPref(string $a_keyword, ?string $a_value)
static yn2tf(string $a_yn)
isContactSettingVisible()
Is contact setting visible.
Psr Http Message RequestInterface $request
+ Here is the call graph for this function:

◆ shouldDisplayChatSection()

ilUserPrivacySettingsGUI::shouldDisplayChatSection ( )

Definition at line 195 of file class.ilUserPrivacySettingsGUI.php.

Referenced by populateWithChatSettingsSection(), savePrivacySettings(), and showPrivacySettings().

195  : bool
196  {
197  return (bool) $this->chatSettings->get('chat_enabled', '0');
198  }
+ Here is the caller graph for this function:

◆ shouldDisplayNotificationSection()

ilUserPrivacySettingsGUI::shouldDisplayNotificationSection ( )

Definition at line 205 of file class.ilUserPrivacySettingsGUI.php.

Referenced by populateWithNotificationSettingsSection(), and savePrivacySettings().

205  : bool
206  {
207  return (bool) $this->notificationSettings->get('enable_osd', '0');
208  }
+ Here is the caller graph for this function:

◆ shouldShowChatTypingBroadcastOption()

ilUserPrivacySettingsGUI::shouldShowChatTypingBroadcastOption ( )
private

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

References ILIAS\Repository\settings().

Referenced by populateWithChatSettingsSection(), and savePrivacySettings().

188  : bool
189  {
190  return (
191  !$this->settings->get('usr_settings_hide_chat_broadcast_typing', '0')
192  );
193  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shouldShowNotificationOptions()

ilUserPrivacySettingsGUI::shouldShowNotificationOptions ( )
private

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

Referenced by populateWithNotificationSettingsSection(), and savePrivacySettings().

200  : bool
201  {
202  return (bool) $this->notificationSettings->get('osd_play_sound', '0');
203  }
+ Here is the caller graph for this function:

◆ shouldShowOnScreenChatOptions()

ilUserPrivacySettingsGUI::shouldShowOnScreenChatOptions ( )
private

Definition at line 180 of file class.ilUserPrivacySettingsGUI.php.

References ILIAS\Repository\settings().

Referenced by appendChatJsToTemplate(), populateWithChatSettingsSection(), and savePrivacySettings().

180  : bool
181  {
182  return (
183  $this->chatSettings->get('enable_osc', '0') &&
184  !$this->settings->get('usr_settings_hide_chat_osc_accept_msg', '0')
185  );
186  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showPrivacySettings()

ilUserPrivacySettingsGUI::showPrivacySettings ( \ILIAS\UI\Component\Input\Container\Form\Standard  $form = null)

Definition at line 102 of file class.ilUserPrivacySettingsGUI.php.

References $lng, $main_tpl, $user, appendChatJsToTemplate(), ilObject\getId(), initPrivacySettingsForm(), isAwarnessSettingVisible(), isContactSettingVisible(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\setContent(), shouldDisplayChatSection(), and ilLanguage\txt().

Referenced by savePrivacySettings().

104  : void {
106  $user = $this->user;
107  $lng = $this->lng;
108 
109  $html = "";
110  if ($this->checklist_status->anyVisibilitySettings()
111  && ($this->isAwarnessSettingVisible()
112  || $this->isContactSettingVisible()
113  || $this->shouldDisplayChatSection())) {
114  if (is_null($form)) {
115  $form = $this->initPrivacySettingsForm();
116  }
117  $html = $this->uiRenderer->render([$form]);
118  }
119 
120  $pub_profile = new ilPublicUserProfileGUI($user->getId());
121  if ($this->profile_mode->isEnabled()) {
122  $pub_profile_legacy = $this->uiFactory->legacy($pub_profile->getEmbeddable());
123  $html .= $this->uiRenderer->render($this->uiFactory->panel()->standard(
124  $this->lng->txt('user_profile_preview'),
125  $pub_profile_legacy
126  ));
127  } elseif (!$this->checklist_status->anyVisibilitySettings()) {
128  $html .= $this->uiRenderer->render(
129  [$this->uiFactory->messageBox()->info($lng->txt("usr_public_profile_disabled"))]
130  );
131  }
132 
133 
134  $chat_tpl = $this->appendChatJsToTemplate($main_tpl);
135 
136  $main_tpl->setContent($html . $chat_tpl->get());
137  }
appendChatJsToTemplate(ilGlobalTemplateInterface $pageTemplate)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
isAwarnessSettingVisible()
Is awareness tool setting visible.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
isContactSettingVisible()
Is contact setting visible.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userSettingVisible()

ilUserPrivacySettingsGUI::userSettingVisible ( string  $setting)

Definition at line 97 of file class.ilUserPrivacySettingsGUI.php.

Referenced by isAwarnessSettingVisible(), and isContactSettingVisible().

97  : bool
98  {
99  return $this->user_settings_config->isVisible($setting);
100  }
+ Here is the caller graph for this function:

◆ workWithUserSetting()

ilUserPrivacySettingsGUI::workWithUserSetting ( string  $setting)

Definition at line 92 of file class.ilUserPrivacySettingsGUI.php.

Referenced by savePrivacySettings().

92  : bool
93  {
94  return $this->user_settings_config->isVisibleAndChangeable($setting);
95  }
+ Here is the caller graph for this function:

Field Documentation

◆ $chatSettings

ilSetting ilUserPrivacySettingsGUI::$chatSettings
protected

Definition at line 44 of file class.ilUserPrivacySettingsGUI.php.

◆ $checklist_status

ilProfileChecklistStatus ilUserPrivacySettingsGUI::$checklist_status
protected

Definition at line 39 of file class.ilUserPrivacySettingsGUI.php.

◆ $ctrl

ilCtrl ilUserPrivacySettingsGUI::$ctrl
protected

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

Referenced by savePrivacySettings().

◆ $event

ilAppEventHandler ilUserPrivacySettingsGUI::$event
protected

Definition at line 46 of file class.ilUserPrivacySettingsGUI.php.

◆ $lng

ilLanguage ilUserPrivacySettingsGUI::$lng
protected

Definition at line 32 of file class.ilUserPrivacySettingsGUI.php.

Referenced by savePrivacySettings(), and showPrivacySettings().

◆ $main_tpl

ilGlobalTemplateInterface ilUserPrivacySettingsGUI::$main_tpl
protected

Definition at line 34 of file class.ilUserPrivacySettingsGUI.php.

Referenced by showPrivacySettings().

◆ $notificationSettings

ilSetting ilUserPrivacySettingsGUI::$notificationSettings
protected

Definition at line 45 of file class.ilUserPrivacySettingsGUI.php.

◆ $profile_mode

ilPersonalProfileMode ilUserPrivacySettingsGUI::$profile_mode
protected

Definition at line 40 of file class.ilUserPrivacySettingsGUI.php.

◆ $refinery

ILIAS Refinery Factory ilUserPrivacySettingsGUI::$refinery
private

Definition at line 43 of file class.ilUserPrivacySettingsGUI.php.

◆ $request

Psr Http Message RequestInterface ilUserPrivacySettingsGUI::$request
protected

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

Referenced by savePrivacySettings().

◆ $settings

ilSetting ilUserPrivacySettingsGUI::$settings
protected

Definition at line 37 of file class.ilUserPrivacySettingsGUI.php.

◆ $uiFactory

ILIAS UI Factory ilUserPrivacySettingsGUI::$uiFactory
private

Definition at line 41 of file class.ilUserPrivacySettingsGUI.php.

◆ $uiRenderer

ILIAS UI Renderer ilUserPrivacySettingsGUI::$uiRenderer
private

Definition at line 42 of file class.ilUserPrivacySettingsGUI.php.

◆ $user

ilObjUser ilUserPrivacySettingsGUI::$user
protected

Definition at line 36 of file class.ilUserPrivacySettingsGUI.php.

Referenced by savePrivacySettings(), and showPrivacySettings().

◆ $user_settings_config

ilUserSettingsConfig ilUserPrivacySettingsGUI::$user_settings_config
protected

Definition at line 35 of file class.ilUserPrivacySettingsGUI.php.

◆ PROP_ENABLE_BROADCAST_TYPING

const ilUserPrivacySettingsGUI::PROP_ENABLE_BROADCAST_TYPING = 'chat_broadcast_typing'
private

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

◆ PROP_ENABLE_BROWSER_NOTIFICATIONS

const ilUserPrivacySettingsGUI::PROP_ENABLE_BROWSER_NOTIFICATIONS = 'chat_osc_browser_notifications'
private

Definition at line 28 of file class.ilUserPrivacySettingsGUI.php.

◆ PROP_ENABLE_OSC

const ilUserPrivacySettingsGUI::PROP_ENABLE_OSC = 'chat_osc_accept_msg'
private

Definition at line 27 of file class.ilUserPrivacySettingsGUI.php.

◆ PROP_ENABLE_SOUND

const ilUserPrivacySettingsGUI::PROP_ENABLE_SOUND = 'osd_play_sound'
private

Definition at line 29 of file class.ilUserPrivacySettingsGUI.php.


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