ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  }
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
+ 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 309 of file class.ilForumSettingsGUI.php.

References $data, and $type.

Referenced by showMembers().

310  {
311  foreach (array_filter([
312  'moderators' => $moderators,
313  'administrator' => $admins,
314  'tutors' => $tutors,
315  'members' => $members
316  ]) as $type => $data) {
317  $tbl_mod = new ilTable2GUI($this, 'showMembers');
318  $tbl_mod->setId('tbl_id_mod');
319  $tbl_mod->setFormAction($this->ctrl->getFormAction($this, 'showMembers'));
320  $tbl_mod->setTitle($this->lng->txt(strtolower($type)));
321 
322  $tbl_mod->addColumn('', '', '1%', true);
323  $tbl_mod->addColumn($this->lng->txt('login'), '', '10%');
324  $tbl_mod->addColumn($this->lng->txt('firstname'), '', '10%');
325  $tbl_mod->addColumn($this->lng->txt('lastname'), '', '10%');
326  $tbl_mod->addColumn($this->lng->txt('allow_user_toggle_noti'), '', '10%');
327  $tbl_mod->setSelectAllCheckbox('user_id');
328 
329  $tbl_mod->setRowTemplate('tpl.forums_members_row.html', 'Modules/Forum');
330  $tbl_mod->setData($data);
331 
332  $tbl_mod->addMultiCommand('enableHideUserToggleNoti', $this->lng->txt('enable_hide_user_toggle'));
333  $tbl_mod->addMultiCommand('disableHideUserToggleNoti', $this->lng->txt('disable_hide_user_toggle'));
334 
335  $this->tpl->setCurrentBlock(strtolower($type) . '_table');
336  $this->tpl->setVariable(strtoupper($type), $tbl_mod->getHTML());
337  }
338  }
$type
Class ilTable2GUI.
+ Here is the caller graph for this function:

◆ disableAdminForceNoti()

ilForumSettingsGUI::disableAdminForceNoti ( )

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

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

370  {
371  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
372  $this->parent_obj->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->parent_obj->error->MESSAGE);
373  }
374 
375  if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
376  ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'));
377  } else {
378  include_once 'Modules/Forum/classes/class.ilForumNotification.php';
379  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
380 
381  foreach ($_POST['user_id'] as $user_id) {
382  $frm_noti->setUserId((int) $user_id);
383  $is_enabled = $frm_noti->isAdminForceNotification();
384 
385  if ($is_enabled) {
386  $frm_noti->deleteAdminForce();
387  }
388  }
389 
390  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
391  }
392 
393  $this->showMembers();
394  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 426 of file class.ilForumSettingsGUI.php.

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

427  {
428  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
429  $this->parent_obj->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->parent_obj->error->MESSAGE);
430  }
431 
432  if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
433  ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'));
434  } else {
435  include_once 'Modules/Forum/classes/class.ilForumNotification.php';
436  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
437 
438  foreach ($_POST['user_id'] as $user_id) {
439  $frm_noti->setUserId((int) $user_id);
440  $is_enabled = $frm_noti->isAdminForceNotification();
441  $frm_noti->setUserToggle(0);
442  if ($is_enabled) {
443  $frm_noti->updateUserToggle();
444  } else {
445  $frm_noti->setAdminForce(1);
446  $frm_noti->insertAdminForce();
447  }
448  }
449 
450  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
451  }
452 
453  $this->showMembers();
454  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 340 of file class.ilForumSettingsGUI.php.

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

341  {
342  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
343  $this->parent_obj->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->parent_obj->error->MESSAGE);
344  }
345 
346  if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
347  ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'), true);
348  } else {
349  include_once 'Modules/Forum/classes/class.ilForumNotification.php';
350  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
351 
352  foreach ($_POST['user_id'] as $user_id) {
353  $frm_noti->setUserId((int) $user_id);
354  $is_enabled = $frm_noti->isAdminForceNotification();
355 
356  $frm_noti->setUserToggle(0);
357  if (!$is_enabled) {
358  $frm_noti->setAdminForce(1);
359  $frm_noti->insertAdminForce();
360  }
361  }
362 
363  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
364  }
365 
366  $this->showMembers();
367  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 396 of file class.ilForumSettingsGUI.php.

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

