ILIAS  release_8 Revision v8.24
ilForumSettingsGUI Class Reference

Class ilForumSettingsGUI. More...

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

Public Member Functions

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

Private Member Functions

 initForcedForumNotification ()
 
 addAvailabilitySection (ilPropertyFormGUI $form)
 
 getUserNotificationTableData ($user_ids)
 
 showMembersTable (array $moderators, array $admins, array $members, array $tutors)
 
 updateUserNotifications (bool $update_all_users=false)
 
 initNotificationSettingsForm ()
 

Private Attributes

ilCtrlInterface $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilSetting $settings
 
ilTabsGUI $tabs
 
ilAccessHandler $access
 
ilTree $tree
 
ilObjForumGUI $parent_obj
 
ILIAS HTTP GlobalHttpState $http
 
ILIAS Refinery Factory $refinery
 
ilForumNotification $forumNotificationObj
 
ilPropertyFormGUI $notificationSettingsForm = null
 
int $ref_id
 
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 ( ilObjForumGUI  $parent_obj)

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

47 {
48 global $DIC;
49
50 $this->dic = $DIC;
51 $this->parent_obj = $parent_obj;
52
53 $this->ctrl = $DIC->ctrl();
54 $this->tpl = $DIC->ui()->mainTemplate();
55 $this->lng = $DIC->language();
56 $this->settings = $DIC->settings();
57 $this->tabs = $DIC->tabs();
58 $this->access = $DIC->access();
59 $this->tree = $DIC->repositoryTree();
60 $this->obj_service = $this->dic->object();
61 $this->ref_id = $this->parent_obj->getObject()->getRefId();
62 $this->http = $DIC->http();
63 $this->ui_factory = $DIC->ui()->factory();
64 $this->refinery = $DIC->refinery();
65 $this->error = $DIC['ilErr'];
66
67 $this->lng->loadLanguageModule('style');
68 $this->lng->loadLanguageModule('cont');
69 }
error(string $a_errmsg)
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addAvailabilitySection()

ilForumSettingsGUI::addAvailabilitySection ( ilPropertyFormGUI  $form)
private

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

101 : void
102 {
103 $section = new ilFormSectionHeaderGUI();
104 $section->setTitle($this->lng->txt('rep_activation_availability'));
105 $form->addItem($section);
106
107 $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'activation_online');
108 $online->setInfo($this->lng->txt('frm_activation_online_info'));
109 $form->addItem($online);
110 }
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

Referenced by getCustomForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disableAdminForceNoti()

ilForumSettingsGUI::disableAdminForceNoti ( )

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

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

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

+ Here is the call graph for this function:

◆ disableHideUserToggleNoti()

ilForumSettingsGUI::disableHideUserToggleNoti ( )

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

647 : void
648 {
649 if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
650 $this->error->raiseError(
651 $this->lng->txt('msg_no_perm_read'),
652 $this->error->MESSAGE
653 );
654 }
655
656 $user_ids = [];
657 if ($this->dic->http()->wrapper()->post()->has('user_id')) {
658 $user_ids = $this->dic->http()->wrapper()->post()->retrieve(
659 'user_id',
660 $this->dic->refinery()->kindlyTo()->listOf($this->dic->refinery()->kindlyTo()->int())
661 );
662 }
663
664 if (count($user_ids) === 0) {
665 $this->tpl->setOnScreenMessage('info', $this->lng->txt('time_limit_no_users_selected'));
666 } else {
667 $frm_noti = new ilForumNotification($this->parent_obj->getObject()->getRefId());
668
669 foreach ($user_ids as $user_id) {
670 $frm_noti->setUserId((int) $user_id);
671 $frm_noti->setUserToggle(false);
672 $is_enabled = $frm_noti->isAdminForceNotification();
673 if ($is_enabled) {
674 $frm_noti->updateUserToggle();
675 } else {
676 $frm_noti->setAdminForce(true);
677 $frm_noti->insertAdminForce();
678 }
679 }
680
681 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
682 }
683
684 $this->showMembers();
685 }

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

+ Here is the call graph for this function:

◆ enableAdminForceNoti()

ilForumSettingsGUI::enableAdminForceNoti ( )

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

530 : void
531 {
532 if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
533 $this->error->raiseError(
534 $this->lng->txt('msg_no_perm_read'),
535 $this->error->MESSAGE
536 );
537 }
538
539 $user_ids = [];
540 if ($this->dic->http()->wrapper()->post()->has('user_id')) {
541 $user_ids = $this->dic->http()->wrapper()->post()->retrieve(
542 'user_id',
543 $this->dic->refinery()->kindlyTo()->listOf($this->dic->refinery()->kindlyTo()->int())
544 );
545 }
546
547 if (count($user_ids) === 0) {
548 $this->tpl->setOnScreenMessage('info', $this->lng->txt('time_limit_no_users_selected'), true);
549 } else {
550 $frm_noti = new ilForumNotification($this->parent_obj->getObject()->getRefId());
551
552 foreach ($user_ids as $user_id) {
553 $frm_noti->setUserId((int) $user_id);
554 $frm_noti->setUserToggle(false);
555 $is_enabled = $frm_noti->isAdminForceNotification();
556
557 if (!$is_enabled) {
558 $frm_noti->setAdminForce(true);
559 $frm_noti->insertAdminForce();
560 }
561 }
562
563 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
564 }
565
566 $this->showMembers();
567 }

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

+ Here is the call graph for this function:

◆ enableHideUserToggleNoti()

ilForumSettingsGUI::enableHideUserToggleNoti ( )

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

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->parent_obj->getObject()->getRefId());
627
628 foreach ($user_ids as $user_id) {
629 $frm_noti->setUserId((int) $user_id);
630 $frm_noti->setUserToggle(true);
631 $is_enabled = $frm_noti->isAdminForceNotification();
632
633 if (!$is_enabled) {
634 $frm_noti->setAdminForce(true);
635 $frm_noti->insertAdminForce();
636 } else {
637 $frm_noti->updateUserToggle();
638 }
639 }
640
641 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
642 }
643
644 $this->showMembers();
645 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilForumSettingsGUI::executeCommand ( )

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

82 : void
83 {
84 $cmd = $this->ctrl->getCmd();
85 $next_class = $this->ctrl->getNextClass();
86
87 switch (strtolower($next_class)) {
88 default:
89 switch (true) {
90 case method_exists($this, $cmd):
91 $this->settingsTabs();
92 $this->{$cmd}();
93 break;
94
95 default:
96 $this->ctrl->redirect($this->parent_obj);
97 }
98 }
99 }

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

+ Here is the call graph for this function:

◆ getCustomForm()

ilForumSettingsGUI::getCustomForm ( ilPropertyFormGUI  $a_form)

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

