ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilForumSettingsGUI Class Reference

Class ilForumSettingsGUI. More...

+ Inheritance diagram for ilForumSettingsGUI:
+ Collaboration diagram for ilForumSettingsGUI:

Public Member Functions

 __construct (private readonly ilObjForumGUI $parent_obj, private readonly ilObjForum $forum)
 
 getRefId ()
 
 executeCommand ()
 
 getCustomForm (ilPropertyFormGUI $a_form)
 
 settingsTabs ()
 
 getCustomValues (array &$a_values)
 
 updateCustomValues (ilPropertyFormGUI $a_form)
 
 showMembers ()
 
 saveEventsForUser ()
 
 enableAdminForceNoti ()
 
 disableAdminForceNoti ()
 
 enableHideUserToggleNoti ()
 
 disableHideUserToggleNoti ()
 
 updateNotificationSettings ()
 

Private Member Functions

 initForcedForumNotification ()
 
 addAvailabilitySection (ilPropertyFormGUI $form)
 
 getUserNotificationTableData (array $user_ids)
 
 showMembersTable (array $moderators, array $admins, array $members, array $tutors)
 
 initNotificationSettingsForm ()
 

Private Attributes

ilCtrlInterface $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilSetting $settings
 
ilTabsGUI $tabs
 
ilAccessHandler $access
 
ILIAS HTTP GlobalHttpState $http
 
ilForumNotification $forumNotificationObj
 
ilPropertyFormGUI $notificationSettingsForm = null
 
ilObjectService $obj_service
 
ILIAS DI Container $dic
 
ilErrorHandling $error
 
ILIAS UI Factory $ui_factory
 

Additional Inherited Members

- Data Fields inherited from ilForumObjectConstants
const OBJ_TYPE = 'frm'
 
const UI_TAB_ID_INFO = 'info_short'
 
const UI_TAB_ID_SETTINGS = 'settings'
 
const UI_TAB_ID_MODERATORS = 'frm_moderators'
 
const UI_TAB_ID_THREADS = 'forums_threads'
 
const UI_TAB_ID_STATS = 'frm_statistics'
 
const UI_TAB_ID_EXPORT = 'export'
 
const UI_TAB_ID_PERMISSIONS = 'perm_settings'
 
const UI_SUB_TAB_ID_BASIC_SETTINGS = 'basic_settings'
 
const UI_SUB_TAB_ID_NOTIFICATIONS = 'notifications'
 
const UI_SUB_TAB_ID_NEWS = 'cont_news_settings'
 
const UI_SUB_TAB_ID_STYLE = 'cont_style'
 
const UI_CMD_COPAGE_DOWNLOAD_FILE = 'downloadFile'
 
const UI_CMD_COPAGE_DISPLAY_FULLSCREEN = 'displayMediaFullscreen'
 
const UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH = 'download_paragraph'
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumSettingsGUI::__construct ( private readonly ilObjForumGUI  $parent_obj,
private readonly ilObjForum  $forum 
)

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

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), and ILIAS\Repository\tabs().

45  {
46  global $DIC;
47 
48  $this->dic = $DIC;
49 
50  $this->ctrl = $DIC->ctrl();
51  $this->tpl = $DIC->ui()->mainTemplate();
52  $this->lng = $DIC->language();
53  $this->settings = $DIC->settings();
54  $this->tabs = $DIC->tabs();
55  $this->access = $DIC->access();
56  $this->obj_service = $this->dic->object();
57  $this->http = $DIC->http();
58  $this->ui_factory = $DIC->ui()->factory();
59  $this->error = $DIC['ilErr'];
60 
61  $this->lng->loadLanguageModule('style');
62  $this->lng->loadLanguageModule('cont');
63  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

Member Function Documentation

◆ addAvailabilitySection()

ilForumSettingsGUI::addAvailabilitySection ( ilPropertyFormGUI  $form)
private

Definition at line 91 of file class.ilForumSettingsGUI.php.

References ilPropertyFormGUI\addItem(), and ILIAS\Repository\lng().

Referenced by getCustomForm().

91  : void
92  {
93  $section = new ilFormSectionHeaderGUI();
94  $section->setTitle($this->lng->txt('rep_activation_availability'));
95  $form->addItem($section);
96 
97  $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'activation_online');
98  $online->setInfo($this->lng->txt('frm_activation_online_info'));
99  $form->addItem($online);
100  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disableAdminForceNoti()

ilForumSettingsGUI::disableAdminForceNoti ( )

Definition at line 528 of file class.ilForumSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\lng(), ilForumNotification\setUserId(), and showMembers().

528  : void
529  {
530  if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
531  $this->error->raiseError(
532  $this->lng->txt('msg_no_perm_read'),
533  $this->error->MESSAGE
534  );
535  }
536 
537  $user_ids = [];
538  if ($this->dic->http()->wrapper()->post()->has('user_id')) {
539  $user_ids = $this->dic->http()->wrapper()->post()->retrieve(
540  'user_id',
541  $this->dic->refinery()->kindlyTo()->listOf($this->dic->refinery()->kindlyTo()->int())
542  );
543  }
544 
545  if (count($user_ids) === 0) {
546  $this->tpl->setOnScreenMessage('info', $this->lng->txt('time_limit_no_users_selected'));
547  } else {
548  $frm_noti = new ilForumNotification($this->forum->getRefId());
549 
550  foreach ($user_ids as $user_id) {
551  $frm_noti->setUserId((int) $user_id);
552  $is_enabled = $frm_noti->isAdminForceNotification();
553 
554  if ($is_enabled) {
555  $frm_noti->deleteAdminForce();
556  }
557  }
558 
559  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
560  }
561 
562  $this->showMembers();
563  }
Class ilForumNotification.
+ Here is the call graph for this function:

