ILIAS  release_7 Revision v7.30-3-g800a261c036
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.

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

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
global $DIC
Definition: goto.php:24
+ 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.

References $data, and $type.

Referenced by showMembers().

356  {
357  foreach (array_filter([
358  'moderators' => $moderators,
359  'administrator' => $admins,
360  'tutors' => $tutors,
361  'members' => $members
362  ]) as $type => $data) {
364  $this,
365  'showMembers',
366  $this->parent_obj->object,
367  $type
368  );
369  $tbl_mod->setData($data);
370  $this->tpl->setCurrentBlock(strtolower($type) . '_table');
371  $this->tpl->setVariable(strtoupper($type), $tbl_mod->getHTML());
372  }
373  }
$data
Definition: storeScorm.php:23
$type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ disableAdminForceNoti()

ilForumSettingsGUI::disableAdminForceNoti ( )

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

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

407  {
408  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
409  $this->parent_obj->error->raiseError(
410  $this->lng->txt('msg_no_perm_read'),
411  $this->parent_obj->error->MESSAGE
412  );
413  }
414 
415  if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
416  ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'));
417  } else {
418  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
419 
420  foreach ($_POST['user_id'] as $user_id) {
421  $frm_noti->setUserId((int) $user_id);
422  $is_enabled = $frm_noti->isAdminForceNotification();
423 
424  if ($is_enabled) {
425  $frm_noti->deleteAdminForce();
426  }
427  }
428 
429  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
430  }
431 
432  $this->showMembers();
433  }
Class ilForumNotification.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ disableHideUserToggleNoti()

ilForumSettingsGUI::disableHideUserToggleNoti ( )

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

References $_POST, $parent_obj, ilGroupParticipants\_getInstanceByObjId(), ilCourseParticipants\_getInstanceByObjId(), ilObjectFactory\getInstanceByRefId(), ilUtil\sendInfo(), ilForumNotification\setUserId(), and showMembers().

468  {
469  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
470  $this->parent_obj->error->raiseError(
471  $this->lng->txt('msg_no_perm_read'),
472  $this->parent_obj->error->MESSAGE
473  );
474  }
475 
476  if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
477  ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'));
478  } else {
479  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
480 
481  foreach ($_POST['user_id'] as $user_id) {
482  $frm_noti->setUserId((int) $user_id);
483  $is_enabled = $frm_noti->isAdminForceNotification();
484  $frm_noti->setUserToggle(0);
485  if ($is_enabled) {
486  $frm_noti->updateUserToggle();
487  } else {
488  $frm_noti->setAdminForce(1);
489  $frm_noti->insertAdminForce();
490  }
491  }
492 
493  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
494  }
495 
496  $this->showMembers();
497  }
Class ilForumNotification.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ enableAdminForceNoti()

ilForumSettingsGUI::enableAdminForceNoti ( )

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

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

376  {
377  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
378  $this->parent_obj->error->raiseError(
379  $this->lng->txt('msg_no_perm_read'),
380  $this->parent_obj->error->MESSAGE
381  );
382  }
383 
384  if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
385  ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'), true);
386  } else {
387  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
388 
389  foreach ($_POST['user_id'] as $user_id) {
390  $frm_noti->setUserId((int) $user_id);
391  $is_enabled = $frm_noti->isAdminForceNotification();
392 
393  $frm_noti->setUserToggle(0);
394  if (!$is_enabled) {
395  $frm_noti->setAdminForce(1);
396  $frm_noti->insertAdminForce();
397  }
398  }
399 
400  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
401  }
402 
403  $this->showMembers();
404  }
Class ilForumNotification.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ enableHideUserToggleNoti()

ilForumSettingsGUI::enableHideUserToggleNoti ( )

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

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

436  {
437  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
438  $this->parent_obj->error->raiseError(
439  $this->lng->txt('msg_no_perm_read'),
440  $this->parent_obj->error->MESSAGE
441  );
442  }
443  if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
444  ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'));
445  } else {
446  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
447 
448  foreach ($_POST['user_id'] as $user_id) {
449  $frm_noti->setUserId((int) $user_id);
450  $is_enabled = $frm_noti->isAdminForceNotification();
451  $frm_noti->setUserToggle(1);
452 
453  if (!$is_enabled) {
454  $frm_noti->setAdminForce(1);
455  $frm_noti->insertAdminForce();
456  } else {
457  $frm_noti->updateUserToggle();
458  }
459  }
460 
461  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
462  }
463 
464  $this->showMembers();
465  }
Class ilForumNotification.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilForumSettingsGUI::executeCommand ( )

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

References settingsTabs().

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  }
+ 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.

References ilRadioGroupInputGUI\addOption(), ilForumProperties\isFileUploadGloballyAllowed(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), settings(), settingsTabs(), ilCheckboxInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

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 an option in a radio group.
settings()
Definition: settings.php:2
This class represents a section header in a property form.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
addOption($a_option)
Add Option.
setValue($a_value)
Set Value.
+ 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.

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

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  }

◆ getIcon()

ilForumSettingsGUI::getIcon (   $user_toggle_noti)
protected

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

References ilUtil\getImagePath().

Referenced by getUserNotificationTableData().

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)
+ 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.

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

Referenced by showMembers().

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
if($format !==null) $name
Definition: metadata.php:230
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initNotificationSettingsForm()

ilForumSettingsGUI::initNotificationSettingsForm ( )
private

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

References $form, ilRadioOption\addSubItem(), and ilCheckboxInputGUI\setValue().

Referenced by showMembers(), and updateNotificationSettings().