397  {
398  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
399  $this->parent_obj->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->parent_obj->error->MESSAGE);
400  }
401  if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
402  ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'));
403  } else {
404  include_once 'Modules/Forum/classes/class.ilForumNotification.php';
405  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
406 
407  foreach ($_POST['user_id'] as $user_id) {
408  $frm_noti->setUserId((int) $user_id);
409  $is_enabled = $frm_noti->isAdminForceNotification();
410  $frm_noti->setUserToggle(1);
411 
412  if (!$is_enabled) {
413  $frm_noti->setAdminForce(1);
414  $frm_noti->insertAdminForce();
415  } else {
416  $frm_noti->updateUserToggle();
417  }
418  }
419 
420  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
421  }
422 
423  $this->showMembers();
424  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 50 of file class.ilForumSettingsGUI.php.

References settingsTabs().

51  {
52  $cmd = $this->ctrl->getCmd();
53  switch (true) {
54  case method_exists($this, $cmd):
55  $this->settingsTabs();
56  $this->{$cmd}();
57  break;
58 
59  default:
60  $this->ctrl->redirect($this->parent_obj);
61  break;
62  }
63  }
+ Here is the call graph for this function:

◆ getCustomForm()

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

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

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

69  {
70  $this->settingsTabs();
71 
72  //sorting for sticky threads
73  $cb_sort = new ilCheckboxInputGUI($this->lng->txt('sorting_manual_sticky'), 'thread_sorting');
74  $cb_sort->setValue('1');
75  $cb_sort->setInfo($this->lng->txt('sticky_threads_always_on_top'));
76  $a_form->addItem($cb_sort);
77 
78  // sorting for postings
79  $rg_pro = new ilRadioGroupInputGUI($this->lng->txt('frm_default_view'), 'default_view');
80 
81  $rg_pro->addOption(new ilRadioOption($this->lng->txt('sort_by_posts'), ilForumProperties::VIEW_TREE));
82  $rg_sort_by_date = new ilRadioOption($this->lng->txt('sort_by_date'), ilForumProperties::VIEW_DATE);
83  $rg_pro->addOption($rg_sort_by_date);
84 
85  $view_direction_group_gui = new ilRadioGroupInputGUI('', 'default_view_sort_dir');
86  $view_desc = new ilRadioOption($this->lng->txt('descending_order'), ilForumProperties::VIEW_DATE_DESC);
87  $view_asc = new ilRadioOption($this->lng->txt('ascending_order'), ilForumProperties::VIEW_DATE_ASC);
88  $view_direction_group_gui->addOption($view_desc);
89  $view_direction_group_gui->addOption($view_asc);
90 
91  $rg_sort_by_date->addSubItem($view_direction_group_gui);
92  $a_form->addItem($rg_pro);
93 
94  if ($this->settings->get('enable_anonymous_fora') || $this->parent_obj->objProperties->isAnonymized()) {
95  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('frm_anonymous_posting'), 'anonymized');
96  $cb_prop->setValue('1');
97  $cb_prop->setInfo($this->lng->txt('frm_anonymous_posting_desc'));
98  $a_form->addItem($cb_prop);
99  }
100 
101  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('mark_moderator_posts'), 'mark_mod_posts');
102  $cb_prop->setValue('1');
103  $cb_prop->setInfo($this->lng->txt('mark_moderator_posts_desc'));
104  $a_form->addItem($cb_prop);
105 
106  if ($this->settings->get('enable_fora_statistics', false)) {
107  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('frm_statistics_enabled'), 'statistics_enabled');
108  $cb_prop->setValue('1');
109  $cb_prop->setInfo($this->lng->txt('frm_statistics_enabled_desc'));
110  $a_form->addItem($cb_prop);
111  }
112 
113  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('activate_new_posts'), 'post_activation');
114  $cb_prop->setValue('1');
115  $cb_prop->setInfo($this->lng->txt('post_activation_desc'));
116  $a_form->addItem($cb_prop);
117 
118  $frm_subject = new ilRadioGroupInputGUI($this->lng->txt('frm_subject_setting'), 'subject_setting');
119  $frm_subject->addOption(new ilRadioOption($this->lng->txt('preset_subject'), 'preset_subject'));
120  $frm_subject->addOption(new ilRadioOption($this->lng->txt('add_re_to_subject'), 'add_re_to_subject'));
121  $frm_subject->addOption(new ilRadioOption($this->lng->txt('empty_subject'), 'empty_subject'));
122  $a_form->addItem($frm_subject);
123 
124  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('enable_thread_ratings'), 'thread_rating');
125  $cb_prop->setValue(1);
126  $cb_prop->setInfo($this->lng->txt('enable_thread_ratings_info'));
127  $a_form->addItem($cb_prop);
128 
130  $frm_upload = new ilCheckboxInputGUI($this->lng->txt('file_upload_allowed'), 'file_upload_allowed');
131  $frm_upload->setValue(1);
132  $frm_upload->setInfo($this->lng->txt('allow_file_upload_desc'));
133  $a_form->addItem($frm_upload);
134  }
135  }
This class represents an option in a radio group.
This class represents a checkbox property in a property form.
This class represents a property in a property form.
addOption($a_option)
Add Option.
addSubItem($a_item)
Add Subitem.
setValue($a_value)
Set Value.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ getCustomValues()

