ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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

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 30 of file class.ilUserPrivacySettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserPrivacySettingsGUI::__construct ( )

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

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

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

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

Referenced by showPrivacySettings().

508  : ilTemplate {
509  $tpl = new ilTemplate('tpl.personal_chat_settings_form.html', true, true, 'components/ILIAS/Chatroom');
510  if ($this->shouldShowOnScreenChatOptions() && $this->chatSettings->get('enable_browser_notifications', '0')) {
511  $pageTemplate->addJavaScript('assets/js/browser_notifications.js');
512 
513  $tpl->setVariable('ALERT_IMAGE_SRC', ilUtil::getImagePath('standard/icon_alert.svg'));
514  $tpl->setVariable('BROWSER_NOTIFICATION_TOGGLE_LABEL', $this->lng->txt('osc_enable_browser_notifications_label'));
515 
516  $this->lng->toJSMap([
517  'osc_browser_noti_no_permission_error' => $this->lng->txt('osc_browser_noti_no_permission_error'),
518  'osc_browser_noti_no_support_error' => $this->lng->txt('osc_browser_noti_no_support_error'),
519  'osc_browser_noti_req_permission_error' => $this->lng->txt('osc_browser_noti_req_permission_error'),
520  ], $pageTemplate);
521  }
522 
523  return $tpl;
524  }
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 83 of file class.ilUserPrivacySettingsGUI.php.

References ILIAS\Repository\ctrl().

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

◆ initPrivacySettingsForm()

ilUserPrivacySettingsGUI::initPrivacySettingsForm ( )

Init form.

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

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

Referenced by savePrivacySettings(), and showPrivacySettings().

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

References userSettingVisible().

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

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

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

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

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

223  : void {
224  if (!$this->isAwarnessSettingVisible()) {
225  return;
226  }
227 
228  $this->lng->loadLanguageModule("awrn");
229 
230  $default = ($this->settings->get('hide_own_online_status') === "n")
231  ? $this->lng->txt("user_awrn_show")
232  : $this->lng->txt("user_awrn_hide");
233 
234  $options = [
235  "x" => $this->lng->txt("user_awrn_default") . " (" . $default . ")",
236  "n" => $this->lng->txt("user_awrn_show"),
237  "y" => $this->lng->txt("user_awrn_hide")
238  ];
239  $val = $this->user->prefs["hide_own_online_status"] ?? "";
240  if ($val == "") {
241  $val = "x";
242  }
243 
244  $fields["hide_own_online_status"] = $this->uiFactory->input()
245  ->field()
246  ->select(
247  $this->lng->txt("awrn_user_show"),
248  $options,
249  $this->lng->txt("awrn_hide_from_awareness_info")
250  )
251  ->withValue($val)
252  ->withRequired(true)
253  ->withDisabled(
254  $this->settings->get('usr_settings_disable_hide_own_online_status', '0') === '1' ? true : false
255  );
256 
257  $formSections['awrn_sec'] = $this->uiFactory->input()->field()->section($fields, $this->lng->txt('obj_awra'));
258  }
isAwarnessSettingVisible()
Is awareness tool setting visible.
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ 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 310 of file class.ilUserPrivacySettingsGUI.php.

References ILIAS\Repository\int(), ILIAS\Repository\lng(), null, 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().

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

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

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

Referenced by initPrivacySettingsForm().

