ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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

Language $lng
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $main_tpl
 
ilUserSettingsConfig $user_settings_config
 
ilObjUser $user
 
ilSetting $settings
 
Psr Http Message RequestInterface $request
 
ChecklistStatus $checklist_status
 
ProfileMode $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 31 of file class.ilUserPrivacySettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserPrivacySettingsGUI::__construct ( )

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

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

55  {
56  global $DIC;
57 
58  $this->main_tpl = $DIC['tpl'];
59  $this->lng = $DIC['lng'];
60  $this->ctrl = $DIC['ilCtrl'];
61  $this->user = $DIC['ilUser'];
62  $this->refinery = $DIC['refinery'];
63  $this->uiFactory = $DIC['ui.factory'];
64  $this->uiRenderer = $DIC['ui.renderer'];
65  $this->event = $DIC['ilAppEventHandler'];
66  $this->request = $DIC->http()->request();
67 
68  $this->chatSettings = new ilSetting('chatroom');
69  $this->notificationSettings = new ilSetting('notifications');
70 
71  $this->user_settings_config = new ilUserSettingsConfig();
72  $this->settings = $DIC->settings();
73  $this->profile_mode = new ProfileMode($this->lng, $this->settings, $this->user);
74  $this->checklist_status = new ChecklistStatus(
75  $this->lng,
76  $this->settings,
77  $this->user,
78  $this->profile_mode
79  );
80 
81  $this->lng->loadLanguageModule('user');
82  }
global $DIC
Definition: shib_login.php:25
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 507 of file class.ilUserPrivacySettingsGUI.php.

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

Referenced by showPrivacySettings().