ilForumSettingsGUI::getCustomValues ( array $a_values)
Parameters
array$a_values

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

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

167  {
168  $a_values['default_view'] = $this->parent_obj->objProperties->getDefaultView();
169  $a_values['anonymized'] = $this->parent_obj->objProperties->isAnonymized();
170  $a_values['statistics_enabled'] = $this->parent_obj->objProperties->isStatisticEnabled();
171  $a_values['post_activation'] = $this->parent_obj->objProperties->isPostActivationEnabled();
172  $a_values['subject_setting'] = $this->parent_obj->objProperties->getSubjectSetting();
173  $a_values['mark_mod_posts'] = $this->parent_obj->objProperties->getMarkModeratorPosts();
174  $a_values['thread_sorting'] = $this->parent_obj->objProperties->getThreadSorting();
175  $a_values['thread_rating'] = $this->parent_obj->objProperties->isIsThreadRatingEnabled();
176 
177  $default_view = (int) $this->parent_obj->objProperties->getDefaultView() > ilForumProperties::VIEW_TREE
180 
181  $default_view_sort_dir = (int) $this->parent_obj->objProperties->getDefaultView() > ilForumProperties::VIEW_DATE_ASC
184 
185  $a_values['default_view'] = $default_view;
186  $a_values['default_view_sort_dir'] = $default_view_sort_dir;
187  $a_values['file_upload_allowed'] = (bool) $this->parent_obj->objProperties->getFileUploadAllowed();
188  }

◆ getIcon()

ilForumSettingsGUI::getIcon (   $user_toggle_noti)
protected

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

References ilUtil\getImagePath().

Referenced by getUserNotificationTableData().

282  {
283  $icon = $user_toggle_noti
284  ? "<img src=\"" . ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"" . $this->lng->txt("enabled") . "\" title=\"" . $this->lng->txt("enabled") . "\" border=\"0\" vspace=\"0\"/>"
285  : "<img src=\"" . ilUtil::getImagePath("icon_not_ok.svg") . "\" alt=\"" . $this->lng->txt("disabled") . "\" title=\"" . $this->lng->txt("disabled") . "\" border=\"0\" vspace=\"0\"/>";
286  return $icon;
287  }
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 289 of file class.ilForumSettingsGUI.php.

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

