Updating LTI backup / restore

This commit is contained in:
Chris Scribner 2011-10-03 17:51:46 -04:00
parent cca9d3f769
commit 32c079dc1a
3 changed files with 31 additions and 8 deletions

View File

@ -62,12 +62,26 @@ class backup_lti_activity_structure_step extends backup_activity_structure_step
// Define each element separated
$basiclti = new backup_nested_element('lti', array('id'), array(
'name', 'intro', 'introformat', 'timecreated', 'timemodified',
'typeid', 'toolurl', 'preferheight', 'instructorchoiccesendname',
'instructorchoicesendemailaddr', 'organizationid',
'organizationurl', 'organizationdescr', 'launchinpopup',
'debuglaunch', 'instructorchoiceacceptgrades', 'instructorchoiceallowroster',
'instructorchoiceallowsetting', 'grade', 'instructorcustomparameters'));
'name',
'intro',
'introformat',
'timecreated',
'timemodified',
'typeid',
'toolurl',
'preferheight',
'launchcontainer',
'instructorchoicesendname',
'instructorchoicesendemailaddr',
'instructorchoiceacceptgrades',
'instructorchoiceallowroster',
'instructorchoiceallowsetting',
'grade',
'instructorcustomparameters',
'showtitle',
'showdescription'
)
);
// Build the tree
// (none)

View File

@ -66,14 +66,18 @@ class restore_lti_activity_structure_step extends restore_activity_structure_ste
}
protected function process_lti($data) {
global $DB;
global $DB, $CFG;
$data = (object)$data;
$oldid = $data->id;
$data->course = $this->get_courseid();
require_once($CFG->dirroot.'/mod/lti/lib.php');
$newitemid = lti_add_instance($data);
// insert the basiclti record
$newitemid = $DB->insert_record('lti', $data);
//$newitemid = $DB->insert_record('lti', $data);
// immediately after inserting "activity" record, call this
$this->apply_activity_instance($newitemid);
}

View File

@ -93,6 +93,11 @@ function lti_add_instance($formdata) {
if ($formdata->instructorchoiceacceptgrades == 1) {
$basiclti = $DB->get_record('lti', array('id'=>$id));
if(!isset($formdata->cmidnumber)){
$formdata->cmidnumber = '';
}
$basiclti->cmidnumber = $formdata->cmidnumber;
lti_grade_item_update($basiclti);