112 : void
113 {
114 $this->settingsTabs();
115 $this->tabs->activateSubTab(self::UI_SUB_TAB_ID_BASIC_SETTINGS);
116 $a_form->setTitle($this->lng->txt('frm_settings_form_header'));
117
118 $this->addAvailabilitySection($a_form);
119
120 $presentationHeader = new ilFormSectionHeaderGUI();
121 $presentationHeader->setTitle($this->lng->txt('settings_presentation_header'));
122 $a_form->addItem($presentationHeader);
123
124 $this->obj_service->commonSettings()->legacyForm($a_form, $this->parent_obj->getObject())->addTileImage();
125
126 $rg_pro = new ilRadioGroupInputGUI($this->lng->txt('frm_default_view'), 'default_view');
127 $option_view_by_posts = new ilRadioOption($this->lng->txt('sort_by_posts'), (string) ilForumProperties::VIEW_TREE);
128 $option_view_by_posts->setInfo($this->lng->txt('sort_by_posts_desc'));
129 $rg_pro->addOption($option_view_by_posts);
130 $option_view_by_date = new ilRadioOption($this->lng->txt('sort_by_date'), (string) ilForumProperties::VIEW_DATE);
131 $option_view_by_date->setInfo($this->lng->txt('sort_by_date_desc'));
132 $sub_group = new ilRadioGroupInputGUI('', 'default_view_by_date');
133 $sub_group->addOption(new ilRadioOption($this->lng->txt('ascending_order'), (string) ilForumProperties::VIEW_DATE_ASC));
134 $sub_group->addOption(new ilRadioOption($this->lng->txt('descending_order'), (string) ilForumProperties::VIEW_DATE_DESC));
135
136 $option_view_by_date->addSubItem($sub_group);
137 $rg_pro->addOption($option_view_by_date);
138 $a_form->addItem($rg_pro);
139
140 $userFunctionsHeader = new ilFormSectionHeaderGUI();
141 $userFunctionsHeader->setTitle($this->lng->txt('frm_settings_user_functions_header'));
142 $a_form->addItem($userFunctionsHeader);
143
144 $frm_subject = new ilRadioGroupInputGUI($this->lng->txt('frm_subject_setting'), 'subject_setting');
145 $frm_subject->addOption(new ilRadioOption($this->lng->txt('preset_subject'), 'preset_subject'));
146 $frm_subject->addOption(new ilRadioOption($this->lng->txt('add_re_to_subject'), 'add_re_to_subject'));
147 $frm_subject->addOption(new ilRadioOption($this->lng->txt('empty_subject'), 'empty_subject'));
148 $a_form->addItem($frm_subject);
149
150 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('enable_thread_ratings'), 'thread_rating');
151 $cb_prop->setValue('1');
152 $cb_prop->setInfo($this->lng->txt('enable_thread_ratings_info'));
153 $a_form->addItem($cb_prop);
154
156 $frm_upload = new ilCheckboxInputGUI($this->lng->txt('file_upload_allowed'), 'file_upload_allowed');
157 $frm_upload->setValue('1');
158 $frm_upload->setInfo($this->lng->txt('allow_file_upload_desc'));
159 $a_form->addItem($frm_upload);
160 }
161
162 $moderatorFunctionsHeader = new ilFormSectionHeaderGUI();
163 $moderatorFunctionsHeader->setTitle($this->lng->txt('frm_settings_mod_functions_header'));
164 $a_form->addItem($moderatorFunctionsHeader);
165
166 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('activate_new_posts'), 'post_activation');
167 $cb_prop->setValue('1');
168 $cb_prop->setInfo($this->lng->txt('post_activation_desc'));
169 $a_form->addItem($cb_prop);
170
171 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('mark_moderator_posts'), 'mark_mod_posts');
172 $cb_prop->setValue('1');
173 $cb_prop->setInfo($this->lng->txt('mark_moderator_posts_desc'));
174 $a_form->addItem($cb_prop);
175
176 $stickyThreadSorting = new ilRadioGroupInputGUI($this->lng->txt('sorting_manual_sticky'), 'thread_sorting');
177 $latestAtTop = new ilRadioOption($this->lng->txt('frm_sticky_threads_latest_at_top'), '0');
178 $latestAtTop->setInfo($this->lng->txt('frm_sticky_threads_latest_at_top_info'));
179 $stickyThreadSorting->addOption($latestAtTop);
180 $manualSorting = new ilRadioOption($this->lng->txt('frm_sticky_threads_manual_sorting'), '1');
181 $manualSorting->setInfo($this->lng->txt('frm_sticky_threads_manual_sorting_info'));
182 $stickyThreadSorting->addOption($manualSorting);
183 $a_form->addItem($stickyThreadSorting);
184
185 if ($this->settings->get('enable_anonymous_fora') || $this->settings->get('enable_fora_statistics')) {
186 $privacyHeader = new ilFormSectionHeaderGUI();
187 $privacyHeader->setTitle($this->lng->txt('frm_settings_privacy_header'));
188 $a_form->addItem($privacyHeader);
189 }
190
191 if ($this->settings->get('enable_fora_statistics')) {
192 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('frm_statistics_enabled'), 'statistics_enabled');
193 $cb_prop->setValue('1');
194 $cb_prop->setInfo($this->lng->txt('frm_statistics_enabled_desc'));
195 $a_form->addItem($cb_prop);
196 }
197
198 if ($this->settings->get('enable_anonymous_fora') || $this->parent_obj->objProperties->isAnonymized()) {
199 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('frm_anonymous_posting'), 'anonymized');
200 $cb_prop->setValue('1');
201 $cb_prop->setInfo($this->lng->txt('frm_anonymous_posting_desc'));
202 $a_form->addItem($cb_prop);
203 }
204 }
addAvailabilitySection(ilPropertyFormGUI $form)
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...

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

+ Here is the call graph for this function:

◆ getCustomValues()

ilForumSettingsGUI::getCustomValues ( array &  $a_values)

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

268 : void
269 {
270 $a_values['anonymized'] = $this->parent_obj->objProperties->isAnonymized();
271 $a_values['statistics_enabled'] = $this->parent_obj->objProperties->isStatisticEnabled();
272 $a_values['post_activation'] = $this->parent_obj->objProperties->isPostActivationEnabled();
273 $a_values['subject_setting'] = $this->parent_obj->objProperties->getSubjectSetting();
274 $a_values['mark_mod_posts'] = $this->parent_obj->objProperties->getMarkModeratorPosts();
275 $a_values['thread_sorting'] = $this->parent_obj->objProperties->getThreadSorting();
276 $a_values['thread_rating'] = $this->parent_obj->objProperties->isIsThreadRatingEnabled();
277
278 $default_view_value = $this->parent_obj->objProperties->getDefaultView();
279 if (in_array($default_view_value, [
284 ], true)) {
285 if (in_array($default_view_value, [
288 ], true)) {
289 $default_view_by_date = $default_view_value;
290 $default_view = ilForumProperties::VIEW_DATE;
291 } else {
292 $default_view = $default_view_value;
293 }
294 } else {
295 $default_view = ilForumProperties::VIEW_TREE;
296 }
297
298 $a_values['default_view'] = $default_view;
299 if (isset($default_view_by_date)) {
300 $a_values['default_view_by_date'] = $default_view_by_date;
301 }
302 $a_values['file_upload_allowed'] = $this->parent_obj->objProperties->getFileUploadAllowed();
303
304 $object = $this->parent_obj->getObject();
305 $a_values['activation_online'] = $object->getOfflineStatus() === false;
306 }

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

