ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilForumSettingsGUI Class Reference

Class ilForumSettingsGUI. More...

+ Collaboration diagram for ilForumSettingsGUI:

Public Member Functions

 __construct (ilObjForumGUI $parent_obj)
 ilForumSettingsGUI constructor. More...
 
 executeCommand ()
 
 getCustomForm (&$a_form)
 
 settingsTabs ()
 
 getCustomValues (array &$a_values)
 
 updateCustomValues (ilPropertyFormGUI $a_form)
 
 showMembers ()
 
 enableAdminForceNoti ()
 
 disableAdminForceNoti ()
 
 enableHideUserToggleNoti ()
 
 disableHideUserToggleNoti ()
 
 updateNotificationSettings ()
 

Protected Member Functions

 getIcon ($user_toggle_noti)
 

Protected Attributes

 $form
 

Private Member Functions

 getUserNotificationTableData ($user_ids, ilForumNotification $frm_noti)
 
 __showMembersTable (array $moderators, array $admins, array $members, array $tutors)
 
 updateUserNotifications ($update_all_users=false)
 
 initNotificationSettingsForm ()
 

Private Attributes

 $ctrl
 
 $tpl
 
 $lng
 
 $settings
 
 $tabs
 
 $access
 
 $tree
 
 $parent_obj
 
 $notificationSettingsForm
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumSettingsGUI::__construct ( ilObjForumGUI  $parent_obj)

ilForumSettingsGUI constructor.

Parameters
$parent_obj

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

34 {
35 global $DIC;
36
37 $this->parent_obj = $parent_obj;
38 $this->ctrl = $DIC->ctrl();
39 $this->tpl = $DIC->ui()->mainTemplate();
40 $this->lng = $DIC->language();
41 $this->settings = $DIC->settings();
42 $this->tabs = $DIC->tabs();
43 $this->access = $DIC->access();
44 $this->tree = $DIC->repositoryTree();
45 $this->obj_service = $DIC->object();
46 }
settings()
Definition: settings.php:2
$DIC
Definition: xapitoken.php:46

References $DIC, $parent_obj, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ __showMembersTable()

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

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

356 {
357 foreach (array_filter([
358 'moderators' => $moderators,
359 'administrator' => $admins,
360 'tutors' => $tutors,
361 'members' => $members
362 ]) as $type => $data) {
363 $tbl_mod = new ilTable2GUI($this, 'showMembers');
364 $tbl_mod->setId('tbl_id_mod');
365 $tbl_mod->setFormAction($this->ctrl->getFormAction($this, 'showMembers'));
366 $tbl_mod->setTitle($this->lng->txt(strtolower($type)));
367
368 $tbl_mod->addColumn('', '', '1%', true);
369 $tbl_mod->addColumn($this->lng->txt('login'), '', '10%');
370 $tbl_mod->addColumn($this->lng->txt('firstname'), '', '10%');
371 $tbl_mod->addColumn($this->lng->txt('lastname'), '', '10%');
372 $tbl_mod->addColumn($this->lng->txt('allow_user_toggle_noti'), '', '10%');
373 $tbl_mod->setSelectAllCheckbox('user_id');
374
375 $tbl_mod->setRowTemplate('tpl.forums_members_row.html', 'Modules/Forum');
376 $tbl_mod->setData($data);
377
378 $tbl_mod->addMultiCommand('enableHideUserToggleNoti', $this->lng->txt('enable_hide_user_toggle'));
379 $tbl_mod->addMultiCommand('disableHideUserToggleNoti', $this->lng->txt('disable_hide_user_toggle'));
380
381 $this->tpl->setCurrentBlock(strtolower($type) . '_table');
382 $this->tpl->setVariable(strtoupper($type), $tbl_mod->getHTML());
383 }
384 }
Class ilTable2GUI.
$type
$data
Definition: storeScorm.php:23

References $data, and $type.

Referenced by showMembers().

+ Here is the caller graph for this function:

◆ disableAdminForceNoti()

ilForumSettingsGUI::disableAdminForceNoti ( )

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

