mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Merge branch 'MDL-32614' of git://github.com/stronk7/moodle
This commit is contained in:
commit
5804a2a31e
2 changed files with 14 additions and 25 deletions
|
@ -56,11 +56,13 @@ class backup_lti_activity_structure_step extends backup_activity_structure_step
|
|||
|
||||
protected function define_structure() {
|
||||
|
||||
// TODO: MDL-34161 - Fix restore to support course/site tools & submissions.
|
||||
|
||||
// To know if we are including userinfo
|
||||
$userinfo = $this->get_setting_value('userinfo');
|
||||
|
||||
// Define each element separated
|
||||
$basiclti = new backup_nested_element('lti', array('id'), array(
|
||||
$lti = new backup_nested_element('lti', array('id'), array(
|
||||
'name',
|
||||
'intro',
|
||||
'introformat',
|
||||
|
@ -86,15 +88,15 @@ class backup_lti_activity_structure_step extends backup_activity_structure_step
|
|||
// (none)
|
||||
|
||||
// Define sources
|
||||
$basiclti->set_source_table('lti', array('id' => backup::VAR_ACTIVITYID));
|
||||
$lti->set_source_table('lti', array('id' => backup::VAR_ACTIVITYID));
|
||||
|
||||
// Define id annotations
|
||||
// (none)
|
||||
|
||||
// Define file annotations
|
||||
$basiclti->annotate_files('mod_lti', 'intro', null); // This file areas haven't itemid
|
||||
$lti->annotate_files('mod_lti', 'intro', null); // This file areas haven't itemid
|
||||
|
||||
// Return the root element (basiclti), wrapped into standard activity structure
|
||||
return $this->prepare_activity_structure($basiclti);
|
||||
// Return the root element (lti), wrapped into standard activity structure
|
||||
return $this->prepare_activity_structure($lti);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
/**
|
||||
* Structure step to restore one basiclti activity
|
||||
* Structure step to restore one lti activity
|
||||
*/
|
||||
class restore_lti_activity_structure_step extends restore_activity_structure_step {
|
||||
|
||||
|
@ -71,33 +71,20 @@ class restore_lti_activity_structure_step extends restore_activity_structure_ste
|
|||
$data->course = $this->get_courseid();
|
||||
|
||||
require_once($CFG->dirroot.'/mod/lti/lib.php');
|
||||
// Clean any course or site typeid. All modules
|
||||
// are restored as self-contained. Note this is
|
||||
// an interim solution until the issue below is implemented.
|
||||
// TODO: MDL-34161 - Fix restore to support course/site tools & submissions.
|
||||
$data->typeid = 0;
|
||||
|
||||
$newitemid = lti_add_instance($data, null);
|
||||
|
||||
// insert the basiclti record
|
||||
//$newitemid = $DB->insert_record('lti', $data);
|
||||
// immediately after inserting "activity" record, call this
|
||||
$this->apply_activity_instance($newitemid);
|
||||
}
|
||||
|
||||
protected function after_execute() {
|
||||
global $DB;
|
||||
|
||||
$basicltis = $DB->get_records('lti');
|
||||
foreach ($basicltis as $basiclti) {
|
||||
if (!$DB->get_record('lti_types_config',
|
||||
array('typeid' => $basiclti->typeid, 'name' => 'toolurl', 'value' => $basiclti->toolurl))) {
|
||||
|
||||
$basiclti->typeid = 0;
|
||||
}
|
||||
|
||||
$basiclti->placementsecret = uniqid('', true);
|
||||
$basiclti->timeplacementsecret = time();
|
||||
|
||||
$DB->update_record('lti', $basiclti);
|
||||
}
|
||||
|
||||
// Add basiclti related files, no need to match by itemname (just internally handled context)
|
||||
// Add lti related files, no need to match by itemname (just internally handled context)
|
||||
$this->add_related_files('mod_lti', 'intro', null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue