Add setting "disable_delete_all_announcements"

See BT#13077
pull/2487/head
jmontoyaa 8 years ago
parent 39335784ac
commit f5a06b94d3
  1. 23
      main/announcements/announcements.php
  2. 3
      main/install/configuration.dist.php

@ -314,9 +314,13 @@ switch ($action) {
break; break;
case 'delete_all': case 'delete_all':
if (api_is_allowed_to_edit()) { if (api_is_allowed_to_edit()) {
AnnouncementManager::delete_all_announcements($_course); $allow = api_get_configuration_value('disable_delete_all_announcements');
Display::addFlash(Display::return_message(get_lang('AnnouncementDeletedAll'))); if ($allow === false) {
header('Location: '.$homeUrl); AnnouncementManager::delete_all_announcements($_course);
Display::addFlash(Display::return_message(get_lang('AnnouncementDeletedAll')));
}
header('Location: ' . $homeUrl);
exit; exit;
} }
break; break;
@ -668,16 +672,19 @@ if ($allowToEdit && (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath')
} }
} }
if ($allowToEdit) { if ($allowToEdit && api_get_group_id() == 0) {
if (api_get_group_id() == 0) { $allow = api_get_configuration_value('disable_delete_all_announcements');
if (!isset($_GET['action'])) { if ($allow === false) {
$actionsLeft .= "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete_all\" onclick=\"javascript:if(!confirm('".get_lang("ConfirmYourChoice")."')) return false;\">". if (!isset($_GET['action']) ||
isset($_GET['action']) && $_GET['action'] == 'list'
) {
$actionsLeft .= "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&action=delete_all\" onclick=\"javascript:if(!confirm('" . get_lang("ConfirmYourChoice") . "')) return false;\">" .
Display::return_icon( Display::return_icon(
'delete_announce.png', 'delete_announce.png',
get_lang('AnnouncementDeleteAll'), get_lang('AnnouncementDeleteAll'),
'', '',
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
)."</a>"; ) . "</a>";
} }
} }
} }

@ -618,6 +618,9 @@ $_configuration['gradebook_badge_sidebar'] = [
// Hide base course announcements when entering a group. // Hide base course announcements when entering a group.
//$_configuration['hide_base_course_announcements_in_group'] = false; //$_configuration['hide_base_course_announcements_in_group'] = false;
// Disable delete all announcements button
//$_configuration['disable_delete_all_announcements'] = false;
// Allow or block user subcriptions to a lp/lp category // Allow or block user subcriptions to a lp/lp category
/*$_configuration['lp_subscription_settings'] = [ /*$_configuration['lp_subscription_settings'] = [
'options' => [ 'options' => [

Loading…
Cancel
Save