Referenced by showMembers().

290  {
291  $counter = 0;
292  $users = array();
293  foreach ($user_ids as $user_id) {
294  $frm_noti->setUserId($user_id);
295  $user_toggle_noti = $frm_noti->isUserToggleNotification();
296  $icon_ok = $this->getIcon(!$user_toggle_noti);
297 
298  $users[$counter]['user_id'] = ilUtil::formCheckbox(0, 'user_id[]', $user_id);
299  $users[$counter]['login'] = ilObjUser::_lookupLogin($user_id);
300  $name = ilObjUser::_lookupName($user_id);
301  $users[$counter]['firstname'] = $name['firstname'];
302  $users[$counter]['lastname'] = $name['lastname'];
303  $users[$counter]['user_toggle_noti'] = $icon_ok;
304  $counter++;
305  }
306  return $users;
307  }
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
$counter
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.
$users
Definition: authpage.php:44
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 524 of file class.ilForumSettingsGUI.php.

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

Referenced by showMembers(), and updateNotificationSettings().

525  {
526  if (null === $this->notificationSettingsForm) {
527  $form = new ilPropertyFormGUI();
528  $form->setFormAction($this->ctrl->getFormAction($this, 'updateNotificationSettings'));
529  $form->setTitle($this->lng->txt('forums_notification_settings'));
530 
531  $radio_grp = new ilRadioGroupInputGUI('', 'notification_type');
532  $radio_grp->setValue('default');
533 
534  $opt_default = new ilRadioOption($this->lng->txt("user_decides_notification"), 'default');
535  $opt_0 = new ilRadioOption($this->lng->txt("settings_for_all_members"), 'all_users');
536  $opt_1 = new ilRadioOption($this->lng->txt("settings_per_users"), 'per_user');
537 
538  $radio_grp->addOption($opt_default);
539  $radio_grp->addOption($opt_0);
540  $radio_grp->addOption($opt_1);
541 
542  $chb_2 = new ilCheckboxInputGUI($this->lng->txt('user_toggle_noti'), 'usr_toggle');
543  $chb_2->setValue(1);
544 
545  $opt_0->addSubItem($chb_2);
546  $form->addItem($radio_grp);
547 
548  $form->addCommandButton('updateNotificationSettings', $this->lng->txt('save'));
549 
550  $this->notificationSettingsForm = $form;
551 
552  return false;
553  }
554 
555  return true;
556  }
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 140 of file class.ilForumSettingsGUI.php.

References $_GET, array, and settings().

Referenced by executeCommand(), and getCustomForm().

141  {
142  $this->tabs->activateTab('settings');
143  $this->tabs->addSubTabTarget('basic_settings', $this->ctrl->getLinkTarget($this->parent_obj, 'edit'), '', 'ilobjforumgui');
144 
145  if ($this->settings->get('forum_notification') > 0) {
146  // check if there a parent-node is a grp or crs
147  $grp_ref_id = $this->tree->checkForParentType($this->parent_obj->ref_id, 'grp');
148  $crs_ref_id = $this->tree->checkForParentType($this->parent_obj->ref_id, 'crs');
149 
150  if ((int) $grp_ref_id > 0 || (int) $crs_ref_id > 0) {
151  #show member-tab for notification if forum-notification is enabled in administration
152  if ($this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
153  $mem_active = array('showMembers', 'forums_notification_settings');
154  (in_array($_GET['cmd'], $mem_active)) ? $force_mem_active = true : $force_mem_active = false;
155 
156  $this->tabs->addSubTabTarget('notifications', $this->ctrl->getLinkTarget($this, 'showMembers'), '', get_class($this), '', $force_mem_active);
157  }
158  }
159  }
160  return true;
161  }
$_GET["client_id"]
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMembers()