◆ getParticipants()

ilForumSettingsGUI::getParticipants ( )

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

688 {
689 if (!$this->parent_obj->isParentObjectCrsOrGrp()) {
690 $this->error->raiseError(
691 $this->lng->txt('msg_no_perm_read'),
692 $this->error->MESSAGE
693 );
694 }
695
696 $grp_ref_id = $this->tree->checkForParentType($this->parent_obj->getObject()->getRefId(), 'grp');
697 if ($grp_ref_id > 0) {
700 }
701
702 $crs_ref_id = $this->tree->checkForParentType($this->parent_obj->getObject()->getRefId(), 'crs');
704
706 }
static _getInstanceByObjId(int $a_obj_id)
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
Base class for course and group participants.

References $parent_obj, ilCourseParticipants\_getInstanceByObjId(), ilGroupParticipants\_getInstanceByObjId(), error(), ilObjectFactory\getInstanceByRefId(), and ILIAS\Repository\lng().

Referenced by saveEventsForUser(), showMembers(), and updateUserNotifications().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRefId()

ilForumSettingsGUI::getRefId ( )

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

71 : int
72 {
73 return $this->ref_id;
74 }

References $ref_id.

Referenced by ilForumNotificationTableGUI\__construct().

+ Here is the caller graph for this function:

◆ getUserNotificationTableData()

ilForumSettingsGUI::getUserNotificationTableData (   $user_ids)
private

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

437 : array
438 {
439 $counter = 0;
440 $users = [];
441 foreach ($user_ids as $user_id) {
442 $forced_events = $this->forumNotificationObj->getForcedEventsObjectByUserId($user_id);
443
444 $users[$counter]['user_id'] = ilLegacyFormElementsUtil::formCheckbox(false, 'user_id[]', (string) $user_id);
445 $users[$counter]['login'] = ilObjUser::_lookupLogin($user_id);
446 $name = ilObjUser::_lookupName($user_id);
447 $users[$counter]['firstname'] = $name['firstname'];
448 $users[$counter]['lastname'] = $name['lastname'];
449 $users[$counter]['user_toggle_noti'] = $forced_events->getUserToggle();
450 $users[$counter]['notification_id'] = $forced_events->getNotificationId();
451 $users[$counter]['interested_events'] = $forced_events->getInterestedEvents();
452 $users[$counter]['usr_id_events'] = $user_id;
453 $users[$counter]['forum_id'] = $forced_events->getForumId();
454
455 $counter++;
456 }
457 return $users;
458 }
static formCheckbox(bool $checked, string $varname, string $value, bool $disabled=false)
static _lookupName(int $a_user_id)
lookup user name
static _lookupLogin(int $a_user_id)
if($format !==null) $name
Definition: metadata.php:247

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

Referenced by showMembers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForcedForumNotification()

ilForumSettingsGUI::initForcedForumNotification ( )
private

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

76 : void
77 {
78 $this->forumNotificationObj = new ilForumNotification($this->parent_obj->getObject()->getRefId());
79 $this->forumNotificationObj->readAllForcedEvents();
80 }

Referenced by showMembers().

+ Here is the caller graph for this function:

◆ initNotificationSettingsForm()

ilForumSettingsGUI::initNotificationSettingsForm ( )
private

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

