Permalink
Browse files

Updating LTI backup / restore

  • Loading branch information...
scriby committed Oct 3, 2011
1 parent cca9d3f commit 32c079dc1a450a6bad54e42274c68a51aa56f9be
@@ -62,12 +62,26 @@ protected function define_structure() {
// 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)
@@ -66,14 +66,18 @@ protected function define_structure() {
}
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
@@ -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);

0 comments on commit 32c079d

Please sign in to comment.