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

@ -618,6 +618,9 @@ $_configuration['gradebook_badge_sidebar'] = [
// Hide base course announcements when entering a group.
//$_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
/*$_configuration['lp_subscription_settings'] = [
'options' => [

Loading…
Cancel
Save