509  : ilTemplate {
510  $tpl = new ilTemplate('tpl.personal_chat_settings_form.html', true, true, 'components/ILIAS/Chatroom');
511  if ($this->shouldShowOnScreenChatOptions() && $this->chatSettings->get('enable_browser_notifications', '0')) {
512  $pageTemplate->addJavaScript('assets/js/browser_notifications.js');
513 
514  $tpl->setVariable('ALERT_IMAGE_SRC', ilUtil::getImagePath('standard/icon_alert.svg'));
515  $tpl->setVariable('BROWSER_NOTIFICATION_TOGGLE_LABEL', $this->lng->txt('osc_enable_browser_notifications_label'));
516 
517  $this->lng->toJSMap([
518  'osc_browser_noti_no_permission_error' => $this->lng->txt('osc_browser_noti_no_permission_error'),
519  'osc_browser_noti_no_support_error' => $this->lng->txt('osc_browser_noti_no_support_error'),
520  'osc_browser_noti_req_permission_error' => $this->lng->txt('osc_browser_noti_req_permission_error'),
521  ], $pageTemplate);
522  }
523 
524  return $tpl;
525  }
static getImagePath(string $image_name, 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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilUserPrivacySettingsGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

84  : void
85  {
86  $next_class = $this->ctrl->getNextClass();
87 
88  switch ($next_class) {
89  default:
90  $cmd = $this->ctrl->getCmd("showPrivacySettings");
91  $this->$cmd();
92  break;
93  }
94  $this->main_tpl->printToStdout();
95  }
+ Here is the call graph for this function:

◆ initPrivacySettingsForm()

ilUserPrivacySettingsGUI::initPrivacySettingsForm ( )

Init form.

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

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

Referenced by savePrivacySettings(), and showPrivacySettings().

172  : \ILIAS\UI\Component\Input\Container\Form\Standard
173  {
174  $sections = [];
175 
176  $this->populateWithAwarenessSettingsSection($sections);
177  $this->populateWithContactsSettingsSection($sections);
178  $this->populateWithChatSettingsSection($sections);
179  $this->populateWithNotificationSettingsSection($sections);
180 
181  $form_action = $this->ctrl->getLinkTarget($this, "savePrivacySettings");
182 
183  return $this->uiFactory->input()
184  ->container()
185  ->form()
186  ->standard($form_action, $sections)
187  ->withAdditionalTransformation($this->refinery->custom()->transformation(static function (array $values): array {
188  return array_merge(...array_values($values));
189  }));
190  }
populateWithContactsSettingsSection(array &$formSections)
populateWithNotificationSettingsSection(array &$formSections)
populateWithAwarenessSettingsSection(array &$formSections)
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 154 of file class.ilUserPrivacySettingsGUI.php.

References userSettingVisible().

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

154  : bool
155  {
156  $awrn_set = new ilSetting("awrn");
157 
158  return $awrn_set->get("awrn_enabled", '0') && $this->userSettingVisible("hide_own_online_status");
159  }
+ 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 164 of file class.ilUserPrivacySettingsGUI.php.

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

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

164  : bool
165  {
166  return ilBuddySystem::getInstance()->isEnabled() && $this->userSettingVisible('bs_allow_to_contact_me');
167  }
+ 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 222 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().

224  : void {
225  if (!$this->isAwarnessSettingVisible()) {
226  return;
227  }
228 
229  $this->lng->loadLanguageModule("awrn");
230 
231  $default = ($this->settings->get('hide_own_online_status') === "n")
232  ? $this->lng->txt("user_awrn_show")
233  : $this->lng->txt("user_awrn_hide");
234 
235  $options = [
236  "x" => $this->lng->txt("user_awrn_default") . " (" . $default . ")",
237  "n" => $this->lng->txt("user_awrn_show"),
238  "y" => $this->lng->txt("user_awrn_hide")
239  ];
240  $val = $this->user->prefs["hide_own_online_status"] ?? "";
241  if ($val == "") {
242  $val = "x";
243  }
244 
245  $fields["hide_own_online_status"] = $this->uiFactory->input()
246  ->field()
247  ->select(
248  $this->lng->txt("awrn_user_show"),
249  $options,
250  $this->lng->txt("awrn_hide_from_awareness_info")
251  )
252  ->withValue($val)
253  ->withRequired(true)
254  ->withDisabled(
255  $this->settings->get('usr_settings_disable_hide_own_online_status', '0') === '1' ? true : false
256  );
257 
258  $formSections['awrn_sec'] = $this->uiFactory->input()->field()->section($fields, $this->lng->txt('obj_awra'));
259  }
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 311 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().

313  : void {
314  if (!$this->shouldDisplayChatSection()) {
315  return;
316  }
317 
318  $fieldFactory = $this->uiFactory->input()->field();
319  $fields = [];
320 
321  $this->lng->loadLanguageModule('chatroom_adm');
322  $checkboxStateToBooleanTrafo = $this->refinery->custom()->transformation(static function ($v) {
323  if (is_array($v)) {
324  return $v;
325  }
326 
327  if (is_bool($v)) {
328  return $v;
329  }
330 
331  return $v === 'checked';
332  });
333 
334  if ($this->shouldShowOnScreenChatOptions()) {
335  $oscAvailable = $this->settings->get('usr_settings_disable_chat_osc_accept_msg', '0') === '1' ? true : false;
336  $oscSubFormGroup = [];
337 
338  if ($this->chatSettings->get('enable_browser_notifications', '0')) {
339  $enabledBrowserNotifications = $fieldFactory
340  ->checkbox(
341  $this->lng->txt('osc_enable_browser_notifications_label'),
342  sprintf(
343  $this->lng->txt('osc_enable_browser_notifications_info'),
344  (int) $this->chatSettings->get('conversation_idle_state_in_minutes')
345  )
346  )
347  ->withAdditionalTransformation($checkboxStateToBooleanTrafo)
348  ->withDisabled($oscAvailable);
349 
350  $oscSubFormGroup[self::PROP_ENABLE_BROWSER_NOTIFICATIONS] = $enabledBrowserNotifications;
351 
352  $groupValue = null;
353  if (ilUtil::yn2tf((string) $this->user->getPref('chat_osc_accept_msg'))) {
354  $groupValue = [
355  self::PROP_ENABLE_BROWSER_NOTIFICATIONS => ilUtil::yn2tf((string) $this->user->getPref('chat_osc_browser_notifications')),
356  ];
357  }
358  $enabledOsc = $fieldFactory
359  ->optionalGroup(
360  $oscSubFormGroup,
361  $this->lng->txt('chat_osc_accept_msg'),
362  $this->lng->txt('chat_osc_accept_msg_info')
363  )
364  ->withAdditionalTransformation($checkboxStateToBooleanTrafo)
365  ->withDisabled($oscAvailable)
366  ->withValue($groupValue);
367  } else {
368  $enabledOsc = $fieldFactory
369  ->checkbox(
370  $this->lng->txt('chat_osc_accept_msg'),
371  $this->lng->txt('chat_osc_accept_msg_info')
372  )
373  ->withAdditionalTransformation($checkboxStateToBooleanTrafo)
374  ->withDisabled($oscAvailable)
375  ->withValue(ilUtil::yn2tf((string) $this->user->getPref('chat_osc_accept_msg')));
376  }
377 
378  $fields[self::PROP_ENABLE_OSC] = $enabledOsc;
379  }
380 
382  $fields[self::PROP_ENABLE_BROADCAST_TYPING] = $fieldFactory
383  ->checkbox($this->lng->txt('chat_broadcast_typing'), $this->lng->txt('chat_broadcast_typing_info'))
384  ->withAdditionalTransformation($checkboxStateToBooleanTrafo)
385  ->withValue(ilUtil::yn2tf((string) $this->user->getPref('chat_broadcast_typing')));
386  }
387 
388  if ($fields !== []) {
389  $formSections['chat_sec'] = $this->uiFactory->input()->field()->section(
390  $fields,
391  $this->lng->txt('chat_settings')
392  );
393  }
394  }
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 261 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().