ilForumSettingsGUI::showMembers ( )

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

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

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

230  {
231  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
232  $this->parent_obj->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->parent_obj->error->MESSAGE);
233  }
234 
235  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_members_list.html', 'Modules/Forum');
236 
237  $this->tabs->activateTab('settings');
238 
239  // instantiate the property form
240  if (!$this->initNotificationSettingsForm()) {
241  // if the form was just created set the values fetched from database
242  $this->notificationSettingsForm->setValuesByArray(array(
243  'notification_type' => $this->parent_obj->objProperties->getNotificationType(),
244  'adm_force' => (bool) $this->parent_obj->objProperties->isAdminForceNoti(),
245  'usr_toggle' => (bool) $this->parent_obj->objProperties->isUserToggleNoti()
246  ));
247  }
248 
249  // set form html into template
250  $this->tpl->setVariable('NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
251 
252  include_once 'Modules/Forum/classes/class.ilForumNotification.php';
253  include_once 'Modules/Forum/classes/class.ilObjForum.php';
254 
255  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
256  $oParticipants = $this->getParticipants();
257 
258  $moderator_ids = ilForum::_getModerators($this->parent_obj->object->getRefId());
259 
260  $admin_ids = $oParticipants->getAdmins();
261  $member_ids = $oParticipants->getMembers();
262  $tutor_ids = $oParticipants->getTutors();
263 
264  if ($this->parent_obj->objProperties->getNotificationType() == 'default') {
265  // update forum_notification table
266  include_once 'Modules/Forum/classes/class.ilForumNotification.php';
267  $forum_noti = new ilForumNotification($this->parent_obj->object->getRefId());
268  $forum_noti->setAdminForce($this->parent_obj->objProperties->isAdminForceNoti());
269  $forum_noti->setUserToggle($this->parent_obj->objProperties->isUserToggleNoti());
270  $forum_noti->setForumId($this->parent_obj->objProperties->getObjId());
271  } elseif ($this->parent_obj->objProperties->getNotificationType() == 'per_user') {
272  $moderators = $this->getUserNotificationTableData($moderator_ids, $frm_noti);
273  $admins = $this->getUserNotificationTableData($admin_ids, $frm_noti);
274  $members = $this->getUserNotificationTableData($member_ids, $frm_noti);
275  $tutors = $this->getUserNotificationTableData($tutor_ids, $frm_noti);
276 
277  $this->__showMembersTable($moderators, $admins, $members, $tutors);
278  }
279  }
getUserNotificationTableData($user_ids, ilForumNotification $frm_noti)
Class ilForumNotification.
Create styles array
The data for the language used.
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 193 of file class.ilForumSettingsGUI.php.

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

194  {
195  $default_view = (int) $a_form->getInput('default_view') > ilForumProperties::VIEW_TREE
198 
199  if ($default_view == ilForumProperties::VIEW_DATE) {
200  (int) $a_form->getInput('default_view_sort_dir') > ilForumProperties::VIEW_DATE_ASC
201  ? $default_view = ilForumProperties::VIEW_DATE_DESC
202  : $default_view = ilForumProperties::VIEW_DATE_ASC;
203  }
204 
205  $this->parent_obj->objProperties->setDefaultView($default_view);
206 
207  // BUGFIX FOR 11271
208  if (isset($_SESSION['viewmode'])) {
209  $_SESSION['viewmode'] = $default_view;
210  }
211 
212  if ($this->settings->get('enable_anonymous_fora') || $this->parent_obj->objProperties->isAnonymized()) {
213  $this->parent_obj->objProperties->setAnonymisation((int) $a_form->getInput('anonymized'));
214  }
215  if ($this->settings->get('enable_fora_statistics', false)) {
216  $this->parent_obj->objProperties->setStatisticsStatus((int) $a_form->getInput('statistics_enabled'));
217  }
218  $this->parent_obj->objProperties->setPostActivation((int) $a_form->getInput('post_activation'));
219  $this->parent_obj->objProperties->setSubjectSetting($a_form->getInput('subject_setting'));
220  $this->parent_obj->objProperties->setMarkModeratorPosts((int) $a_form->getInput('mark_mod_posts'));
221  $this->parent_obj->objProperties->setThreadSorting((int) $a_form->getInput('thread_sorting'));
222  $this->parent_obj->objProperties->setIsThreadRatingEnabled((bool) $a_form->getInput('thread_rating'));
224  $this->parent_obj->objProperties->setFileUploadAllowed((bool) $a_form->getInput('file_upload_allowed'));
225  }
226  $this->parent_obj->objProperties->update();
227  }
$_SESSION["AccountId"]
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ updateNotificationSettings()

