mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Updating LTI backup / restore
This commit is contained in:
parent
cca9d3f769
commit
32c079dc1a
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user