287  : void
288  {
289  if (!$this->shouldDisplayNotificationSection()) {
290  return;
291  }
292 
293  $fields = [];
294 
295  if ($this->shouldShowNotificationOptions()) {
296  $this->lng->loadLanguageModule('notifications_adm');
297  $fields[self::PROP_ENABLE_SOUND] = $this->uiFactory->input()->field()
298  ->checkbox($this->lng->txt('osd_play_sound'), $this->lng->txt('osd_play_sound_desc'))
299  ->withValue((bool) $this->user->getPref('osd_play_sound'));
300  }
301 
302  if ($fields !== []) {
303  $formSections['notification_sec'] = $this->uiFactory->input()->field()->section(
304  $fields,
305  $this->lng->txt('notification_settings')
306  );
307  }
308  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePrivacySettings()

ilUserPrivacySettingsGUI::savePrivacySettings ( )

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

References $ctrl, $lng, $request, $user, initPrivacySettingsForm(), ILIAS\Repository\int(), isAwarnessSettingVisible(), isContactSettingVisible(), null, 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().

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

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

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

◆ shouldDisplayNotificationSection()

ilUserPrivacySettingsGUI::shouldDisplayNotificationSection ( )

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

Referenced by populateWithNotificationSettingsSection(), and savePrivacySettings().

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

◆ shouldShowChatTypingBroadcastOption()

ilUserPrivacySettingsGUI::shouldShowChatTypingBroadcastOption ( )
private

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

References ILIAS\Repository\settings().

Referenced by populateWithChatSettingsSection(), and savePrivacySettings().

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

◆ shouldShowNotificationOptions()

ilUserPrivacySettingsGUI::shouldShowNotificationOptions ( )
private

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

Referenced by populateWithNotificationSettingsSection(), and savePrivacySettings().

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

◆ shouldShowOnScreenChatOptions()

ilUserPrivacySettingsGUI::shouldShowOnScreenChatOptions ( )
private

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

References ILIAS\Repository\settings().

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

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

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

Referenced by savePrivacySettings().

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

Referenced by isAwarnessSettingVisible(), and isContactSettingVisible().

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

◆ workWithUserSetting()

ilUserPrivacySettingsGUI::workWithUserSetting ( string  $setting)

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

Referenced by savePrivacySettings().

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

Field Documentation

◆ $chatSettings

ilSetting ilUserPrivacySettingsGUI::$chatSettings
protected

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

◆ $checklist_status

ChecklistStatus ilUserPrivacySettingsGUI::$checklist_status
protected

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

◆ $ctrl

ilCtrl ilUserPrivacySettingsGUI::$ctrl
protected

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

Referenced by savePrivacySettings().

◆ $event

ilAppEventHandler ilUserPrivacySettingsGUI::$event
protected

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

◆ $lng

Language ilUserPrivacySettingsGUI::$lng
protected

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

Referenced by savePrivacySettings(), and showPrivacySettings().

◆ $main_tpl

ilGlobalTemplateInterface ilUserPrivacySettingsGUI::$main_tpl
protected

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

Referenced by showPrivacySettings().

◆ $notificationSettings

ilSetting ilUserPrivacySettingsGUI::$notificationSettings
protected

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

◆ $profile_mode

ProfileMode ilUserPrivacySettingsGUI::$profile_mode
protected

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

◆ $refinery

ILIAS Refinery Factory ilUserPrivacySettingsGUI::$refinery
private

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

◆ $request

Psr Http Message RequestInterface ilUserPrivacySettingsGUI::$request
protected

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

Referenced by savePrivacySettings().

◆ $settings

ilSetting ilUserPrivacySettingsGUI::$settings
protected

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

◆ $uiFactory

ILIAS UI Factory ilUserPrivacySettingsGUI::$uiFactory
private

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

◆ $uiRenderer

ILIAS UI Renderer ilUserPrivacySettingsGUI::$uiRenderer
private

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

◆ $user

ilObjUser ilUserPrivacySettingsGUI::$user
protected

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

Referenced by savePrivacySettings(), and showPrivacySettings().

◆ $user_settings_config

ilUserSettingsConfig ilUserPrivacySettingsGUI::$user_settings_config
protected

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

◆ PROP_ENABLE_BROADCAST_TYPING

const ilUserPrivacySettingsGUI::PROP_ENABLE_BROADCAST_TYPING = 'chat_broadcast_typing'
private

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

◆ PROP_ENABLE_BROWSER_NOTIFICATIONS

const ilUserPrivacySettingsGUI::PROP_ENABLE_BROWSER_NOTIFICATIONS = 'chat_osc_browser_notifications'
private

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

◆ PROP_ENABLE_OSC

const ilUserPrivacySettingsGUI::PROP_ENABLE_OSC = 'chat_osc_accept_msg'
private

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

◆ PROP_ENABLE_SOUND

const ilUserPrivacySettingsGUI::PROP_ENABLE_SOUND = 'osd_play_sound'
private

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


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