418 {
419 if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
420 $this->parent_obj->error->raiseError(
421 $this->lng->txt('msg_no_perm_read'),
422 $this->parent_obj->error->MESSAGE
423 );
424 }
425
426 if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
427 ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'));
428 } else {
429 $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
430
431 foreach ($_POST['user_id'] as $user_id) {
432 $frm_noti->setUserId((int) $user_id);
433 $is_enabled = $frm_noti->isAdminForceNotification();
434
435 if ($is_enabled) {
436 $frm_noti->deleteAdminForce();
437 }
438 }
439
440 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
441 }
442
443 $this->showMembers();
444 }
$_POST["username"]
Class ilForumNotification.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_POST, ilUtil\sendInfo(), and showMembers().

+ Here is the call graph for this function:

◆ disableHideUserToggleNoti()

ilForumSettingsGUI::disableHideUserToggleNoti ( )

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

479 {
480 if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
481 $this->parent_obj->error->raiseError(
482 $this->lng->txt('msg_no_perm_read'),
483 $this->parent_obj->error->MESSAGE
484 );
485 }
486
487 if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
488 ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'));
489 } else {
490 $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
491
492 foreach ($_POST['user_id'] as $user_id) {
493 $frm_noti->setUserId((int) $user_id);
494 $is_enabled = $frm_noti->isAdminForceNotification();
495 $frm_noti->setUserToggle(0);
496 if ($is_enabled) {
497 $frm_noti->updateUserToggle();
498 } else {
499 $frm_noti->setAdminForce(1);
500 $frm_noti->insertAdminForce();
501 }
502 }
503
504 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
505 }
506
507 $this->showMembers();
508 }

References $_POST, ilUtil\sendInfo(), and showMembers().

+ Here is the call graph for this function:

◆ enableAdminForceNoti()

ilForumSettingsGUI::enableAdminForceNoti ( )

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

387 {
388 if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
389 $this->parent_obj->error->raiseError(
390 $this->lng->txt('msg_no_perm_read'),
391 $this->parent_obj->error->MESSAGE
392 );
393 }
394
395 if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
396 ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'), true);
397 } else {
398 $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
399
400 foreach ($_POST['user_id'] as $user_id) {
401 $frm_noti->setUserId((int) $user_id);
402 $is_enabled = $frm_noti->isAdminForceNotification();
403
404 $frm_noti->setUserToggle(0);
405 if (!$is_enabled) {
406 $frm_noti->setAdminForce(1);
407 $frm_noti->insertAdminForce();
408 }
409 }
410
411 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
412 }
413
414 $this->showMembers();
415 }

References $_POST, ilUtil\sendInfo(), and showMembers().

+ Here is the call graph for this function:

◆ enableHideUserToggleNoti()

ilForumSettingsGUI::enableHideUserToggleNoti ( )

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

447 {
448 if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
449 $this->parent_obj->error->raiseError(
450 $this->lng->txt('msg_no_perm_read'),
451 $this->parent_obj->error->MESSAGE
452 );
453 }
454 if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
455 ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'));
456 } else {
457 $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
458
459 foreach ($_POST['user_id'] as $user_id) {
460 $frm_noti->setUserId((int) $user_id);
461 $is_enabled = $frm_noti->isAdminForceNotification();
462 $frm_noti->setUserToggle(1);
463
464 if (!$is_enabled) {
465 $frm_noti->setAdminForce(1);
466 $frm_noti->insertAdminForce();
467 } else {
468 $frm_noti->updateUserToggle();
469 }
470 }
471
472 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
473 }
474
475 $this->showMembers();
476 }

References $_POST, ilUtil\sendInfo(), and showMembers().

+ Here is the call graph for this function:

◆ executeCommand()

ilForumSettingsGUI::executeCommand ( )

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

52 {
53 $cmd = $this->ctrl->getCmd();
54 switch (true) {
55 case method_exists($this, $cmd):
56 $this->settingsTabs();
57 $this->{$cmd}();
58 break;
59
60 default:
61 $this->ctrl->redirect($this->parent_obj);
62 break;
63 }
64 }

References settingsTabs().

+ Here is the call graph for this function:

◆ getCustomForm()

ilForumSettingsGUI::getCustomForm ( $a_form)
Parameters
ilPropertyFormGUI$a_form

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

