mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
Merge branch 'backup_groups_master' of git://github.com/stronk7/moodle
This commit is contained in:
commit
8b6c283f94
@ -75,8 +75,15 @@ class backup_course_task extends backup_task {
|
||||
// Generate the enrolment file
|
||||
$this->add_step(new backup_enrolments_structure_step('course_enrolments', 'enrolments.xml'));
|
||||
|
||||
// Annotate the groups used in already annotated groupings
|
||||
$this->add_step(new backup_annotate_groups_from_groupings('annotate_groups'));
|
||||
// Annotate all the groups and groupings belonging to the course
|
||||
$this->add_step(new backup_annotate_course_groups_and_groupings('annotate_course_groups'));
|
||||
|
||||
// Annotate the groups used in already annotated groupings (note this may be
|
||||
// unnecessary now that we are annotating all the course groups and groupings in the
|
||||
// step above. But we keep it working in case we decide, someday, to introduce one
|
||||
// setting to transform the step above into an optional one. This is here to support
|
||||
// course->defaultgroupingid
|
||||
$this->add_step(new backup_annotate_groups_from_groupings('annotate_groups_from_groupings'));
|
||||
|
||||
// Annotate the question_categories belonging to the course context
|
||||
$this->add_step(new backup_calculate_question_categories('course_question_categories'));
|
||||
|
@ -1562,6 +1562,32 @@ class backup_activity_grade_items_to_ids extends backup_execution_step {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This step will annotate all the groups and groupings belonging to the course
|
||||
*/
|
||||
class backup_annotate_course_groups_and_groupings extends backup_execution_step {
|
||||
|
||||
protected function define_execution() {
|
||||
global $DB;
|
||||
|
||||
// Get all the course groups
|
||||
if ($groups = $DB->get_records('groups', array(
|
||||
'courseid' => $this->task->get_courseid()))) {
|
||||
foreach ($groups as $group) {
|
||||
backup_structure_dbops::insert_backup_ids_record($this->get_backupid(), 'group', $group->id);
|
||||
}
|
||||
}
|
||||
|
||||
// Get all the course groupings
|
||||
if ($groupings = $DB->get_records('groupings', array(
|
||||
'courseid' => $this->task->get_courseid()))) {
|
||||
foreach ($groupings as $grouping) {
|
||||
backup_structure_dbops::insert_backup_ids_record($this->get_backupid(), 'grouping', $grouping->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This step will annotate all the groups belonging to already annotated groupings
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user