739 : bool
740 {
741 if (null === $this->notificationSettingsForm) {
742 $form = new ilPropertyFormGUI();
743 $form->setFormAction($this->ctrl->getFormAction($this, 'updateNotificationSettings'));
744 $form->setTitle($this->lng->txt('forums_notification_settings'));
745
746 $radio_grp = new ilRadioGroupInputGUI('', 'notification_type');
747 $radio_grp->setValue('default');
748
749 $opt_default = new ilRadioOption($this->lng->txt("user_decides_notification"), 'default');
750 $opt_0 = new ilRadioOption($this->lng->txt("settings_for_all_members"), 'all_users');
751 $opt_1 = new ilRadioOption($this->lng->txt("settings_per_users"), 'per_user');
752
753 $radio_grp->addOption($opt_default);
754 $radio_grp->addOption($opt_0);
755 $radio_grp->addOption($opt_1);
756
757 $chb_2 = new ilCheckboxInputGUI($this->lng->txt('user_toggle_noti'), 'usr_toggle');
758 $chb_2->setValue('1');
759
760 $opt_0->addSubItem($chb_2);
761
762 $cb_grp = new ilCheckboxGroupInputGUI($this->lng->txt('notification_settings'), 'notification_events');
763
764 $notify_modified = new ilCheckboxOption($this->lng->txt('notify_modified'), (string) ilForumNotificationEvents::UPDATED);
765 $cb_grp->addOption($notify_modified);
766
767 $notify_censored = new ilCheckboxOption($this->lng->txt('notify_censored'), (string) ilForumNotificationEvents::CENSORED);
768 $cb_grp->addOption($notify_censored);
769
770 $notify_uncensored = new ilCheckboxOption($this->lng->txt('notify_uncensored'), (string) ilForumNotificationEvents::UNCENSORED);
771 $cb_grp->addOption($notify_uncensored);
772
773 $notify_post_deleted = new ilCheckboxOption($this->lng->txt('notify_post_deleted'), (string) ilForumNotificationEvents::POST_DELETED);
774 $cb_grp->addOption($notify_post_deleted);
775
776 $notify_thread_deleted = new ilCheckboxOption($this->lng->txt('notify_thread_deleted'), (string) ilForumNotificationEvents::THREAD_DELETED);
777 $cb_grp->addOption($notify_thread_deleted);
778 $opt_0->addSubItem($cb_grp);
779
780 $form->addItem($radio_grp);
781
782 $form->addCommandButton('updateNotificationSettings', $this->lng->txt('save'));
783
784 $this->notificationSettingsForm = $form;
785
786 return false;
787 }
788
789 return true;
790 }
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 form user interface.

References ilForumNotificationEvents\CENSORED, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilForumNotificationEvents\POST_DELETED, ilForumNotificationEvents\THREAD_DELETED, ilForumNotificationEvents\UNCENSORED, and ilForumNotificationEvents\UPDATED.

Referenced by showMembers(), and updateNotificationSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveEventsForUser()

ilForumSettingsGUI::saveEventsForUser ( )

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

476 : void
477 {
478 if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
479 $this->error->raiseError(
480 $this->lng->txt('msg_no_perm_read'),
481 $this->error->MESSAGE
482 );
483 }
484
485 $events_form_builder = new ilForumNotificationEventsFormGUI(
486 $this->ctrl->getFormAction($this, 'saveEventsForUser'),
487 null,
488 $this->ui_factory,
489 $this->lng
490 );
491
492 if ($this->http->request()->getMethod() === 'POST') {
493 $form = $events_form_builder->build()->withRequest($this->http->request());
494 $formData = $form->getData();
495
496 $interested_events = ilForumNotificationEvents::DEACTIVATED;
497
498 foreach ($events_form_builder->getValidEvents() as $event) {
499 $interested_events += isset($formData[$event]) && $formData[$event] ? $events_form_builder->getValueForEvent(
500 $event
501 ) : 0;
502 }
503
504 if (isset($formData['hidden_value']) && $formData['hidden_value']) {
505 $hidden_value = json_decode($formData['hidden_value'], false, 512, JSON_THROW_ON_ERROR);
506
507 $oParticipants = $this->getParticipants();
508 $moderator_ids = ilForum::_getModerators($this->parent_obj->getObject()->getRefId());
509 $admin_ids = $oParticipants->getAdmins();
510 $member_ids = $oParticipants->getMembers();
511 $tutor_ids = $oParticipants->getTutors();
512
513 $valid_usr_ids = array_unique(array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids));
514
515 if (in_array($hidden_value->usr_id, $valid_usr_ids)) {
516 $frm_noti = new ilForumNotification($this->parent_obj->getRefId());
517 $frm_noti->setUserId($hidden_value->usr_id);
518 $frm_noti->setForumId($this->parent_obj->getObject()->getId());
519 $frm_noti->setInterestedEvents($interested_events);
520 $frm_noti->updateInterestedEvents();
521 }
522 }
523 }
524
525 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
526
527 $this->showMembers();
528 }
static _getModerators(int $a_ref_id)

References ilForum\_getModerators(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilForumNotificationEvents\DEACTIVATED, error(), getParticipants(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and showMembers().

+ Here is the call graph for this function:

◆ settingsTabs()

ilForumSettingsGUI::settingsTabs ( )

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

206 : bool
207 {
208 $this->tabs->addSubTabTarget(
209 self::UI_SUB_TAB_ID_BASIC_SETTINGS,
210 $this->ctrl->getLinkTarget($this->parent_obj, 'edit'),
211 '',
212 [strtolower(ilObjForumGUI::class)]
213 );
214
215 if ($this->settings->get('forum_notification') > 0) {
216 // check if there a parent-node is a grp or crs
217 $grp_ref_id = $this->tree->checkForParentType($this->parent_obj->getRefId(), 'grp');
218 $crs_ref_id = $this->tree->checkForParentType($this->parent_obj->getRefId(), 'crs');
219
220 if ($grp_ref_id > 0 || $crs_ref_id > 0) {
221 #show member-tab for notification if forum-notification is enabled in administration
222 if ($this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
223 $cmd = '';
224 if ($this->dic->http()->wrapper()->query()->has('cmd')) {
225 $cmd = $this->dic->http()->wrapper()->query()->retrieve(
226 'cmd',
227 $this->dic->refinery()->kindlyTo()->string()
228 );
229 }
230
231 $mem_active = ['showMembers', 'forums_notification_settings'];
232 $force_mem_active = false;
233 if (in_array($cmd, $mem_active, true)) {
234 $force_mem_active = true;
235 }
236
237 $this->tabs->addSubTabTarget(
238 self::UI_SUB_TAB_ID_NOTIFICATIONS,
239 $this->ctrl->getLinkTarget($this, 'showMembers'),
240 '',
241 [strtolower(self::class)],
242 '',
243 $force_mem_active
244 );
245 }
246 }
247 }
248
249 $this->tabs->addSubTabTarget(
250 self::UI_SUB_TAB_ID_NEWS,
251 $this->ctrl->getLinkTargetByClass(ilContainerNewsSettingsGUI::class),
252 '',
253 [strtolower(ilContainerNewsSettingsGUI::class)]
254 );
255
256 $this->tabs->addSubTabTarget(
257 self::UI_SUB_TAB_ID_STYLE,
258 $this->ctrl->getLinkTargetByClass(strtolower(ilObjectContentStyleSettingsGUI::class), ""),
259 '',
260 [strtolower(ilObjectContentStyleSettingsGUI::class)]
261 );
262
263 $this->tabs->activateTab(self::UI_TAB_ID_SETTINGS);
264
265 return true;
266 }

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

Referenced by executeCommand(), and getCustomForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMembers()

ilForumSettingsGUI::showMembers ( )

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

360 : void
361 {
362 if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
363 $this->error->raiseError(
364 $this->lng->txt('msg_no_perm_read'),
365 $this->error->MESSAGE
366 );
367 }
368
369 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_members_list.html', 'Modules/Forum');
370
371 // instantiate the property form
372 if (!$this->initNotificationSettingsForm()) {
373 // if the form was just created set the values fetched from database
374 $interested_events = $this->parent_obj->objProperties->getInterestedEvents();
375
376 $form_events = [];
377 if ($interested_events & ilForumNotificationEvents::UPDATED) {
378 $form_events[] = ilForumNotificationEvents::UPDATED;
379 }
380
381 if ($interested_events & ilForumNotificationEvents::CENSORED) {
383 }
384
385 if ($interested_events & ilForumNotificationEvents::UNCENSORED) {
387 }
388
389 if ($interested_events & ilForumNotificationEvents::POST_DELETED) {
391 }
392
393 if ($interested_events & ilForumNotificationEvents::THREAD_DELETED) {
395 }
396
397 $this->notificationSettingsForm->setValuesByArray([
398 'notification_type' => $this->parent_obj->objProperties->getNotificationType(),
399 'adm_force' => $this->parent_obj->objProperties->isAdminForceNoti(),
400 'usr_toggle' => $this->parent_obj->objProperties->isUserToggleNoti(),
401 'notification_events' => $form_events
402 ]);
403 }
404
405 // set form html into template
406 $this->tpl->setVariable('NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
407
408 $frm_noti = new ilForumNotification($this->parent_obj->getObject()->getRefId());
409 $oParticipants = $this->getParticipants();
410
411 $moderator_ids = ilForum::_getModerators($this->parent_obj->getObject()->getRefId());
412
413 $admin_ids = $oParticipants->getAdmins();
414 $member_ids = $oParticipants->getMembers();
415 $tutor_ids = $oParticipants->getTutors();
416
417 if ($this->parent_obj->objProperties->getNotificationType() === 'default') {
418 // update forum_notification table
419 $forum_noti = new ilForumNotification($this->parent_obj->getObject()->getRefId());
420 $forum_noti->setAdminForce($this->parent_obj->objProperties->isAdminForceNoti());
421 $forum_noti->setUserToggle($this->parent_obj->objProperties->isUserToggleNoti());
422 $forum_noti->setForumId($this->parent_obj->objProperties->getObjId());
423 $forum_noti->setInterestedEvents($this->parent_obj->objProperties->getInterestedEvents());
424 $forum_noti->update();
425 } elseif ($this->parent_obj->objProperties->getNotificationType() === 'per_user') {
427
428 $moderators = $this->getUserNotificationTableData($moderator_ids);
429 $admins = $this->getUserNotificationTableData($admin_ids);
430 $members = $this->getUserNotificationTableData($member_ids);
431 $tutors = $this->getUserNotificationTableData($tutor_ids);
432
433 $this->showMembersTable($moderators, $admins, $members, $tutors);
434 }
435 }
showMembersTable(array $moderators, array $admins, array $members, array $tutors)

References ilForum\_getModerators(), ILIAS\Repository\access(), ilForumNotificationEvents\CENSORED, error(), getParticipants(), getUserNotificationTableData(), initForcedForumNotification(), initNotificationSettingsForm(), ILIAS\Repository\lng(), ilForumNotificationEvents\POST_DELETED, showMembersTable(), ilForumNotificationEvents\THREAD_DELETED, ilForumNotificationEvents\UNCENSORED, and ilForumNotificationEvents\UPDATED.

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

+ 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 460 of file class.ilForumSettingsGUI.php.

460 : void
461 {
462 foreach (array_filter([
463 'moderators' => $moderators,
464 'administrator' => $admins,
465 'tutors' => $tutors,
466 'members' => $members
467 ]) as $type => $data) {
468 $tbl = new ilForumNotificationTableGUI($this, 'showMembers', $type);
469 $tbl->setData($data);
470
471 $this->tpl->setCurrentBlock(strtolower($type) . '_table');
472 $this->tpl->setVariable(strtoupper($type), $tbl->getHTML());
473 }
474 }
Class ilForumNotificationTableGUI.
$type

References $data, and $type.

Referenced by showMembers().

+ Here is the caller graph for this function:

◆ updateCustomValues()

ilForumSettingsGUI::updateCustomValues ( ilPropertyFormGUI  $a_form)

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

308 : void
309 {
310 $default_view_input_value = (int) $a_form->getInput('default_view');
311 if (in_array($default_view_input_value, [
316 ], true)) {
317 if ($default_view_input_value === ilForumProperties::VIEW_DATE) {
318 $default_view_order_by_date_value = (int) $a_form->getInput('default_view_by_date');
319 if (in_array($default_view_order_by_date_value, [
322 ], true)) {
323 $default_view_input_value = $default_view_order_by_date_value;
324 }
325 }
326 $default_view = $default_view_input_value;
327 } else {
328 $default_view = ilForumProperties::VIEW_TREE;
329 }
330 $this->parent_obj->objProperties->setDefaultView($default_view);
331
332 // BUGFIX FOR 11271
333
334 if (ilSession::get('viewmode')) {
335 ilSession::set('viewmode', $default_view);
336 }
337
338 if ($this->settings->get('enable_anonymous_fora') || $this->parent_obj->objProperties->isAnonymized()) {
339 $this->parent_obj->objProperties->setAnonymisation((bool) $a_form->getInput('anonymized'));
340 }
341 if ($this->settings->get('enable_fora_statistics')) {
342 $this->parent_obj->objProperties->setStatisticsStatus((bool) $a_form->getInput('statistics_enabled'));
343 }
344 $this->parent_obj->objProperties->setPostActivation((bool) $a_form->getInput('post_activation'));
345 $this->parent_obj->objProperties->setSubjectSetting($a_form->getInput('subject_setting'));
346 $this->parent_obj->objProperties->setMarkModeratorPosts((bool) $a_form->getInput('mark_mod_posts'));
347 $this->parent_obj->objProperties->setThreadSorting((int) $a_form->getInput('thread_sorting'));
348 $this->parent_obj->objProperties->setIsThreadRatingEnabled((bool) $a_form->getInput('thread_rating'));
350 $this->parent_obj->objProperties->setFileUploadAllowed((bool) $a_form->getInput('file_upload_allowed'));
351 }
352 $this->parent_obj->objProperties->update();
353 $this->obj_service->commonSettings()->legacyForm($a_form, $this->parent_obj->getObject())->saveTileImage();
354
355 $object = $this->parent_obj->getObject();
356 $object->setOfflineStatus(!(bool) $a_form->getInput('activation_online'));
357 $object->update();
358 }
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 get(string $a_var)
static set(string $a_var, $a_val)
Set a value.

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.

+ Here is the call graph for this function:

◆ updateNotificationSettings()

ilForumSettingsGUI::updateNotificationSettings ( )

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

792 : void
793 {
794 if (!$this->access->checkAccess('write', '', $this->parent_obj->getRefId())) {
795 $this->error->raiseError(
796 $this->lng->txt('msg_no_perm_read'),
797 $this->error->MESSAGE
798 );
799 }
800
801 // instantiate the property form
803
804 // check input
805 if ($this->notificationSettingsForm->checkInput()) {
806 $notification_type = '';
807 if ($this->dic->http()->wrapper()->post()->has('notification_type')) {
808 $notification_type = $this->dic->http()->wrapper()->post()->retrieve(
809 'notification_type',
810 $this->dic->refinery()->kindlyTo()->string()
811 );
812 }
813
814 if ($notification_type === 'all_users') {
815 // set values and call update
816 $notification_events = $this->notificationSettingsForm->getInput('notification_events');
817 $interested_events = 0;
818
819 if (is_array($notification_events)) {
820 foreach ($notification_events as $activated_event) {
821 $interested_events += (int) $activated_event;
822 }
823 }
824
825 $this->parent_obj->objProperties->setAdminForceNoti(true);
826 $this->parent_obj->objProperties->setUserToggleNoti((bool) $this->notificationSettingsForm->getInput('usr_toggle'));
827 $this->parent_obj->objProperties->setNotificationType('all_users');
828 $this->parent_obj->objProperties->setInterestedEvents($interested_events);
829 $this->updateUserNotifications(true);
830 } elseif ($notification_type === 'per_user') {
831 $this->parent_obj->objProperties->setNotificationType('per_user');
832 $this->parent_obj->objProperties->setAdminForceNoti(true);
833 $this->parent_obj->objProperties->setUserToggleNoti(false);
835 } else { // if($notification_type] == 'default')
836 $this->parent_obj->objProperties->setNotificationType('default');
837 $this->parent_obj->objProperties->setAdminForceNoti(false);
838 $this->parent_obj->objProperties->setUserToggleNoti(false);
839 $frm_noti = new ilForumNotification($this->parent_obj->getObject()->getRefId());
840 $frm_noti->deleteNotificationAllUsers();
841 }
842
843 $this->parent_obj->objProperties->update();
844
845 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
846 }
847 $this->notificationSettingsForm->setValuesByPost();
848
849 $this->showMembers();
850 }
updateUserNotifications(bool $update_all_users=false)

References ILIAS\Repository\access(), error(), initNotificationSettingsForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), showMembers(), and updateUserNotifications().

+ Here is the call graph for this function:

◆ updateUserNotifications()

ilForumSettingsGUI::updateUserNotifications ( bool  $update_all_users = false)
private

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

708 : void
709 {
710 $oParticipants = $this->getParticipants();
711
712 $frm_noti = new ilForumNotification($this->parent_obj->getObject()->getRefId());
713 $moderator_ids = ilForum::_getModerators($this->parent_obj->getObject()->getRefId());
714
715 $admin_ids = $oParticipants->getAdmins();
716 $member_ids = $oParticipants->getMembers();
717 $tutor_ids = $oParticipants->getTutors();
718
719 $all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
720 $all_forum_users = array_unique($all_forum_users);
721
722 $all_notis = $frm_noti->read();
723
724 foreach ($all_forum_users as $user_id) {
725 $frm_noti->setUserId($user_id);
726
727 $frm_noti->setAdminForce(true);
728 $frm_noti->setUserToggle($this->parent_obj->objProperties->isUserToggleNoti());
729 $frm_noti->setInterestedEvents($this->parent_obj->objProperties->getInterestedEvents());
730
731 if (array_key_exists($user_id, $all_notis) && $update_all_users) {
732 $frm_noti->update();
733 } elseif ($frm_noti->existsNotification() === false) {
734 $frm_noti->insertAdminForce();
735 }
736 }
737 }

References ilForum\_getModerators(), and getParticipants().

Referenced by updateNotificationSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilForumSettingsGUI::$access
private

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

◆ $ctrl

ilCtrlInterface ilForumSettingsGUI::$ctrl
private

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

◆ $dic

ILIAS DI Container ilForumSettingsGUI::$dic
private

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

◆ $error

ilErrorHandling ilForumSettingsGUI::$error
private

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

◆ $forumNotificationObj

ilForumNotification ilForumSettingsGUI::$forumNotificationObj
private

Definition at line 38 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 30 of file class.ilForumSettingsGUI.php.

◆ $notificationSettingsForm

ilPropertyFormGUI ilForumSettingsGUI::$notificationSettingsForm = null
private

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

◆ $obj_service

ilObjectService ilForumSettingsGUI::$obj_service
private

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

◆ $parent_obj

ilObjForumGUI ilForumSettingsGUI::$parent_obj
private

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

Referenced by __construct(), and getParticipants().

◆ $ref_id

int ilForumSettingsGUI::$ref_id
private

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

Referenced by getRefId().

◆ $refinery

ILIAS Refinery Factory ilForumSettingsGUI::$refinery
private

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

◆ $settings

ilSetting ilForumSettingsGUI::$settings
private

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

◆ $tabs

ilTabsGUI ilForumSettingsGUI::$tabs
private

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

◆ $tpl

ilGlobalTemplateInterface ilForumSettingsGUI::$tpl
private

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

◆ $tree

ilTree ilForumSettingsGUI::$tree
private

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

◆ $ui_factory

ILIAS UI Factory ilForumSettingsGUI::$ui_factory
private

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


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