◆ disableHideUserToggleNoti()

ilForumSettingsGUI::disableHideUserToggleNoti ( )

Definition at line 606 of file class.ilForumSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\lng(), ilForumNotification\setUserId(), and showMembers().

606  : void
607  {
608  if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
609  $this->error->raiseError(
610  $this->lng->txt('msg_no_perm_read'),
611  $this->error->MESSAGE
612  );
613  }
614 
615  $user_ids = [];
616  if ($this->dic->http()->wrapper()->post()->has('user_id')) {
617  $user_ids = $this->dic->http()->wrapper()->post()->retrieve(
618  'user_id',
619  $this->dic->refinery()->kindlyTo()->listOf($this->dic->refinery()->kindlyTo()->int())
620  );
621  }
622 
623  if (count($user_ids) === 0) {
624  $this->tpl->setOnScreenMessage('info', $this->lng->txt('time_limit_no_users_selected'));
625  } else {
626  $frm_noti = new ilForumNotification($this->forum->getRefId());
627 
628  foreach ($user_ids as $user_id) {
629  $frm_noti->setUserId((int) $user_id);
630  $frm_noti->setUserToggle(false);
631  $is_enabled = $frm_noti->isAdminForceNotification();
632  if ($is_enabled) {
633  $frm_noti->updateUserToggle();
634  } else {
635  $frm_noti->setAdminForce(true);
636  $frm_noti->insertAdminForce();
637  }
638  }
639 
640  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
641  }
642 
643  $this->showMembers();
644  }
Class ilForumNotification.
+ Here is the call graph for this function:

◆ enableAdminForceNoti()

ilForumSettingsGUI::enableAdminForceNoti ( )

Definition at line 489 of file class.ilForumSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\lng(), ilForumNotification\setUserId(), and showMembers().

489  : void
490  {
491  if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
492  $this->error->raiseError(
493  $this->lng->txt('msg_no_perm_read'),
494  $this->error->MESSAGE
495  );
496  }
497 
498  $user_ids = [];
499  if ($this->dic->http()->wrapper()->post()->has('user_id')) {
500  $user_ids = $this->dic->http()->wrapper()->post()->retrieve(
501  'user_id',
502  $this->dic->refinery()->kindlyTo()->listOf($this->dic->refinery()->kindlyTo()->int())
503  );
504  }
505 
506  if (count($user_ids) === 0) {
507  $this->tpl->setOnScreenMessage('info', $this->lng->txt('time_limit_no_users_selected'), true);
508  } else {
509  $frm_noti = new ilForumNotification($this->forum->getRefId());
510 
511  foreach ($user_ids as $user_id) {
512  $frm_noti->setUserId((int) $user_id);
513  $frm_noti->setUserToggle(false);
514  $is_enabled = $frm_noti->isAdminForceNotification();
515 
516  if (!$is_enabled) {
517  $frm_noti->setAdminForce(true);
518  $frm_noti->insertAdminForce();
519  }
520  }
521 
522  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
523  }
524 
525  $this->showMembers();
526  }
Class ilForumNotification.
+ Here is the call graph for this function:

◆ enableHideUserToggleNoti()

ilForumSettingsGUI::enableHideUserToggleNoti ( )

Definition at line 565 of file class.ilForumSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\lng(), ilForumNotification\setUserId(), and showMembers().

565  : void
566  {
567  if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
568  $this->error->raiseError(
569  $this->lng->txt('msg_no_perm_read'),
570  $this->error->MESSAGE
571  );
572  }
573 
574  $user_ids = [];
575  if ($this->dic->http()->wrapper()->post()->has('user_id')) {
576  $user_ids = $this->dic->http()->wrapper()->post()->retrieve(
577  'user_id',
578  $this->dic->refinery()->kindlyTo()->listOf($this->dic->refinery()->kindlyTo()->int())
579  );
580  }
581 
582  if (count($user_ids) === 0) {
583  $this->tpl->setOnScreenMessage('info', $this->lng->txt('time_limit_no_users_selected'));
584  } else {
585  $frm_noti = new ilForumNotification($this->forum->getRefId());
586 
587  foreach ($user_ids as $user_id) {
588  $frm_noti->setUserId((int) $user_id);
589  $frm_noti->setUserToggle(true);
590  $is_enabled = $frm_noti->isAdminForceNotification();
591 
592  if ($is_enabled) {
593  $frm_noti->updateUserToggle();
594  } else {
595  $frm_noti->setAdminForce(true);
596  $frm_noti->insertAdminForce();
597  }
598  }
599 
600  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
601  }
602 
603  $this->showMembers();
604  }
Class ilForumNotification.
+ Here is the call graph for this function:

◆ executeCommand()

ilForumSettingsGUI::executeCommand ( )

Definition at line 76 of file class.ilForumSettingsGUI.php.

References ILIAS\Repository\ctrl(), and settingsTabs().

76  : void
77  {
78  $cmd = $this->ctrl->getCmd();
79 
80  switch (true) {
81  case method_exists($this, $cmd):
82  $this->settingsTabs();
83  $this->{$cmd}();
84  break;
85 
86  default:
87  $this->ctrl->redirect($this->parent_obj);
88  }
89  }
+ Here is the call graph for this function:

◆ getCustomForm()

ilForumSettingsGUI::getCustomForm ( ilPropertyFormGUI  $a_form)

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

References addAvailabilitySection(), ilPropertyFormGUI\addItem(), ilRadioGroupInputGUI\addOption(), ilForumProperties\isFileUploadGloballyAllowed(), ILIAS\Repository\lng(), ilFormPropertyGUI\setInfo(), ILIAS\Repository\settings(), settingsTabs(), ilPropertyFormGUI\setTitle(), ILIAS\Repository\tabs(), ilForumProperties\VIEW_DATE, ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

102  : void
103  {
104  $this->settingsTabs();
105  $this->tabs->activateSubTab(self::UI_SUB_TAB_ID_BASIC_SETTINGS);
106  $a_form->setTitle($this->lng->txt('frm_settings_form_header'));
107 
108  $this->addAvailabilitySection($a_form);
109 
110  $presentationHeader = new ilFormSectionHeaderGUI();
111  $presentationHeader->setTitle($this->lng->txt('settings_presentation_header'));
112  $a_form->addItem($presentationHeader);
113 
114  $this->obj_service->commonSettings()->legacyForm($a_form, $this->parent_obj->getObject())->addTileImage();
115 
116  $rg_pro = new ilRadioGroupInputGUI($this->lng->txt('frm_default_view'), 'default_view');
117  $option_view_by_posts = new ilRadioOption($this->lng->txt('sort_by_posts'), (string) ilForumProperties::VIEW_TREE);
118  $option_view_by_posts->setInfo($this->lng->txt('sort_by_posts_desc'));
119  $rg_pro->addOption($option_view_by_posts);
120  $option_view_by_date = new ilRadioOption($this->lng->txt('sort_by_date'), (string) ilForumProperties::VIEW_DATE);
121  $option_view_by_date->setInfo($this->lng->txt('sort_by_date_desc'));
122  $sub_group = new ilRadioGroupInputGUI('', 'default_view_by_date');
123  $sub_group->addOption(new ilRadioOption($this->lng->txt('ascending_order'), (string) ilForumProperties::VIEW_DATE_ASC));
124  $sub_group->addOption(new ilRadioOption($this->lng->txt('descending_order'), (string) ilForumProperties::VIEW_DATE_DESC));
125 
126  $option_view_by_date->addSubItem($sub_group);
127  $rg_pro->addOption($option_view_by_date);
128  $a_form->addItem($rg_pro);
129 
130  $userFunctionsHeader = new ilFormSectionHeaderGUI();
131  $userFunctionsHeader->setTitle($this->lng->txt('frm_settings_user_functions_header'));
132  $a_form->addItem($userFunctionsHeader);
133 
134  $frm_subject = new ilRadioGroupInputGUI($this->lng->txt('frm_subject_setting'), 'subject_setting');
135  $frm_subject->addOption(new ilRadioOption($this->lng->txt('preset_subject'), 'preset_subject'));
136  $frm_subject->addOption(new ilRadioOption($this->lng->txt('add_re_to_subject'), 'add_re_to_subject'));
137  $frm_subject->addOption(new ilRadioOption($this->lng->txt('empty_subject'), 'empty_subject'));
138  $a_form->addItem($frm_subject);
139 
140  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('enable_thread_ratings'), 'thread_rating');
141  $cb_prop->setValue('1');
142  $cb_prop->setInfo($this->lng->txt('enable_thread_ratings_info'));
143  $a_form->addItem($cb_prop);
144 
146  $frm_upload = new ilCheckboxInputGUI($this->lng->txt('file_upload_allowed'), 'file_upload_allowed');
147  $frm_upload->setValue('1');
148  $frm_upload->setInfo($this->lng->txt('allow_file_upload_desc'));
149  $a_form->addItem($frm_upload);
150  }
151 
152  $moderatorFunctionsHeader = new ilFormSectionHeaderGUI();
153  $moderatorFunctionsHeader->setTitle($this->lng->txt('frm_settings_mod_functions_header'));
154  $a_form->addItem($moderatorFunctionsHeader);
155 
156  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('activate_new_posts'), 'post_activation');
157  $cb_prop->setValue('1');
158  $cb_prop->setInfo($this->lng->txt('post_activation_desc'));
159  $a_form->addItem($cb_prop);
160 
161  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('mark_moderator_posts'), 'mark_mod_posts');
162  $cb_prop->setValue('1');
163  $cb_prop->setInfo($this->lng->txt('mark_moderator_posts_desc'));
164  $a_form->addItem($cb_prop);
165 
166  if ($this->settings->get('enable_anonymous_fora') || $this->settings->get('enable_fora_statistics')) {
167  $privacyHeader = new ilFormSectionHeaderGUI();
168  $privacyHeader->setTitle($this->lng->txt('frm_settings_privacy_header'));
169  $a_form->addItem($privacyHeader);
170  }
171 
172  if ($this->settings->get('enable_fora_statistics')) {
173  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('frm_statistics_enabled'), 'statistics_enabled');
174  $cb_prop->setValue('1');
175  $cb_prop->setInfo($this->lng->txt('frm_statistics_enabled_desc'));
176  $a_form->addItem($cb_prop);
177  }
178 
179  if ($this->settings->get('enable_anonymous_fora') || $this->parent_obj->objProperties->isAnonymized()) {
180  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('frm_anonymous_posting'), 'anonymized');
181  $cb_prop->setValue('1');
182  $cb_prop->setInfo($this->lng->txt('frm_anonymous_posting_desc'));
183  $a_form->addItem($cb_prop);
184  }
185  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addOption(ilRadioOption $a_option)
addAvailabilitySection(ilPropertyFormGUI $form)
This class represents a property in a property form.
+ Here is the call graph for this function:

◆ getCustomValues()

ilForumSettingsGUI::getCustomValues ( array &  $a_values)

Definition at line 235 of file class.ilForumSettingsGUI.php.

References ilForumProperties\VIEW_DATE, ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

235  : void
236  {
237  $a_values['anonymized'] = $this->parent_obj->objProperties->isAnonymized();
238  $a_values['statistics_enabled'] = $this->parent_obj->objProperties->isStatisticEnabled();
239  $a_values['post_activation'] = $this->parent_obj->objProperties->isPostActivationEnabled();
240  $a_values['subject_setting'] = $this->parent_obj->objProperties->getSubjectSetting();
241  $a_values['mark_mod_posts'] = $this->parent_obj->objProperties->getMarkModeratorPosts();
242  $a_values['thread_rating'] = $this->parent_obj->objProperties->isIsThreadRatingEnabled();
243 
244  $default_view_value = $this->parent_obj->objProperties->getDefaultView();
245  if (in_array($default_view_value, [
250  ], true)) {
251  if (in_array($default_view_value, [
254  ], true)) {
255  $default_view_by_date = $default_view_value;
256  $default_view = ilForumProperties::VIEW_DATE;
257  } else {
258  $default_view = $default_view_value;
259  }
260  } else {
261  $default_view = ilForumProperties::VIEW_TREE;
262  }
263 
264  $a_values['default_view'] = $default_view;
265  if (isset($default_view_by_date)) {
266  $a_values['default_view_by_date'] = $default_view_by_date;
267  }
268  $a_values['file_upload_allowed'] = $this->parent_obj->objProperties->getFileUploadAllowed();
269 
270  $object = $this->parent_obj->getObject();
271  $a_values['activation_online'] = !$object->getOfflineStatus();
272  }

◆ getRefId()

ilForumSettingsGUI::getRefId ( )

Definition at line 65 of file class.ilForumSettingsGUI.php.

Referenced by ilForumNotificationTableGUI\__construct().

65  : int
66  {
67  return $this->forum->getRefId();
68  }
+ Here is the caller graph for this function:

◆ getUserNotificationTableData()

ilForumSettingsGUI::getUserNotificationTableData ( array  $user_ids)
private
Parameters
int[]$user_ids
Returns
array

Definition at line 403 of file class.ilForumSettingsGUI.php.

References ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), and ilLegacyFormElementsUtil\formCheckbox().

Referenced by showMembers().

403  : array
404  {
405  $counter = 0;
406  $users = [];
407  foreach ($user_ids as $user_id) {
408  $forced_events = $this->forumNotificationObj->getForcedEventsObjectByUserId($user_id);
409 
410  $users[$counter]['user_id'] = ilLegacyFormElementsUtil::formCheckbox(false, 'user_id[]', (string) $user_id);
411  $users[$counter]['login'] = ilObjUser::_lookupLogin($user_id);
412  $name = ilObjUser::_lookupName($user_id);
413  $users[$counter]['firstname'] = $name['firstname'];
414  $users[$counter]['lastname'] = $name['lastname'];
415  $users[$counter]['user_toggle_noti'] = $forced_events->getUserToggle();
416  $users[$counter]['notification_id'] = $forced_events->getNotificationId();
417  $users[$counter]['interested_events'] = $forced_events->getInterestedEvents();
418  $users[$counter]['usr_id_events'] = $user_id;
419  $users[$counter]['forum_id'] = $forced_events->getForumId();
420 
421  $counter++;
422  }
423  return $users;
424  }
static _lookupName(int $a_user_id)
lookup user name
static formCheckbox(bool $checked, string $varname, string $value, bool $disabled=false)
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForcedForumNotification()