569  {
570  if (null === $this->notificationSettingsForm) {
571  $form = new ilPropertyFormGUI();
572  $form->setFormAction($this->ctrl->getFormAction($this, 'updateNotificationSettings'));
573  $form->setTitle($this->lng->txt('forums_notification_settings'));
574 
575  $radio_grp = new ilRadioGroupInputGUI('', 'notification_type');
576  $radio_grp->setValue('default');
577 
578  $opt_default = new ilRadioOption($this->lng->txt("user_decides_notification"), 'default');
579  $opt_0 = new ilRadioOption($this->lng->txt("settings_for_all_members"), 'all_users');
580  $opt_1 = new ilRadioOption($this->lng->txt("settings_per_users"), 'per_user');
581 
582  $radio_grp->addOption($opt_default);
583  $radio_grp->addOption($opt_0);
584  $radio_grp->addOption($opt_1);
585 
586  $chb_2 = new ilCheckboxInputGUI($this->lng->txt('user_toggle_noti'), 'usr_toggle');
587  $chb_2->setValue(1);
588 
589  $opt_0->addSubItem($chb_2);
590  $form->addItem($radio_grp);
591 
592  $form->addCommandButton('updateNotificationSettings', $this->lng->txt('save'));
593 
594  $this->notificationSettingsForm = $form;
595 
596  return false;
597  }
598 
599  return true;
600  }
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a checkbox property in a property form.
This class represents a property in a property form.
addSubItem($a_item)
Add Subitem.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ settingsTabs()

ilForumSettingsGUI::settingsTabs ( )
Returns
bool

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

References $_GET, and settings().

Referenced by executeCommand(), and getCustomForm().

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  }
settings()
Definition: settings.php:2
$_GET["client_id"]
+ 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.

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

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

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  }
getUserNotificationTableData($user_ids, ilForumNotification $frm_noti)
Class ilForumNotification.
static _getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
__showMembersTable(array $moderators, array $admins, array $members, array $tutors)
+ 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.

References $_SESSION, ilPropertyFormGUI\getInput(), ilForumProperties\isFileUploadGloballyAllowed(), settings(), ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

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  }
settings()
Definition: settings.php:2
$_SESSION["AccountId"]
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ updateNotificationSettings()

ilForumSettingsGUI::updateNotificationSettings ( )

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

References $_POST, ilForumNotification\deleteNotificationAllUsers(), initNotificationSettingsForm(), showMembers(), and updateUserNotifications().

603  {
604  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
605  $this->parent_obj->error->raiseError(
606  $this->lng->txt('msg_no_perm_read'),
607  $this->parent_obj->error->MESSAGE
608  );
609  }
610 
611  // instantiate the property form
613 
614  // check input
615  if ($this->notificationSettingsForm->checkInput()) {
616  if (isset($_POST['notification_type']) && $_POST['notification_type'] == 'all_users') {
617  // set values and call update
618  $this->parent_obj->objProperties->setAdminForceNoti(1);
619  $this->parent_obj->objProperties->setUserToggleNoti((int) $this->notificationSettingsForm->getInput('usr_toggle'));
620  $this->parent_obj->objProperties->setNotificationType('all_users');
621  $this->updateUserNotifications(true);
622  } else {
623  if ($_POST['notification_type'] == 'per_user') {
624  $this->parent_obj->objProperties->setNotificationType('per_user');
625  $this->parent_obj->objProperties->setAdminForceNoti(1);
626  $this->parent_obj->objProperties->setUserToggleNoti(0);
627  $this->updateUserNotifications();
628  } else { // if($_POST['notification_type'] == 'default')
629  $this->parent_obj->objProperties->setNotificationType('default');
630  $this->parent_obj->objProperties->setAdminForceNoti(0);
631  $this->parent_obj->objProperties->setUserToggleNoti(0);
632  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
633  $frm_noti->deleteNotificationAllUsers();
634  }
635  }
636 
637  $this->parent_obj->objProperties->update();
638 
639  // print success message
640  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
641  }
642  $this->notificationSettingsForm->setValuesByPost();
643 
644  $this->showMembers();
645  return;
646  }
Class ilForumNotification.
updateUserNotifications($update_all_users=false)
$_POST["username"]
+ Here is the call graph for this function:

◆ updateUserNotifications()

ilForumSettingsGUI::updateUserNotifications (   $update_all_users = false)
private

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

References ilForum\_getModerators().

Referenced by updateNotificationSettings().

537  {
538  $oParticipants = $this->getParticipants();
539 
540  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
541  $moderator_ids = ilForum::_getModerators($this->parent_obj->object->getRefId());
542 
543  $admin_ids = $oParticipants->getAdmins();
544  $member_ids = $oParticipants->getMembers();
545  $tutor_ids = $oParticipants->getTutors();
546 
547  $all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
548  $all_forum_users = array_unique($all_forum_users);
549 
550  $all_notis = $frm_noti->read();
551 
552  foreach ($all_forum_users as $user_id) {
553  $frm_noti->setUserId($user_id);
554 
555  $frm_noti->setAdminForce(1);
556  $frm_noti->setUserToggle($this->parent_obj->objProperties->isUserToggleNoti());
557 
558  if (array_key_exists($user_id, $all_notis) && $update_all_users) {
559  $frm_noti->update();
560  } else {
561  if ($frm_noti->existsNotification() == false) {
562  $frm_noti->insertAdminForce();
563  }
564  }
565  }
566  }
Class ilForumNotification.
static _getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
+ 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(), and disableHideUserToggleNoti().

◆ $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: