Add "hide_forum_notifications" course option see BT#15173

pull/3063/head
Julio 7 years ago
parent c317672bda
commit c2d0eab44b
  1. 7
      main/course_info/infocours.php
  2. 46
      main/forum/index.php
  3. 10
      main/forum/viewforum.php
  4. 1
      main/inc/lib/course.lib.php

@ -864,8 +864,15 @@ $group = [
];
$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true);
// Forum settings
$groupNotification = [
$form->createElement('radio', 'hide_forum_notifications', null, get_lang('Yes'), 1),
$form->createElement('radio', 'hide_forum_notifications', null, get_lang('No'), 2),
];
$globalGroup = [
get_lang('EnableForumAutoLaunch') => $group,
get_lang('HideForumNotifications') => $groupNotification,
'' => $myButton,
];

@ -47,6 +47,9 @@ $_course = api_get_course_info();
$sessionId = api_get_session_id();
$_user = api_get_user_info();
$hideNotifications = api_get_course_setting('hide_forum_notifications');
$hideNotifications = $hideNotifications == 1;
// Including necessary files.
require_once 'forumconfig.inc.php';
require_once 'forumfunction.inc.php';
@ -456,25 +459,28 @@ if (is_array($forumCategories)) {
$toolActions = null;
$forumInfo['alert'] = null;
// The number of topics and posts.
if ($forum['forum_of_group'] !== '0') {
if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) {
$forumInfo['alert'] = ' '.
Display::return_icon(
'alert.png',
get_lang('Forum'),
null,
ICON_SIZE_SMALL
);
}
} else {
if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) {
$forumInfo['alert'] = ' '.Display::return_icon(
'alert.png',
get_lang('Forum'),
null,
ICON_SIZE_SMALL
);
if ($hideNotifications == false) {
// The number of topics and posts.
if ($forum['forum_of_group'] !== '0') {
if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) {
$forumInfo['alert'] = ' '.
Display::return_icon(
'alert.png',
get_lang('Forum'),
null,
ICON_SIZE_SMALL
);
}
} else {
if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) {
$forumInfo['alert'] = ' '.Display::return_icon(
'alert.png',
get_lang('Forum'),
null,
ICON_SIZE_SMALL
);
}
}
}
$poster_id = null;
@ -551,7 +557,7 @@ if (is_array($forumCategories)) {
}
}
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true) && $hideNotifications == false) {
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=notify&content=forum&id='.$forum['forum_id'].'">'
.Display::return_icon($iconnotify, get_lang('NotifyMe'), null, ICON_SIZE_SMALL)

@ -49,6 +49,9 @@ $courseId = api_get_course_int_id();
$groupInfo = GroupManager::get_group_properties($groupId);
$isTutor = GroupManager::is_tutor_of_group($userId, $groupInfo, $courseId);
$hideNotifications = api_get_course_setting('hide_forum_notifications');
$hideNotifications = $hideNotifications == 1;
$isAllowedToEdit = api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true);
/* MAIN DISPLAY SECTION */
@ -434,10 +437,9 @@ if (is_array($threads)) {
$my_whatsnew_post_info = $whatsnew_post_info[$my_forum][$row['thread_id']];
}
if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
$newPost = '';
if ($hideNotifications == false && is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
$newPost = ' '.Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
} else {
$newPost = '';
}
$name = api_get_person_name($row['firstname'], $row['lastname']);
@ -639,7 +641,7 @@ if (is_array($threads)) {
}
}
$icon_liststd = 'user.png';
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true) && $hideNotifications == false) {
$iconsEdit .= '<a href="'.api_get_self().'?'.$cidreq.'&forum='
.$my_forum
."&action=notify&content=thread&id={$row['thread_id']}"

@ -5577,6 +5577,7 @@ class CourseManager
'show_course_in_user_language',
'email_to_teachers_on_new_work_feedback',
'student_delete_own_publication',
'hide_forum_notifications',
];
$courseModels = ExerciseLib::getScoreModels();

Loading…
Cancel
Save