70 {
71 $this->settingsTabs();
72 $this->tabs->activateSubTab("basic_settings");
73 $a_form->setTitle($this->lng->txt('frm_settings_form_header'));
74
75 $presentationHeader = new ilFormSectionHeaderGUI();
76 $presentationHeader->setTitle($this->lng->txt('frm_settings_presentation_header'));
77 $a_form->addItem($presentationHeader);
78
79 $this->obj_service->commonSettings()->legacyForm($a_form, $this->parent_obj->object)->addTileImage();
80
81 $rg_pro = new ilRadioGroupInputGUI($this->lng->txt('frm_default_view'), 'default_view');
82 $rg_pro->addOption(new ilRadioOption($this->lng->txt('sort_by_posts'), ilForumProperties::VIEW_TREE));
83 $view_desc = new ilRadioOption(
84 $this->lng->txt('sort_by_date') . ' (' . $this->lng->txt('descending_order') . ')',
86 );
87 $view_asc = new ilRadioOption(
88 $this->lng->txt('sort_by_date') . ' (' . $this->lng->txt('ascending_order') . ')',
90 );
91 $rg_pro->addOption($view_desc);
92 $rg_pro->addOption($view_asc);
93 $a_form->addItem($rg_pro);
94
95 $userFunctionsHeader = new \ilFormSectionHeaderGUI();
96 $userFunctionsHeader->setTitle($this->lng->txt('frm_settings_user_functions_header'));
97 $a_form->addItem($userFunctionsHeader);
98
99 $frm_subject = new ilRadioGroupInputGUI($this->lng->txt('frm_subject_setting'), 'subject_setting');
100 $frm_subject->addOption(new ilRadioOption($this->lng->txt('preset_subject'), 'preset_subject'));
101 $frm_subject->addOption(new ilRadioOption($this->lng->txt('add_re_to_subject'), 'add_re_to_subject'));
102 $frm_subject->addOption(new ilRadioOption($this->lng->txt('empty_subject'), 'empty_subject'));
103 $a_form->addItem($frm_subject);
104
105 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('enable_thread_ratings'), 'thread_rating');
106 $cb_prop->setValue(1);
107 $cb_prop->setInfo($this->lng->txt('enable_thread_ratings_info'));
108 $a_form->addItem($cb_prop);
109
111 $frm_upload = new ilCheckboxInputGUI($this->lng->txt('file_upload_allowed'), 'file_upload_allowed');
112 $frm_upload->setValue(1);
113 $frm_upload->setInfo($this->lng->txt('allow_file_upload_desc'));
114 $a_form->addItem($frm_upload);
115 }
116
117 $moderatorFunctionsHeader = new \ilFormSectionHeaderGUI();
118 $moderatorFunctionsHeader->setTitle($this->lng->txt('frm_settings_mod_functions_header'));
119 $a_form->addItem($moderatorFunctionsHeader);
120
121 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('activate_new_posts'), 'post_activation');
122 $cb_prop->setValue(1);
123 $cb_prop->setInfo($this->lng->txt('post_activation_desc'));
124 $a_form->addItem($cb_prop);
125
126 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('mark_moderator_posts'), 'mark_mod_posts');
127 $cb_prop->setValue(1);
128 $cb_prop->setInfo($this->lng->txt('mark_moderator_posts_desc'));
129 $a_form->addItem($cb_prop);
130
131
132 $stickyThreadSorting = new ilRadioGroupInputGUI($this->lng->txt('sorting_manual_sticky'), 'thread_sorting');
133 $latestAtTop = new ilRadioOption($this->lng->txt('frm_sticky_threads_latest_at_top'), 0);
134 $latestAtTop->setInfo($this->lng->txt('frm_sticky_threads_latest_at_top_info'));
135 $latestAtTop->setValue(0);
136 $stickyThreadSorting->addOption($latestAtTop);
137 $manualSorting = new ilRadioOption($this->lng->txt('frm_sticky_threads_manual_sorting'), 1);
138 $manualSorting->setInfo($this->lng->txt('frm_sticky_threads_manual_sorting_info'));
139 $stickyThreadSorting->addOption($manualSorting);
140 $a_form->addItem($stickyThreadSorting);
141
142 if ($this->settings->get('enable_anonymous_fora') || $this->settings->get('enable_fora_statistics', false)) {
143 $privacyHeader = new \ilFormSectionHeaderGUI();
144 $privacyHeader->setTitle($this->lng->txt('frm_settings_privacy_header'));
145 $a_form->addItem($privacyHeader);
146 }
147
148 if ($this->settings->get('enable_fora_statistics', false)) {
149 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('frm_statistics_enabled'), 'statistics_enabled');
150 $cb_prop->setValue(1);
151 $cb_prop->setInfo($this->lng->txt('frm_statistics_enabled_desc'));
152 $a_form->addItem($cb_prop);
153 }
154
155 if ($this->settings->get('enable_anonymous_fora') || $this->parent_obj->objProperties->isAnonymized()) {
156 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('frm_anonymous_posting'), 'anonymized');
157 $cb_prop->setValue(1);
158 $cb_prop->setInfo($this->lng->txt('frm_anonymous_posting_desc'));
159 $a_form->addItem($cb_prop);
160 }
161 }
This class represents a checkbox property in a property form.
This class represents a section header in a property form.
This class represents a property in a property form.
This class represents an option in a radio group.

References ilForumProperties\isFileUploadGloballyAllowed(), settings(), settingsTabs(), 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)
Parameters
array$a_values

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

214 {
215 $a_values['anonymized'] = $this->parent_obj->objProperties->isAnonymized();
216 $a_values['statistics_enabled'] = $this->parent_obj->objProperties->isStatisticEnabled();
217 $a_values['post_activation'] = $this->parent_obj->objProperties->isPostActivationEnabled();
218 $a_values['subject_setting'] = $this->parent_obj->objProperties->getSubjectSetting();
219 $a_values['mark_mod_posts'] = $this->parent_obj->objProperties->getMarkModeratorPosts();
220 $a_values['thread_sorting'] = $this->parent_obj->objProperties->getThreadSorting();
221 $a_values['thread_rating'] = $this->parent_obj->objProperties->isIsThreadRatingEnabled();
222
223 if (in_array((int)$this->parent_obj->objProperties->getDefaultView(), array(
227 ))) {
228 $default_view = (int)$this->parent_obj->objProperties->getDefaultView();
229 } else {
230 $default_view = ilForumProperties::VIEW_TREE;
231 }
232
233 $a_values['default_view'] = $default_view;
234 $a_values['file_upload_allowed'] = (bool) $this->parent_obj->objProperties->getFileUploadAllowed();
235 }

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

◆ getIcon()

ilForumSettingsGUI::getIcon (   $user_toggle_noti)
protected

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