ilForumSettingsGUI::updateNotificationSettings ( )

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

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

559  {
560  if (!$this->access->checkAccess('write', '', $this->parent_obj->ref_id)) {
561  $this->parent_obj->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->parent_obj->error->MESSAGE);
562  }
563 
564  // instantiate the property form
566 
567  // check input
568  if ($this->notificationSettingsForm->checkInput()) {
569  if (isset($_POST['notification_type']) && $_POST['notification_type']== 'all_users') {
570  // set values and call update
571  $this->parent_obj->objProperties->setAdminForceNoti(1);
572  $this->parent_obj->objProperties->setUserToggleNoti((int) $this->notificationSettingsForm->getInput('usr_toggle'));
573  $this->parent_obj->objProperties->setNotificationType('all_users');
574  $this->updateUserNotifications(true);
575  } elseif ($_POST['notification_type']== 'per_user') {
576  $this->parent_obj->objProperties->setNotificationType('per_user');
577  $this->parent_obj->objProperties->setAdminForceNoti(1);
578  $this->parent_obj->objProperties->setUserToggleNoti(0);
579  $this->updateUserNotifications();
580  } else { // if($_POST['notification_type'] == 'default')
581  $this->parent_obj->objProperties->setNotificationType('default');
582  $this->parent_obj->objProperties->setAdminForceNoti(0);
583  $this->parent_obj->objProperties->setUserToggleNoti(0);
584  include_once 'Modules/Forum/classes/class.ilForumNotification.php';
585  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
586  $frm_noti->deleteNotificationAllUsers();
587  }
588 
589  $this->parent_obj->objProperties->update();
590 
591  // print success message
592  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
593  }
594  $this->notificationSettingsForm->setValuesByPost();
595 
596  $this->showMembers();
597  return;
598  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 492 of file class.ilForumSettingsGUI.php.

References ilForum\_getModerators().

Referenced by updateNotificationSettings().

493  {
494  include_once 'Modules/Forum/classes/class.ilForumNotification.php';
495 
496  $oParticipants = $this->getParticipants();
497 
498  $frm_noti = new ilForumNotification($this->parent_obj->object->getRefId());
499  $moderator_ids = ilForum::_getModerators($this->parent_obj->object->getRefId());
500 
501  $admin_ids = $oParticipants->getAdmins();
502  $member_ids = $oParticipants->getMembers();
503  $tutor_ids = $oParticipants->getTutors();
504 
505  $all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
506  $all_forum_users= array_unique($all_forum_users);
507 
508  $all_notis = $frm_noti->read();
509 
510  foreach ($all_forum_users as $user_id) {
511  $frm_noti->setUserId($user_id);
512 
513  $frm_noti->setAdminForce(1);
514  $frm_noti->setUserToggle($this->parent_obj->objProperties->isUserToggleNoti());
515 
516  if (array_key_exists($user_id, $all_notis) && $update_all_users) {
517  $frm_noti->update();
518  } elseif ($frm_noti->existsNotification() == false) {
519  $frm_noti->insertAdminForce();
520  }
521  }
522  }
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: