ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 $this->obj_service = $DIC->object();
46 }
47
51 public function executeCommand()
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 }
65
69 public function getCustomForm(&$a_form)
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 }
162
166 public function settingsTabs()
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 }
209
213 public function getCustomValues(array &$a_values)
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 }
236
240 public function updateCustomValues(ilPropertyFormGUI $a_form)
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 }
275
276 public function showMembers()
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 }
326
327 protected function getIcon($user_toggle_noti)
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 }
334
335 private function getUserNotificationTableData($user_ids, ilForumNotification $frm_noti)
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 }
354
355 private function __showMembersTable(array $moderators, array $admins, array $members, array $tutors)
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 }
385
386 public function enableAdminForceNoti()
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 }
416
417 public function disableAdminForceNoti()
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 }
445
446 public function enableHideUserToggleNoti()
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 }
477
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 }
509
510
514 public function getParticipants()
515 {
516 if ($this->parent_obj->isParentObjectCrsOrGrp() == false) {
517 $this->parent_obj->error->raiseError(
518 $this->lng->txt('msg_no_perm_read'),
519 $this->parent_obj->error->MESSAGE
520 );
521 }
522
526 $oParticipants = null;
527
528 $grp_ref_id = $this->tree->checkForParentType($this->parent_obj->object->getRefId(), 'grp');
529 $crs_ref_id = $this->tree->checkForParentType($this->parent_obj->object->getRefId(), 'crs');
530 if ($grp_ref_id > 0) {
532 $oParticipants = ilGroupParticipants::_getInstanceByObjId($parent_obj->getId());
533 return $oParticipants;
534 } else {
535 if ($crs_ref_id > 0) {
537
539 return $oParticipants;
540 }
541 }
542
543 return $oParticipants;
544 }
545
546
547 private function updateUserNotifications($update_all_users = false)
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 }
578
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 }
612
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 }
658}
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
This class represents a section header in a property form.
Class ilForumNotification.
Class ilForumSettingsGUI.
__showMembersTable(array $moderators, array $admins, array $members, array $tutors)
__construct(ilObjForumGUI $parent_obj)
ilForumSettingsGUI constructor.
getUserNotificationTableData($user_ids, ilForumNotification $frm_noti)
updateCustomValues(ilPropertyFormGUI $a_form)
updateUserNotifications($update_all_users=false)
getCustomValues(array &$a_values)
static _getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Class ilObjForumGUI.
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
This class represents a property form user interface.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
This class represents a property in a property form.
This class represents an option in a radio group.
Class ilTable2GUI.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if($format !==null) $name
Definition: metadata.php:230
$type
settings()
Definition: settings.php:2
$data
Definition: storeScorm.php:23
$DIC
Definition: xapitoken.php:46