mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-29450 improve and cleanup course content removal
New keep roles/enrolments and groups/groupings options, notification CSS fixed, standardised notification texts, added missing delete of module blocks, fixed file deleting and some other minor issues.
This commit is contained in:
parent
79b0fece1f
commit
16ef46e7b6
5 changed files with 207 additions and 126 deletions
|
@ -316,7 +316,7 @@ function groups_delete_group($grouporid) {
|
|||
|
||||
/**
|
||||
* Delete grouping
|
||||
* @param int $groupingid
|
||||
* @param int $groupingorid
|
||||
* @return bool success
|
||||
*/
|
||||
function groups_delete_grouping($groupingorid) {
|
||||
|
@ -389,7 +389,7 @@ function groups_delete_group_members($courseid, $userid=0, $showfeedback=false)
|
|||
events_trigger('groups_members_removed', $eventdata);
|
||||
|
||||
if ($showfeedback) {
|
||||
echo $OUTPUT->notification(get_string('deleted').' groups_members');
|
||||
echo $OUTPUT->notification(get_string('deleted').' - '.get_string('groupmembers', 'group'), 'notifysuccess');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -407,15 +407,10 @@ function groups_delete_groupings_groups($courseid, $showfeedback=false) {
|
|||
$groupssql = "SELECT id FROM {groups} g WHERE g.courseid = ?";
|
||||
$DB->delete_records_select('groupings_groups', "groupid IN ($groupssql)", array($courseid));
|
||||
|
||||
// Delete all files associated with groupings for this course
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
|
||||
//trigger groups events
|
||||
events_trigger('groups_groupings_groups_removed', $courseid);
|
||||
|
||||
if ($showfeedback) {
|
||||
echo $OUTPUT->notification(get_string('deleted').' groupings_groups');
|
||||
}
|
||||
// no need to show any feedback here - we delete usually first groupings and then groups
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -449,11 +444,11 @@ function groups_delete_groups($courseid, $showfeedback=false) {
|
|||
|
||||
$DB->delete_records('groups', array('courseid'=>$courseid));
|
||||
|
||||
//trigger groups events
|
||||
// trigger groups events
|
||||
events_trigger('groups_groups_deleted', $courseid);
|
||||
|
||||
if ($showfeedback) {
|
||||
echo $OUTPUT->notification(get_string('deleted').' groups');
|
||||
echo $OUTPUT->notification(get_string('deleted').' - '.get_string('groups', 'group'), 'notifysuccess');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -468,9 +463,6 @@ function groups_delete_groups($courseid, $showfeedback=false) {
|
|||
function groups_delete_groupings($courseid, $showfeedback=false) {
|
||||
global $DB, $OUTPUT;
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$fs = get_file_storage();
|
||||
|
||||
// delete any uses of groupings
|
||||
$sql = "DELETE FROM {groupings_groups}
|
||||
WHERE groupingid in (SELECT id FROM {groupings} g WHERE g.courseid = ?)";
|
||||
|
@ -488,11 +480,11 @@ function groups_delete_groupings($courseid, $showfeedback=false) {
|
|||
|
||||
$DB->delete_records('groupings', array('courseid'=>$courseid));
|
||||
|
||||
//trigger groups events
|
||||
// trigger groups events
|
||||
events_trigger('groups_groupings_deleted', $courseid);
|
||||
|
||||
if ($showfeedback) {
|
||||
echo $OUTPUT->notification(get_string('deleted').' groupings');
|
||||
echo $OUTPUT->notification(get_string('deleted').' - '.get_string('groupings', 'group'), 'notifysuccess');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue