mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
added itemtype to backup/restore, only restore a mod type gradeitem if user data is included
This commit is contained in:
parent
c3096060de
commit
9bfd009441
@ -1431,8 +1431,9 @@
|
||||
fwrite ($bf,start_tag("GRADE_ITEM",4,true));
|
||||
//Output individual fields
|
||||
|
||||
fwrite ($bf,full_tag("ID",5,false,$grade_item->id));
|
||||
fwrite ($bf,full_tag("ID",5,false,$grade_item->id));
|
||||
fwrite ($bf,full_tag("ITEMNAME",5,false,$grade_item->itemname));
|
||||
fwrite ($bf,full_tag("ITEMTYPE",5,false,$grade_item->itemtype));
|
||||
fwrite ($bf,full_tag("ITEMMODULE",5,false,$grade_item->itemmodule));
|
||||
fwrite ($bf,full_tag("ITEMINSTANCE",5,false,$grade_item->iteminstance));
|
||||
fwrite ($bf,full_tag("ITEMNUMBER",5,false,$grade_item->itemnumber));
|
||||
|
@ -1334,6 +1334,7 @@
|
||||
//Get the full record from backup_ids
|
||||
$data = backup_getid($restore->backup_unique_code,'grade_items',$rec->old_id);
|
||||
if ($data) {
|
||||
|
||||
//Now get completed xmlized object
|
||||
$info = $data->info;
|
||||
//traverse_xmlize($info); //Debug
|
||||
@ -1347,10 +1348,24 @@
|
||||
}
|
||||
|
||||
$dbrec->itemname = backup_todb($info['GRADE_ITEM']['#']['ITEMNAME']['0']['#']);
|
||||
$dbrec->itemtype = backup_todb($info['GRADE_ITEM']['#']['ITEMTYPE']['0']['#']);
|
||||
$dbrec->itemmodule = backup_todb($info['GRADE_ITEM']['#']['ITEMMODULE']['0']['#']);
|
||||
/// this needs to point to either the new mod id
|
||||
/// or the category id
|
||||
$dbrec->iteminstance = backup_todb($info['GRADE_ITEM']['#']['ITEMINSTANCE']['0']['#']);
|
||||
|
||||
// do not restore if this grade_item is a mod, and
|
||||
if ($dbrec->itemtype == 'mod') {
|
||||
// get the mod
|
||||
$mod = get_record('course_module', 'id', $dbrec->iteminstance);
|
||||
$modt = get_record('modules', 'id', $mod->module);
|
||||
if (!restore_userdata_selected($restore, $modt->name, $mod->id)) {
|
||||
// module instance not restored using granular
|
||||
$counteritems++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$dbrec->itemnumber = backup_todb($info['GRADE_ITEM']['#']['ITEMNUMBER']['0']['#']);
|
||||
$dbrec->iteminfo = backup_todb($info['GRADE_ITEM']['#']['ITEMINFO']['0']['#']);
|
||||
$dbrec->idnumber = backup_todb($info['GRADE_ITEM']['#']['IDNUMBER']['0']['#']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user