263  : void {
264  if (!$this->isContactSettingVisible()) {
265  return;
266  }
267 
268  $this->lng->loadLanguageModule('buddysystem');
269  $bs_allow_contact_me = isset($this->user->prefs['bs_allow_to_contact_me']) ?
270  $this->user->prefs['bs_allow_to_contact_me'] === 'y' : false;
271  $fields["bs_allow_to_contact_me"] = $this->uiFactory->input()
272  ->field()
273  ->checkbox(
274  $this->lng->txt("buddy_allow_to_contact_me"),
275  $this->lng->txt("buddy_allow_to_contact_me_info")
276  )
277  ->withValue($bs_allow_contact_me)
278  ->withDisabled(
279  $this->settings->get('usr_settings_disable_bs_allow_to_contact_me', '0') === '1' ? true : false
280  );
281 
282  $formSections['contacts_sec'] = $this->uiFactory->input()->field()->section($fields, $this->lng->txt('mm_contacts'));
283  }
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 288 of file class.ilUserPrivacySettingsGUI.php.

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

Referenced by initPrivacySettingsForm().

288  : void
289  {
290  if (!$this->shouldDisplayNotificationSection()) {
291  return;
292  }
293 
294  $fields = [];
295 
296  if ($this->shouldShowNotificationOptions()) {
297  $this->lng->loadLanguageModule('notifications_adm');
298  $fields[self::PROP_ENABLE_SOUND] = $this->uiFactory->input()->field()
299  ->checkbox($this->lng->txt('osd_play_sound'), $this->lng->txt('osd_play_sound_desc'))
300  ->withValue((bool) $this->user->getPref('osd_play_sound'));
301  }
302 
303  if ($fields !== []) {
304  $formSections['notification_sec'] = $this->uiFactory->input()->field()->section(
305  $fields,
306  $this->lng->txt('notification_settings')
307  );
308  }
309  }
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 396 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(), ilUtil\tf2yn(), ILIAS\Language\Language\txt(), ilObjUser\update(), ILIAS\Repository\user(), workWithUserSetting(), and ilUtil\yn2tf().

