38 $this->ctrl = $DIC->ctrl();
39 $this->tpl = $DIC->ui()->mainTemplate();
40 $this->lng = $DIC->language();
42 $this->tabs = $DIC->tabs();
43 $this->access = $DIC->access();
44 $this->tree = $DIC->repositoryTree();
52 $cmd = $this->ctrl->getCmd();
54 case method_exists($this, $cmd):
60 $this->ctrl->redirect($this->parent_obj);
73 $cb_sort =
new ilCheckboxInputGUI($this->lng->txt(
'sorting_manual_sticky'),
'thread_sorting');
75 $cb_sort->setInfo($this->lng->txt(
'sticky_threads_always_on_top'));
76 $a_form->addItem($cb_sort);
83 $rg_pro->addOption($rg_sort_by_date);
88 $view_direction_group_gui->addOption($view_desc);
89 $view_direction_group_gui->addOption($view_asc);
91 $rg_sort_by_date->
addSubItem($view_direction_group_gui);
92 $a_form->addItem($rg_pro);
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');
97 $cb_prop->setInfo($this->lng->txt(
'frm_anonymous_posting_desc'));
98 $a_form->addItem($cb_prop);
101 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'mark_moderator_posts'),
'mark_mod_posts');
103 $cb_prop->setInfo($this->lng->txt(
'mark_moderator_posts_desc'));
104 $a_form->addItem($cb_prop);
106 if ($this->
settings->get(
'enable_fora_statistics',
false)) {
107 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'frm_statistics_enabled'),
'statistics_enabled');
109 $cb_prop->setInfo($this->lng->txt(
'frm_statistics_enabled_desc'));
110 $a_form->addItem($cb_prop);
113 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'activate_new_posts'),
'post_activation');
115 $cb_prop->setInfo($this->lng->txt(
'post_activation_desc'));
116 $a_form->addItem($cb_prop);
118 $frm_subject =
new ilRadioGroupInputGUI($this->lng->txt(
'frm_subject_setting'),
'subject_setting');
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);
124 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'enable_thread_ratings'),
'thread_rating');
126 $cb_prop->setInfo($this->lng->txt(
'enable_thread_ratings_info'));
127 $a_form->addItem($cb_prop);
130 $frm_upload =
new ilCheckboxInputGUI($this->lng->txt(
'file_upload_allowed'),
'file_upload_allowed');
132 $frm_upload->setInfo($this->lng->txt(
'allow_file_upload_desc'));
133 $a_form->addItem($frm_upload);
142 $this->tabs->activateTab(
'settings');
143 $this->tabs->addSubTabTarget(
'basic_settings', $this->ctrl->getLinkTarget($this->parent_obj,
'edit'),
'',
'ilobjforumgui');
145 if ($this->
settings->get(
'forum_notification') > 0) {
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');
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;
156 $this->tabs->addSubTabTarget(
'notifications', $this->ctrl->getLinkTarget($this,
'showMembers'),
'', get_class($this),
'', $force_mem_active);
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();
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();
205 $this->parent_obj->objProperties->setDefaultView($default_view);
212 if ($this->
settings->get(
'enable_anonymous_fora') || $this->parent_obj->objProperties->isAnonymized()) {
213 $this->parent_obj->objProperties->setAnonymisation((
int) $a_form->
getInput(
'anonymized'));
215 if ($this->
settings->get(
'enable_fora_statistics',
false)) {
216 $this->parent_obj->objProperties->setStatisticsStatus((
int) $a_form->
getInput(
'statistics_enabled'));
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'));
226 $this->parent_obj->objProperties->update();
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);
235 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_members_list.html',
'Modules/Forum');
237 $this->tabs->activateTab(
'settings');
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()
250 $this->tpl->setVariable(
'NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
252 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
253 include_once
'Modules/Forum/classes/class.ilObjForum.php';
256 $oParticipants = $this->getParticipants();
260 $admin_ids = $oParticipants->getAdmins();
261 $member_ids = $oParticipants->getMembers();
262 $tutor_ids = $oParticipants->getTutors();
264 if ($this->parent_obj->objProperties->getNotificationType() ==
'default') {
266 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
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') {
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\"/>";
293 foreach ($user_ids as $user_id) {
296 $icon_ok = $this->
getIcon(!$user_toggle_noti);
311 foreach (array_filter([
312 'moderators' => $moderators,
313 'administrator' => $admins,
315 'members' => $members
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)));
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');
329 $tbl_mod->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
330 $tbl_mod->setData(
$data);
332 $tbl_mod->addMultiCommand(
'enableHideUserToggleNoti', $this->lng->txt(
'enable_hide_user_toggle'));
333 $tbl_mod->addMultiCommand(
'disableHideUserToggleNoti', $this->lng->txt(
'disable_hide_user_toggle'));
335 $this->tpl->setCurrentBlock(strtolower(
$type) .
'_table');
336 $this->tpl->setVariable(strtoupper(
$type), $tbl_mod->getHTML());
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);
346 if (!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id'])) {
349 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
352 foreach (
$_POST[
'user_id'] as $user_id) {
354 $is_enabled = $frm_noti->isAdminForceNotification();
356 $frm_noti->setUserToggle(0);
358 $frm_noti->setAdminForce(1);
359 $frm_noti->insertAdminForce();
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);
375 if (!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id'])) {
378 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
381 foreach (
$_POST[
'user_id'] as $user_id) {
383 $is_enabled = $frm_noti->isAdminForceNotification();
386 $frm_noti->deleteAdminForce();
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);
401 if (!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id'])) {
404 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
407 foreach (
$_POST[
'user_id'] as $user_id) {
409 $is_enabled = $frm_noti->isAdminForceNotification();
410 $frm_noti->setUserToggle(1);
413 $frm_noti->setAdminForce(1);
414 $frm_noti->insertAdminForce();
416 $frm_noti->updateUserToggle();
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);
432 if (!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id'])) {
435 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
438 foreach (
$_POST[
'user_id'] as $user_id) {
440 $is_enabled = $frm_noti->isAdminForceNotification();
441 $frm_noti->setUserToggle(0);
443 $frm_noti->updateUserToggle();
445 $frm_noti->setAdminForce(1);
446 $frm_noti->insertAdminForce();
461 public function getParticipants()
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);
470 $oParticipants = null;
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';
478 return $oParticipants;
479 } elseif ($crs_ref_id > 0) {
482 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
484 return $oParticipants;
487 return $oParticipants;
494 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
496 $oParticipants = $this->getParticipants();
501 $admin_ids = $oParticipants->getAdmins();
502 $member_ids = $oParticipants->getMembers();
503 $tutor_ids = $oParticipants->getTutors();
505 $all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
506 $all_forum_users= array_unique($all_forum_users);
508 $all_notis = $frm_noti->read();
510 foreach ($all_forum_users as $user_id) {
511 $frm_noti->setUserId($user_id);
513 $frm_noti->setAdminForce(1);
514 $frm_noti->setUserToggle($this->parent_obj->objProperties->isUserToggleNoti());
516 if (array_key_exists($user_id, $all_notis) && $update_all_users) {
518 } elseif ($frm_noti->existsNotification() ==
false) {
519 $frm_noti->insertAdminForce();
526 if (null === $this->notificationSettingsForm) {
528 $form->setFormAction($this->ctrl->getFormAction($this,
'updateNotificationSettings'));
529 $form->setTitle($this->lng->txt(
'forums_notification_settings'));
532 $radio_grp->setValue(
'default');
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');
538 $radio_grp->addOption($opt_default);
539 $radio_grp->addOption($opt_0);
540 $radio_grp->addOption($opt_1);
546 $form->addItem($radio_grp);
548 $form->addCommandButton(
'updateNotificationSettings', $this->lng->txt(
'save'));
550 $this->notificationSettingsForm =
$form;
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);
568 if ($this->notificationSettingsForm->checkInput()) {
569 if (isset(
$_POST[
'notification_type']) &&
$_POST[
'notification_type']==
'all_users') {
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');
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);
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';
589 $this->parent_obj->objProperties->update();
594 $this->notificationSettingsForm->setValuesByPost();
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.
disableHideUserToggleNoti()
deleteNotificationAllUsers()
initNotificationSettingsForm()
isUserToggleNotification()
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
setAdminForce($a_admin_force)
Class ilForumSettingsGUI.
getIcon($user_toggle_noti)
Class ilForumNotification.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
updateUserNotifications($update_all_users=false)
addSubItem($a_item)
Add Subitem.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
updateNotificationSettings()
enableHideUserToggleNoti()
__construct(ilObjForumGUI $parent_obj)
ilForumSettingsGUI constructor.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Create styles array
The data for the language used.
updateCustomValues(ilPropertyFormGUI $a_form)
getCustomValues(array &$a_values)
$notificationSettingsForm
static isFileUploadGloballyAllowed()
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)
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public