ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilForumSettingsGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
10  private $ctrl;
11  private $tpl;
12  private $lng;
13  private $settings;
14  private $tabs;
15  private $access;
16  private $tree;
17  private $parent_obj;
18 
22  protected $form;
23 
28 
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  }
46 
50  public function executeCommand()
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  }
64 
68  public function getCustomForm(&$a_form)
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  }
136 
140  public function settingsTabs()
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  }
162 
166  public function getCustomValues(array &$a_values)
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  }
189 
193  public function updateCustomValues(ilPropertyFormGUI $a_form)
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  }
228 
229  public function showMembers()
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  }
280 
281  protected function getIcon($user_toggle_noti)
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  }
288 
289  private function getUserNotificationTableData($user_ids, ilForumNotification $frm_noti)
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  }
308 
309  private function __showMembersTable(array $moderators, array $admins, array $members, array $tutors)
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  }
339 
340  public function enableAdminForceNoti()
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  }
368 
369  public function disableAdminForceNoti()
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  }
395 
396  public function enableHideUserToggleNoti()
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  }
425 
426  public function disableHideUserToggleNoti()
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  }
455 
456 
457 
461  public function getParticipants()
462  {
463  if ($this->parent_obj->isParentObjectCrsOrGrp() == false) {
464  $this->parent_obj->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->parent_obj->error->MESSAGE);
465  }
466 
470  $oParticipants = null;
471 
472  $grp_ref_id = $this->tree->checkForParentType($this->parent_obj->object->getRefId(), 'grp');
473  $crs_ref_id = $this->tree->checkForParentType($this->parent_obj->object->getRefId(), 'crs');
474  if ($grp_ref_id > 0) {
476  include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
477  $oParticipants = ilGroupParticipants::_getInstanceByObjId($parent_obj->getId());
478  return $oParticipants;
479  } elseif ($crs_ref_id > 0) {
481 
482  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
483  $oParticipants = ilCourseParticipants::_getInstanceByObjId($parent_obj->getId());
484  return $oParticipants;
485  }
486 
487  return $oParticipants;
488  }
489 
490 
491 
492  private function updateUserNotifications($update_all_users = false)
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  }
523 
524  private function initNotificationSettingsForm()
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  }
557 
558  public function updateNotificationSettings()
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  }
599 }
getUserNotificationTableData($user_ids, ilForumNotification $frm_noti)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
This class represents an option in a radio group.
$_SESSION["AccountId"]
This class represents a property form user interface.
$type
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
This class represents a checkbox property in a property form.
Class ilForumSettingsGUI.
Class ilForumNotification.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$counter
if($format !==null) $name
Definition: metadata.php:146
updateUserNotifications($update_all_users=false)
This class represents a property in a property form.
addOption($a_option)
Add Option.
Class ilTable2GUI.
addSubItem($a_item)
Add Subitem.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class ilObjForumGUI.
setValue($a_value)
Set Value.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
__construct(ilObjForumGUI $parent_obj)
ilForumSettingsGUI constructor.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Create styles array
The data for the language used.
$users
Definition: authpage.php:44
updateCustomValues(ilPropertyFormGUI $a_form)
getCustomValues(array &$a_values)
settings()
Definition: settings.php:2
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
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)
$_POST["username"]
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public