328 {
329 $icon = $user_toggle_noti
330 ? "<img src=\"" . ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"" . $this->lng->txt("enabled") . "\" title=\"" . $this->lng->txt("enabled") . "\" border=\"0\" vspace=\"0\"/>"
331 : "<img src=\"" . ilUtil::getImagePath("icon_not_ok.svg") . "\" alt=\"" . $this->lng->txt("disabled") . "\" title=\"" . $this->lng->txt("disabled") . "\" border=\"0\" vspace=\"0\"/>";
332 return $icon;
333 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References ilUtil\getImagePath().

Referenced by getUserNotificationTableData().

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

◆ getUserNotificationTableData()

ilForumSettingsGUI::getUserNotificationTableData (   $user_ids,
ilForumNotification  $frm_noti 
)
private

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

336 {
337 $counter = 0;
338 $users = array();
339 foreach ($user_ids as $user_id) {
340 $frm_noti->setUserId($user_id);
341 $user_toggle_noti = $frm_noti->isUserToggleNotification();
342 $icon_ok = $this->getIcon(!$user_toggle_noti);
343
344 $users[$counter]['user_id'] = ilUtil::formCheckbox(0, 'user_id[]', $user_id);
345 $users[$counter]['login'] = ilObjUser::_lookupLogin($user_id);
346 $name = ilObjUser::_lookupName($user_id);
347 $users[$counter]['firstname'] = $name['firstname'];
348 $users[$counter]['lastname'] = $name['lastname'];
349 $users[$counter]['user_toggle_noti'] = $icon_ok;
350 $counter++;
351 }
352 return $users;
353 }
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
if($format !==null) $name
Definition: metadata.php:230

References $name, ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilUtil\formCheckbox(), getIcon(), ilForumNotification\isUserToggleNotification(), and ilForumNotification\setUserId().

Referenced by showMembers().

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

◆ initNotificationSettingsForm()

ilForumSettingsGUI::initNotificationSettingsForm ( )
private

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

580 {
581 if (null === $this->notificationSettingsForm) {
582 $form = new ilPropertyFormGUI();
583 $form->setFormAction($this->ctrl->getFormAction($this, 'updateNotificationSettings'));
584 $form->setTitle($this->lng->txt('forums_notification_settings'));
585
586 $radio_grp = new ilRadioGroupInputGUI('', 'notification_type');
587 $radio_grp->setValue('default');
588
589 $opt_default = new ilRadioOption($this->lng->txt("user_decides_notification"), 'default');
590 $opt_0 = new ilRadioOption($this->lng->txt("settings_for_all_members"), 'all_users');
591 $opt_1 = new ilRadioOption($this->lng->txt("settings_per_users"), 'per_user');
592
593 $radio_grp->addOption($opt_default);
594 $radio_grp->addOption($opt_0);
595 $radio_grp->addOption($opt_1);
596
597 $chb_2 = new ilCheckboxInputGUI($this->lng->txt('user_toggle_noti'), 'usr_toggle');
598 $chb_2->setValue(1);
599
600 $opt_0->addSubItem($chb_2);
601 $form->addItem($radio_grp);
602
603 $form->addCommandButton('updateNotificationSettings', $this->lng->txt('save'));
604
605 $this->notificationSettingsForm = $form;
606
607 return false;
608 }
609
610 return true;
611 }
This class represents a property form user interface.

References $form.

Referenced by showMembers(), and updateNotificationSettings().

+ Here is the caller graph for this function:

◆ settingsTabs()

ilForumSettingsGUI::settingsTabs ( )
Returns
bool

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

167 {
168 $this->tabs->activateTab('settings');
169 $this->tabs->addSubTabTarget(
170 'basic_settings',
171 $this->ctrl->getLinkTarget($this->parent_obj, 'edit'),
172 '',
173 [strtolower(ilObjForumGUI::class)]
174 );
175
176 if ($this->settings->get('forum_notification') > 0) {
177 // check if there a parent-node is a grp or crs
178 $grp_ref_id = $this->tree->checkForParentType($this->parent_obj->ref_id, 'grp');
179 $crs_ref_id = $this->tree->checkForParentType($this->parent_obj->ref_id, 'crs');
180
181 if ((int) $grp_ref_id > 0 || (int) $crs_ref_id > 0) {
182 #show member-tab for notification if forum-notification is enabled in administration
183 if ($this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
184 $mem_active = array('showMembers', 'forums_notification_settings');
185 (in_array($_GET['cmd'], $mem_active)) ? $force_mem_active = true : $force_mem_active = false;
186
187 $this->tabs->addSubTabTarget(
188 'notifications',
189 $this->ctrl->getLinkTarget($this, 'showMembers'),
190 '',
191 [strtolower(self::class)],
192 '',
193 $force_mem_active
194 );
195 }
196 }
197 }
198
199 $this->lng->loadLanguageModule('cont');
200 $this->tabs->addSubTabTarget(
201 'cont_news_settings',
202 $this->ctrl->getLinkTargetByClass(ilContainerNewsSettingsGUI::class),
203 '',
204 [strtolower(ilContainerNewsSettingsGUI::class)]
205 );
206
207 return true;
208 }
$_GET["client_id"]

References $_GET, and settings().

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

277 {
278 if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
279 $this->parent_obj->error->raiseError(
280 $this->lng->txt('msg_no_perm_read'),
281 $this->parent_obj->error->MESSAGE
282 );
283 }
284
285 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_members_list.html', 'Modules/Forum');
286
287 // instantiate the property form
288 if (!$this->initNotificationSettingsForm()) {
289 // if the form was just created set the values fetched from database
290 $this->notificationSettingsForm->setValuesByArray(array(
291 'notification_type' => $this->parent_obj->objProperties->getNotificationType(),
292 'adm_force' => (bool) $this->parent_obj->objProperties->isAdminForceNoti(),
293 'usr_toggle' => (bool) $this->parent_obj->objProperties->isUserToggleNoti()
294 ));
295 }
296
297 // set form html into template
298 $this->tpl->setVariable('NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
299
300 $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
301 $oParticipants = $this->getParticipants();
302
303 $moderator_ids = ilForum::_getModerators($this->parent_obj->object->getRefId());
304
305 $admin_ids = $oParticipants->getAdmins();
306 $member_ids = $oParticipants->getMembers();
307 $tutor_ids = $oParticipants->getTutors();
308
309 if ($this->parent_obj->objProperties->getNotificationType() == 'default') {
310 // update forum_notification table
311 $forum_noti = new ilForumNotification($this->parent_obj->object->getRefId());
312 $forum_noti->setAdminForce($this->parent_obj->objProperties->isAdminForceNoti());
313 $forum_noti->setUserToggle($this->parent_obj->objProperties->isUserToggleNoti());
314 $forum_noti->setForumId($this->parent_obj->objProperties->getObjId());
315 } else {
316 if ($this->parent_obj->objProperties->getNotificationType() == 'per_user') {
317 $moderators = $this->getUserNotificationTableData($moderator_ids, $frm_noti);
318 $admins = $this->getUserNotificationTableData($admin_ids, $frm_noti);
319 $members = $this->getUserNotificationTableData($member_ids, $frm_noti);
320 $tutors = $this->getUserNotificationTableData($tutor_ids, $frm_noti);
321
322 $this->__showMembersTable($moderators, $admins, $members, $tutors);
323 }
324 }
325 }
__showMembersTable(array $moderators, array $admins, array $members, array $tutors)
getUserNotificationTableData($user_ids, ilForumNotification $frm_noti)
static _getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)