ilForumSettingsGUI::initForcedForumNotification ( )
private

Definition at line 70 of file class.ilForumSettingsGUI.php.

References ilForumNotification\readAllForcedEvents().

Referenced by showMembers().

70  : void
71  {
72  $this->forumNotificationObj = new ilForumNotification($this->forum->getRefId());
73  $this->forumNotificationObj->readAllForcedEvents();
74  }
Class ilForumNotification.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initNotificationSettingsForm()

ilForumSettingsGUI::initNotificationSettingsForm ( )
private

Definition at line 646 of file class.ilForumSettingsGUI.php.

References ilRadioOption\addSubItem(), ilForumNotificationEvents\CENSORED, ILIAS\Repository\ctrl(), ILIAS\Forum\Notification\DEFAULT, ILIAS\Repository\lng(), ilForumNotificationEvents\POST_DELETED, ilForumNotificationEvents\THREAD_DELETED, ilForumNotificationEvents\UNCENSORED, and ilForumNotificationEvents\UPDATED.

Referenced by showMembers(), and updateNotificationSettings().

646  : bool
647  {
648  if ($this->notificationSettingsForm === null) {
649  $form = new ilPropertyFormGUI();
650  $form->setFormAction($this->ctrl->getFormAction($this, 'updateNotificationSettings'));
651  $form->setTitle($this->lng->txt('forums_notification_settings'));
652 
653  $radio_grp = new ilRadioGroupInputGUI('', 'notification_type');
654  $radio_grp->setValue('default');
655 
656  $opt_default = new ilRadioOption(
657  $this->lng->txt('user_decides_notification'),
659  );
660  $opt_0 = new ilRadioOption($this->lng->txt('settings_for_all_members'), NotificationType::ALL_USERS->value);
661  $opt_1 = new ilRadioOption($this->lng->txt('settings_per_users'), NotificationType::PER_USER->value);
662 
663  $radio_grp->addOption($opt_default);
664  $radio_grp->addOption($opt_0);
665  $radio_grp->addOption($opt_1);
666 
667  $chb_2 = new ilCheckboxInputGUI($this->lng->txt('user_toggle_noti'), 'usr_toggle');
668  $chb_2->setValue('1');
669 
670  $opt_0->addSubItem($chb_2);
671 
672  $cb_grp = new ilCheckboxGroupInputGUI($this->lng->txt('notification_settings'), 'notification_events');
673 
674  $notify_modified = new ilCheckboxOption($this->lng->txt('notify_modified'), (string) ilForumNotificationEvents::UPDATED);
675  $cb_grp->addOption($notify_modified);
676 
677  $notify_censored = new ilCheckboxOption($this->lng->txt('notify_censored'), (string) ilForumNotificationEvents::CENSORED);
678  $cb_grp->addOption($notify_censored);
679 
680  $notify_uncensored = new ilCheckboxOption($this->lng->txt('notify_uncensored'), (string) ilForumNotificationEvents::UNCENSORED);
681  $cb_grp->addOption($notify_uncensored);
682 
683  $notify_post_deleted = new ilCheckboxOption($this->lng->txt('notify_post_deleted'), (string) ilForumNotificationEvents::POST_DELETED);
684  $cb_grp->addOption($notify_post_deleted);
685 
686  $notify_thread_deleted = new ilCheckboxOption($this->lng->txt('notify_thread_deleted'), (string) ilForumNotificationEvents::THREAD_DELETED);
687  $cb_grp->addOption($notify_thread_deleted);
688  $opt_0->addSubItem($cb_grp);
689 
690  $form->addItem($radio_grp);
691 
692  $form->addCommandButton('updateNotificationSettings', $this->lng->txt('save'));
693 
694  $this->notificationSettingsForm = $form;
695 
696  return false;
697  }
698 
699  return true;
700  }
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...
This class represents a property in a property form.
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:
+ Here is the caller graph for this function:

◆ saveEventsForUser()

ilForumSettingsGUI::saveEventsForUser ( )

Definition at line 442 of file class.ilForumSettingsGUI.php.

References $lng, $ui_factory, ILIAS\Repository\access(), ilForumNotificationEventsFormGUI\build(), ILIAS\Repository\ctrl(), ilForumNotificationEvents\DEACTIVATED, ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilForumNotification\setUserId(), and showMembers().

442  : void
443  {
444  if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
445  $this->error->raiseError(
446  $this->lng->txt('msg_no_perm_read'),
447  $this->error->MESSAGE
448  );
449  }
450 
451  $events_form_builder = new ilForumNotificationEventsFormGUI(
452  $this->ctrl->getFormAction($this, 'saveEventsForUser'),
453  null,
455  $this->lng
456  );
457 
458  if ($this->http->request()->getMethod() === 'POST') {
459  $form = $events_form_builder->build()->withRequest($this->http->request());
460  $formData = $form->getData();
461 
462  $interested_events = ilForumNotificationEvents::DEACTIVATED;
463 
464  foreach ($events_form_builder->getValidEvents() as $event) {
465  $interested_events += isset($formData[$event]) && $formData[$event] ? $events_form_builder->getValueForEvent(
466  $event
467  ) : 0;
468  }
469 
470  if (isset($formData['hidden_value']) && $formData['hidden_value']) {
471  $hidden_value = json_decode($formData['hidden_value'], false, 512, JSON_THROW_ON_ERROR);
472  $valid_usr_ids = $this->forum->getAllForumParticipants();
473 
474  if (in_array($hidden_value->usr_id, $valid_usr_ids)) {
475  $frm_noti = new ilForumNotification($this->parent_obj->getRefId());
476  $frm_noti->setUserId($hidden_value->usr_id);
477  $frm_noti->setForumId($this->forum->getId());
478  $frm_noti->setInterestedEvents($interested_events);
479  $frm_noti->updateInterestedEvents();
480  }
481  }
482  }
483 
484  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
485 
486  $this->showMembers();
487  }
Class ilForumNotification.
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ settingsTabs()

ilForumSettingsGUI::settingsTabs ( )

Definition at line 187 of file class.ilForumSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\settings(), and ILIAS\Repository\tabs().

Referenced by executeCommand(), getCustomForm(), and ilObjForumGUI\getSafePostCommands().

187  : bool
188  {
189  $this->tabs->addSubTabTarget(
190  self::UI_SUB_TAB_ID_BASIC_SETTINGS,
191  $this->ctrl->getLinkTarget($this->parent_obj, 'edit'),
192  '',
193  [strtolower(ilObjForumGUI::class)]
194  );
195 
196  if ($this->settings->get('forum_notification') > 0 &&
197  $this->forum->isParentMembershipEnabledContainer() &&
198  $this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
199  $cmd = $this->dic->http()->wrapper()->query()->retrieve(
200  'cmd',
201  $this->dic->refinery()->byTrying([
202  $this->dic->refinery()->kindlyTo()->string(),
203  $this->dic->refinery()->always('showMembers')
204  ])
205  );
206  $this->tabs->addSubTabTarget(
207  self::UI_SUB_TAB_ID_NOTIFICATIONS,
208  $this->ctrl->getLinkTarget($this, 'showMembers'),
209  '',
210  [strtolower(self::class)],
211  '',
212  in_array($cmd, ['showMembers', 'forums_notification_settings'], true)
213  );
214  }
215 
216  $this->tabs->addSubTabTarget(
217  self::UI_SUB_TAB_ID_NEWS,
218  $this->ctrl->getLinkTargetByClass(ilContainerNewsSettingsGUI::class),
219  '',
220  [strtolower(ilContainerNewsSettingsGUI::class)]
221  );
222 
223  $this->tabs->addSubTabTarget(
224  self::UI_SUB_TAB_ID_STYLE,
225  $this->ctrl->getLinkTargetByClass(strtolower(ilObjectContentStyleSettingsGUI::class), ""),
226  '',
227  [strtolower(ilObjectContentStyleSettingsGUI::class)]
228  );
229 
230  $this->tabs->activateTab(self::UI_TAB_ID_SETTINGS);
231 
232  return true;
233  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMembers()

ilForumSettingsGUI::showMembers ( )

Definition at line 326 of file class.ilForumSettingsGUI.php.

References ilForum\_getModerators(), ILIAS\Repository\access(), ilForumNotificationEvents\CENSORED, ILIAS\Forum\Notification\DEFAULT, getUserNotificationTableData(), initForcedForumNotification(), initNotificationSettingsForm(), ILIAS\Repository\lng(), ilForumNotificationEvents\POST_DELETED, ilForumNotification\setAdminForce(), showMembersTable(), ilForumNotificationEvents\THREAD_DELETED, ilForumNotificationEvents\UNCENSORED, and ilForumNotificationEvents\UPDATED.

Referenced by disableAdminForceNoti(), disableHideUserToggleNoti(), enableAdminForceNoti(), enableHideUserToggleNoti(), saveEventsForUser(), and updateNotificationSettings().

326  : void
327  {
328  if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
329  $this->error->raiseError(
330  $this->lng->txt('msg_no_perm_read'),
331  $this->error->MESSAGE
332  );
333  }
334 
335  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_members_list.html', 'Modules/Forum');
336 
337  // instantiate the property form
338  if (!$this->initNotificationSettingsForm()) {
339  // if the form was just created set the values fetched from database
340  $interested_events = $this->parent_obj->objProperties->getInterestedEvents();
341 
342  $form_events = [];
343  if (($interested_events & ilForumNotificationEvents::UPDATED) !== 0) {
344  $form_events[] = ilForumNotificationEvents::UPDATED;
345  }
346 
347  if (($interested_events & ilForumNotificationEvents::CENSORED) !== 0) {
348  $form_events[] = ilForumNotificationEvents::CENSORED;
349  }
350 
351  if (($interested_events & ilForumNotificationEvents::UNCENSORED) !== 0) {
352  $form_events[] = ilForumNotificationEvents::UNCENSORED;
353  }
354 
355  if (($interested_events & ilForumNotificationEvents::POST_DELETED) !== 0) {
357  }
358 
359  if (($interested_events & ilForumNotificationEvents::THREAD_DELETED) !== 0) {
361  }
362 
363  $this->notificationSettingsForm->setValuesByArray([
364  'notification_type' => $this->parent_obj->objProperties->getNotificationType()->value,
365  'adm_force' => $this->parent_obj->objProperties->isAdminForceNoti(),
366  'usr_toggle' => $this->parent_obj->objProperties->isUserToggleNoti(),
367  'notification_events' => $form_events
368  ]);
369  }
370 
371  $this->tpl->setVariable('NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
372 
373  $moderator_ids = ilForum::_getModerators($this->forum->getRefId());
374 
375  $participants = $this->forum->parentParticipants();
376  $admin_ids = $participants->getAdmins();
377  $member_ids = $participants->getMembers();
378  $tutor_ids = $participants->getTutors();
379 
380  if ($this->parent_obj->objProperties->getNotificationType() === NotificationType::DEFAULT) {
381  $forum_noti = new ilForumNotification($this->forum->getRefId());
382  $forum_noti->setAdminForce($this->parent_obj->objProperties->isAdminForceNoti());
383  $forum_noti->setUserToggle($this->parent_obj->objProperties->isUserToggleNoti());
384  $forum_noti->setForumId($this->parent_obj->objProperties->getObjId());
385  $forum_noti->setInterestedEvents($this->parent_obj->objProperties->getInterestedEvents());
386  $forum_noti->update();
387  } elseif ($this->parent_obj->objProperties->getNotificationType() === NotificationType::PER_USER) {
389 
390  $moderators = $this->getUserNotificationTableData($moderator_ids);
391  $admins = $this->getUserNotificationTableData($admin_ids);
392  $members = $this->getUserNotificationTableData($member_ids);
393  $tutors = $this->getUserNotificationTableData($tutor_ids);
394 
395  $this->showMembersTable($moderators, $admins, $members, $tutors);
396  }
397  }
showMembersTable(array $moderators, array $admins, array $members, array $tutors)
Class ilForumNotification.
setAdminForce(bool $a_admin_force)
static _getModerators(int $a_ref_id)
getUserNotificationTableData(array $user_ids)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMembersTable()

ilForumSettingsGUI::showMembersTable ( array  $moderators,
array  $admins,
array  $members,
array  $tutors 
)
private

Definition at line 426 of file class.ilForumSettingsGUI.php.

References $data.

Referenced by showMembers().

426  : void
427  {
428  foreach (array_filter([
429  'moderators' => $moderators,
430  'administrator' => $admins,
431  'tutors' => $tutors,
432  'members' => $members
433  ]) as $type => $data) {
434  $tbl = new ilForumNotificationTableGUI($this, 'showMembers', $type);
435  $tbl->setData($data);
436 
437  $this->tpl->setCurrentBlock(strtolower($type) . '_table');
438  $this->tpl->setVariable(strtoupper($type), $tbl->getHTML());
439  }
440  }
Class ilForumNotificationTableGUI.
+ Here is the caller graph for this function:

◆ updateCustomValues()

ilForumSettingsGUI::updateCustomValues ( ilPropertyFormGUI  $a_form)

Definition at line 274 of file class.ilForumSettingsGUI.php.

References ilSession\get(), ilPropertyFormGUI\getInput(), ILIAS\Repository\int(), ilForumProperties\isFileUploadGloballyAllowed(), ilSession\set(), ILIAS\Repository\settings(), ilForumProperties\VIEW_DATE, ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

274  : void
275  {
276  $default_view_input_value = (int) $a_form->getInput('default_view');
277  if (in_array($default_view_input_value, [
282  ], true)) {
283  if ($default_view_input_value === ilForumProperties::VIEW_DATE) {
284  $default_view_order_by_date_value = (int) $a_form->getInput('default_view_by_date');
285  if (in_array($default_view_order_by_date_value, [
288  ], true)) {
289  $default_view_input_value = $default_view_order_by_date_value;
290  }
291  }
292  $default_view = $default_view_input_value;
293  } else {
294  $default_view = ilForumProperties::VIEW_TREE;
295  }
296  $this->parent_obj->objProperties->setDefaultView($default_view);
297 
298  // BUGFIX FOR 11271
299 
300  $view_mode = 'viewmode_' . $this->forum->getId();
301  if (ilSession::get($view_mode)) {
302  ilSession::set($view_mode, $default_view);
303  }
304 
305  if ($this->settings->get('enable_anonymous_fora') || $this->parent_obj->objProperties->isAnonymized()) {
306  $this->parent_obj->objProperties->setAnonymisation((bool) $a_form->getInput('anonymized'));
307  }
308  if ($this->settings->get('enable_fora_statistics')) {
309  $this->parent_obj->objProperties->setStatisticsStatus((bool) $a_form->getInput('statistics_enabled'));
310  }
311  $this->parent_obj->objProperties->setPostActivation((bool) $a_form->getInput('post_activation'));
312  $this->parent_obj->objProperties->setSubjectSetting($a_form->getInput('subject_setting'));
313  $this->parent_obj->objProperties->setMarkModeratorPosts((bool) $a_form->getInput('mark_mod_posts'));
314  $this->parent_obj->objProperties->setIsThreadRatingEnabled((bool) $a_form->getInput('thread_rating'));
316  $this->parent_obj->objProperties->setFileUploadAllowed((bool) $a_form->getInput('file_upload_allowed'));
317  }
318  $this->parent_obj->objProperties->update();
319  $this->obj_service->commonSettings()->legacyForm($a_form, $this->parent_obj->getObject())->saveTileImage();
320 
321  $object = $this->parent_obj->getObject();
322  $object->setOfflineStatus(!(bool) $a_form->getInput('activation_online'));
323  $object->update();
324  }
static get(string $a_var)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ updateNotificationSettings()

ilForumSettingsGUI::updateNotificationSettings ( )

Definition at line 702 of file class.ilForumSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Forum\Notification\DEFAULT, ilForumProperties\getInstance(), initNotificationSettingsForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and showMembers().

702  : void
703  {
704  if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
705  $this->error->raiseError(
706  $this->lng->txt('msg_no_perm_read'),
707  $this->error->MESSAGE
708  );
709  }
710 
712 
713  $frm_noti = new ilForumNotification($this->forum->getRefId());
714  if ($this->notificationSettingsForm->checkInput()) {
715  $notification_type = NotificationType::tryFrom($this->dic->http()->wrapper()->post()->retrieve(
716  'notification_type',
717  $this->dic->refinery()->byTrying([
718  $this->dic->refinery()->kindlyTo()->string(),
719  $this->dic->refinery()->always(NotificationType::DEFAULT->value)
720  ])
722 
723  if ($notification_type === NotificationType::ALL_USERS) {
724  $notification_events = $this->notificationSettingsForm->getInput('notification_events');
725  $interested_events = 0;
726 
727  if (is_array($notification_events)) {
728  foreach ($notification_events as $activated_event) {
729  $interested_events += (int) $activated_event;
730  }
731  }
732 
733  $this->parent_obj->objProperties->setAdminForceNoti(true);
734  $this->parent_obj->objProperties->setUserToggleNoti(
735  (bool) $this->notificationSettingsForm->getInput('usr_toggle')
736  );
737  $this->parent_obj->objProperties->setNotificationType(NotificationType::ALL_USERS);
738  $this->parent_obj->objProperties->setInterestedEvents($interested_events);
739  } elseif ($notification_type === NotificationType::PER_USER) {
740  $this->parent_obj->objProperties->setNotificationType(NotificationType::PER_USER);
741  $this->parent_obj->objProperties->setAdminForceNoti(true);
742  $this->parent_obj->objProperties->setUserToggleNoti(false);
743  } else {
744  $this->parent_obj->objProperties->setNotificationType(NotificationType::DEFAULT);
745  $this->parent_obj->objProperties->setAdminForceNoti(false);
746  $this->parent_obj->objProperties->setUserToggleNoti(false);
747  $frm_noti->deleteNotificationAllUsers();
748  }
749  $properties = ilForumProperties::getInstance($this->forum->getId());
750  $frm_noti->updateUserNotifications($this->forum->getAllForumParticipants(), $properties);
751 
752  $this->parent_obj->objProperties->update();
753 
754  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
755  }
756  $this->notificationSettingsForm->setValuesByPost();
757 
758  $this->showMembers();
759  }
Class ilForumNotification.
static getInstance(int $a_obj_id=0)
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilForumSettingsGUI::$access
private

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

◆ $ctrl

ilCtrlInterface ilForumSettingsGUI::$ctrl
private

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

◆ $dic

ILIAS DI Container ilForumSettingsGUI::$dic
private

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

◆ $error

ilErrorHandling ilForumSettingsGUI::$error
private

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

◆ $forumNotificationObj

ilForumNotification ilForumSettingsGUI::$forumNotificationObj
private

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

◆ $http

ILIAS HTTP GlobalHttpState ilForumSettingsGUI::$http
private

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

◆ $lng

ilLanguage ilForumSettingsGUI::$lng
private

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

Referenced by saveEventsForUser().

◆ $notificationSettingsForm

ilPropertyFormGUI ilForumSettingsGUI::$notificationSettingsForm = null
private

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

◆ $obj_service

ilObjectService ilForumSettingsGUI::$obj_service
private

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

◆ $settings

ilSetting ilForumSettingsGUI::$settings
private

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

◆ $tabs

ilTabsGUI ilForumSettingsGUI::$tabs
private

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

◆ $tpl

ilGlobalTemplateInterface ilForumSettingsGUI::$tpl
private

Definition at line 31 of file class.ilForumSettingsGUI.php.

◆ $ui_factory

ILIAS UI Factory ilForumSettingsGUI::$ui_factory
private

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

Referenced by saveEventsForUser().


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