396  : void
397  {
399  $form = $this->initPrivacySettingsForm();
400  $lng = $this->lng;
401  $user = $this->user;
402  $ctrl = $this->ctrl;
403 
404  if ($request->getMethod() === "POST") {
405  $form = $form->withRequest($request);
406  $formData = $form->getData();
407 
408  if ($this->isAwarnessSettingVisible() && $this->workWithUserSetting("hide_own_online_status")) {
409  $val = $formData["hide_own_online_status"] ?? 'x';
410  if ($val == "x") {
411  $val = "";
412  }
413  $user->setPref(
414  "hide_own_online_status",
415  $val
416  );
417  }
418  if ($this->isContactSettingVisible() && $this->workWithUserSetting("bs_allow_to_contact_me")) {
419  if ($formData["bs_allow_to_contact_me"]) {
420  $user->setPref("bs_allow_to_contact_me", "y");
421  } else {
422  $user->setPref("bs_allow_to_contact_me", "n");
423  }
424  }
425 
426  $user->update();
427 
428  if ($this->shouldDisplayNotificationSection()) {
429  if ($this->shouldShowNotificationOptions()) {
430  $oldPlaySoundValue = (int) $this->user->getPref('osd_play_sound');
431  $playASound = (int) ($formData[self::PROP_ENABLE_SOUND] ?? 0);
432 
433  if ($oldPlaySoundValue !== $playASound) {
434  $this->user->setPref('osd_play_sound', (string) $playASound);
435  }
436  }
437  }
438 
439  if ($this->shouldDisplayChatSection()) {
440  $preferencesUpdated = false;
441 
442  if ($this->shouldShowOnScreenChatOptions()) {
443  $oldEnableOscValue = ilUtil::yn2tf((string) $this->user->getPref('chat_osc_accept_msg'));
444  $enableOsc = $formData[self::PROP_ENABLE_OSC] ?? null;
445  if (!is_bool($enableOsc)) {
446  $enableOsc = is_array($enableOsc);
447  }
448 
449  if ($this->settings->get('usr_settings_disable_chat_osc_accept_msg', '0') !== '1') {
450  $preferencesUpdated = true;
451  if ($oldEnableOscValue !== $enableOsc) {
452  $this->user->setPref('chat_osc_accept_msg', ilUtil::tf2yn($enableOsc));
453  $preferencesUpdated = true;
454  }
455  }
456 
457  if ($enableOsc && $this->chatSettings->get('enable_browser_notifications', '0')) {
458  $oldBrowserNotificationValue = ilUtil::yn2tf((string) $this->user->getPref('chat_osc_browser_notifications'));
459 
460  $sendBrowserNotifications = false;
461  if (is_array($formData[self::PROP_ENABLE_OSC]) &&
462  true === $formData[self::PROP_ENABLE_OSC][self::PROP_ENABLE_BROWSER_NOTIFICATIONS]) {
463  $sendBrowserNotifications = true;
464  }
465 
466  if ($oldBrowserNotificationValue !== $sendBrowserNotifications) {
467  $this->user->setPref(
468  'chat_osc_browser_notifications',
469  ilUtil::tf2yn($sendBrowserNotifications)
470  );
471  $preferencesUpdated = true;
472  }
473  }
474  }
475 
477  $oldBroadcastTypingValue = ilUtil::yn2tf((string) $this->user->getPref('chat_broadcast_typing'));
478  $broadcastTyping = (bool) ($formData[self::PROP_ENABLE_BROADCAST_TYPING] ?? false);
479 
480  if ($oldBroadcastTypingValue !== $broadcastTyping) {
481  $this->user->setPref('chat_broadcast_typing', ilUtil::tf2yn($broadcastTyping));
482  $preferencesUpdated = true;
483  }
484  }
485 
486  if ($preferencesUpdated) {
487  $this->user->writePrefs();
488 
489  $this->event->raise(
490  'components/ILIAS/Chatroom',
491  'chatSettingsChanged',
492  [
493  'user' => $this->user
494  ]
495  );
496  }
497  }
498 
499  $this->checklist_status->saveStepSucess(ChecklistStatus::STEP_VISIBILITY_OPTIONS);
500  $this->main_tpl->setOnScreenMessage('success', $lng->txt('msg_obj_modified'), true);
501  $ctrl->redirect($this, '');
502  }
503 
504  $this->showPrivacySettings($form);
505  }
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.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
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 207 of file class.ilUserPrivacySettingsGUI.php.

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

207  : bool
208  {
209  return (bool) $this->chatSettings->get('chat_enabled', '0');
210  }
+ Here is the caller graph for this function:

◆ shouldDisplayNotificationSection()

ilUserPrivacySettingsGUI::shouldDisplayNotificationSection ( )

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

Referenced by populateWithNotificationSettingsSection(), and savePrivacySettings().

217  : bool
218  {
219  return (bool) $this->notificationSettings->get('enable_osd', '0');
220  }
+ Here is the caller graph for this function:

◆ shouldShowChatTypingBroadcastOption()

ilUserPrivacySettingsGUI::shouldShowChatTypingBroadcastOption ( )
private

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

References ILIAS\Repository\settings().

Referenced by populateWithChatSettingsSection(), and savePrivacySettings().

