X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=blobdiff_plain;f=backup%2Fmoodle2%2Fbackup_stepslib.php;h=ffc310e0d6f9249ad5bc3074e5a575528f305b4d;hp=a0acb1900fb0ea76fb6addb333923fa68f95fc05;hb=f70676a782ab56b5e7388f49a451f5283ea43d84;hpb=f6f6138379b078341f29284feb7c18336e8eb3a5 diff --git a/backup/moodle2/backup_stepslib.php b/backup/moodle2/backup_stepslib.php index a0acb1900fb..ffc310e0d6f 100644 --- a/backup/moodle2/backup_stepslib.php +++ b/backup/moodle2/backup_stepslib.php @@ -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 */