References __showMembersTable(), ilForum\_getModerators(), getUserNotificationTableData(), and initNotificationSettingsForm().

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

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

◆ updateCustomValues()

ilForumSettingsGUI::updateCustomValues ( ilPropertyFormGUI  $a_form)
Parameters
ilPropertyFormGUI$a_form

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

241 {
242 if (in_array((int) $a_form->getInput('default_view'), array(
246 ))) {
247 $default_view = (int) $a_form->getInput('default_view');
248 } else {
249 $default_view = ilForumProperties::VIEW_TREE;
250 }
251 $this->parent_obj->objProperties->setDefaultView($default_view);
252
253 // BUGFIX FOR 11271
254 if (isset($_SESSION['viewmode'])) {
255 $_SESSION['viewmode'] = $default_view;
256 }
257
258 if ($this->settings->get('enable_anonymous_fora') || $this->parent_obj->objProperties->isAnonymized()) {
259 $this->parent_obj->objProperties->setAnonymisation((int) $a_form->getInput('anonymized'));
260 }
261 if ($this->settings->get('enable_fora_statistics', false)) {
262 $this->parent_obj->objProperties->setStatisticsStatus((int) $a_form->getInput('statistics_enabled'));
263 }
264 $this->parent_obj->objProperties->setPostActivation((int) $a_form->getInput('post_activation'));
265 $this->parent_obj->objProperties->setSubjectSetting($a_form->getInput('subject_setting'));
266 $this->parent_obj->objProperties->setMarkModeratorPosts((int) $a_form->getInput('mark_mod_posts'));
267 $this->parent_obj->objProperties->setThreadSorting((int) $a_form->getInput('thread_sorting'));
268 $this->parent_obj->objProperties->setIsThreadRatingEnabled((bool) $a_form->getInput('thread_rating'));
270 $this->parent_obj->objProperties->setFileUploadAllowed((bool) $a_form->getInput('file_upload_allowed'));
271 }
272 $this->parent_obj->objProperties->update();
273 $this->obj_service->commonSettings()->legacyForm($a_form, $this->parent_obj->object)->saveTileImage();
274 }
$_SESSION["AccountId"]
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References $_SESSION, ilPropertyFormGUI\getInput(), ilForumProperties\isFileUploadGloballyAllowed(), settings(), 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 613 of file class.ilForumSettingsGUI.php.

614 {
615 if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
616 $this->parent_obj->error->raiseError(
617 $this->lng->txt('msg_no_perm_read'),
618 $this->parent_obj->error->MESSAGE
619 );
620 }
621
622 // instantiate the property form
624
625 // check input
626 if ($this->notificationSettingsForm->checkInput()) {
627 if (isset($_POST['notification_type']) && $_POST['notification_type'] == 'all_users') {
628 // set values and call update
629 $this->parent_obj->objProperties->setAdminForceNoti(1);
630 $this->parent_obj->objProperties->setUserToggleNoti((int) $this->notificationSettingsForm->getInput('usr_toggle'));
631 $this->parent_obj->objProperties->setNotificationType('all_users');
632 $this->updateUserNotifications(true);
633 } else {
634 if ($_POST['notification_type'] == 'per_user') {
635 $this->parent_obj->objProperties->setNotificationType('per_user');
636 $this->parent_obj->objProperties->setAdminForceNoti(1);
637 $this->parent_obj->objProperties->setUserToggleNoti(0);
639 } else { // if($_POST['notification_type'] == 'default')
640 $this->parent_obj->objProperties->setNotificationType('default');
641 $this->parent_obj->objProperties->setAdminForceNoti(0);
642 $this->parent_obj->objProperties->setUserToggleNoti(0);
643 $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
644 $frm_noti->deleteNotificationAllUsers();
645 }
646 }
647
648 $this->parent_obj->objProperties->update();
649
650 // print success message
651 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
652 }
653 $this->notificationSettingsForm->setValuesByPost();
654
655 $this->showMembers();
656 return;
657 }
updateUserNotifications($update_all_users=false)

References $_POST, initNotificationSettingsForm(), showMembers(), and updateUserNotifications().

+ Here is the call graph for this function:

◆ updateUserNotifications()

ilForumSettingsGUI::updateUserNotifications (   $update_all_users = false)
private

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

548 {
549 $oParticipants = $this->getParticipants();
550
551 $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
552 $moderator_ids = ilForum::_getModerators($this->parent_obj->object->getRefId());
553
554 $admin_ids = $oParticipants->getAdmins();
555 $member_ids = $oParticipants->getMembers();
556 $tutor_ids = $oParticipants->getTutors();
557
558 $all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
559 $all_forum_users = array_unique($all_forum_users);
560
561 $all_notis = $frm_noti->read();
562
563 foreach ($all_forum_users as $user_id) {
564 $frm_noti->setUserId($user_id);
565
566 $frm_noti->setAdminForce(1);
567 $frm_noti->setUserToggle($this->parent_obj->objProperties->isUserToggleNoti());
568
569 if (array_key_exists($user_id, $all_notis) && $update_all_users) {
570 $frm_noti->update();
571 } else {
572 if ($frm_noti->existsNotification() == false) {
573 $frm_noti->insertAdminForce();
574 }
575 }
576 }
577 }

References ilForum\_getModerators().

Referenced by updateNotificationSettings().

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

Field Documentation

◆ $access

ilForumSettingsGUI::$access
private

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

◆ $ctrl

ilForumSettingsGUI::$ctrl
private

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

◆ $form

ilForumSettingsGUI::$form
protected

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

Referenced by initNotificationSettingsForm().

◆ $lng

ilForumSettingsGUI::$lng
private

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

◆ $notificationSettingsForm

ilForumSettingsGUI::$notificationSettingsForm
private

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

◆ $parent_obj

ilForumSettingsGUI::$parent_obj
private

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

Referenced by __construct().

◆ $settings

ilForumSettingsGUI::$settings
private

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

◆ $tabs

ilForumSettingsGUI::$tabs
private

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

◆ $tpl

ilForumSettingsGUI::$tpl
private

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

◆ $tree

ilForumSettingsGUI::$tree
private

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


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