200  : bool
201  {
202  return (
203  !$this->settings->get('usr_settings_hide_chat_broadcast_typing', '0')
204  );
205  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shouldShowNotificationOptions()

ilUserPrivacySettingsGUI::shouldShowNotificationOptions ( )
private

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

Referenced by populateWithNotificationSettingsSection(), and savePrivacySettings().

212  : bool
213  {
214  return (bool) $this->notificationSettings->get('osd_play_sound', '0');
215  }
+ Here is the caller graph for this function:

◆ shouldShowOnScreenChatOptions()

ilUserPrivacySettingsGUI::shouldShowOnScreenChatOptions ( )
private

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

References ILIAS\Repository\settings().

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

192  : bool
193  {
194  return (
195  $this->chatSettings->get('enable_osc', '0') &&
196  !$this->settings->get('usr_settings_hide_chat_osc_accept_msg', '0')
197  );
198  }
+ 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 114 of file class.ilUserPrivacySettingsGUI.php.

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

Referenced by savePrivacySettings().

116  : void {
118  $user = $this->user;
119  $lng = $this->lng;
120 
121  $html = "";
122  if ($this->checklist_status->anyVisibilitySettings()
123  && ($this->isAwarnessSettingVisible()
124  || $this->isContactSettingVisible()
125  || $this->shouldDisplayChatSection())) {
126  if (is_null($form)) {
127  $form = $this->initPrivacySettingsForm();
128  }
129  $html = $this->uiRenderer->render([$form]);
130  }
131 
132  $pub_profile = new ilPublicUserProfileGUI($user->getId());
133  if ($this->profile_mode->isEnabled()) {
134  $pub_profile_legacy = $this->uiFactory->legacy($pub_profile->getEmbeddable());
135  $html .= $this->uiRenderer->render($this->uiFactory->panel()->standard(
136  $this->lng->txt('user_profile_preview'),
137  $pub_profile_legacy
138  ));
139  } elseif (!$this->checklist_status->anyVisibilitySettings()) {
140  $html .= $this->uiRenderer->render(
141  [$this->uiFactory->messageBox()->info($lng->txt("usr_public_profile_disabled"))]
142  );
143  }
144 
145 
146  $chat_tpl = $this->appendChatJsToTemplate($main_tpl);
147 
148  $main_tpl->setContent($html . $chat_tpl->get());
149  }
appendChatJsToTemplate(ilGlobalTemplateInterface $pageTemplate)
isAwarnessSettingVisible()
Is awareness tool setting visible.
GUI class for public user profile presentation.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
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 109 of file class.ilUserPrivacySettingsGUI.php.

Referenced by isAwarnessSettingVisible(), and isContactSettingVisible().

109  : bool
110  {
111  return $this->user_settings_config->isVisible($setting);
112  }
+ Here is the caller graph for this function:

◆ workWithUserSetting()

ilUserPrivacySettingsGUI::workWithUserSetting ( string  $setting)

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

Referenced by savePrivacySettings().

104  : bool
105  {
106  return $this->user_settings_config->isVisibleAndChangeable($setting);
107  }
+ Here is the caller graph for this function:

Field Documentation

◆ $chatSettings

ilSetting ilUserPrivacySettingsGUI::$chatSettings
protected

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

◆ $checklist_status

ChecklistStatus ilUserPrivacySettingsGUI::$checklist_status
protected

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

◆ $ctrl

ilCtrl ilUserPrivacySettingsGUI::$ctrl
protected

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

Referenced by savePrivacySettings().

◆ $event

ilAppEventHandler ilUserPrivacySettingsGUI::$event
protected

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

◆ $lng

Language ilUserPrivacySettingsGUI::$lng
protected

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

Referenced by savePrivacySettings(), and showPrivacySettings().

◆ $main_tpl

ilGlobalTemplateInterface ilUserPrivacySettingsGUI::$main_tpl
protected

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

Referenced by showPrivacySettings().

◆ $notificationSettings

ilSetting ilUserPrivacySettingsGUI::$notificationSettings
protected

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

◆ $profile_mode

ProfileMode ilUserPrivacySettingsGUI::$profile_mode
protected

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

◆ $refinery

ILIAS Refinery Factory ilUserPrivacySettingsGUI::$refinery
private

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

◆ $request

Psr Http Message RequestInterface ilUserPrivacySettingsGUI::$request
protected

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

Referenced by savePrivacySettings().

◆ $settings

ilSetting ilUserPrivacySettingsGUI::$settings
protected

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

◆ $uiFactory

ILIAS UI Factory ilUserPrivacySettingsGUI::$uiFactory
private

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

◆ $uiRenderer

ILIAS UI Renderer ilUserPrivacySettingsGUI::$uiRenderer
private

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

◆ $user

ilObjUser ilUserPrivacySettingsGUI::$user
protected

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

Referenced by savePrivacySettings(), and showPrivacySettings().

◆ $user_settings_config

ilUserSettingsConfig ilUserPrivacySettingsGUI::$user_settings_config
protected

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

◆ PROP_ENABLE_BROADCAST_TYPING

const ilUserPrivacySettingsGUI::PROP_ENABLE_BROADCAST_TYPING = 'chat_broadcast_typing'
private

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

◆ PROP_ENABLE_BROWSER_NOTIFICATIONS

const ilUserPrivacySettingsGUI::PROP_ENABLE_BROWSER_NOTIFICATIONS = 'chat_osc_browser_notifications'
private

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

◆ PROP_ENABLE_OSC

const ilUserPrivacySettingsGUI::PROP_ENABLE_OSC = 'chat_osc_accept_msg'
private

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

◆ PROP_ENABLE_SOUND

const ilUserPrivacySettingsGUI::PROP_ENABLE_SOUND = 'osd_play_sound'
private

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


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