Skip to content
Browse files

Merge branch 'MDL-32614_22' of git://github.com/stronk7/moodle into M…

…OODLE_22_STABLE
  • Loading branch information...
2 parents dc6451c + 7351ed0 commit e0c7cb6ffa8b3a85484368c381e770c8536c5492 Sam Hemelryk committed Jul 4, 2012
Showing with 14 additions and 25 deletions.
  1. +7 −5 mod/lti/backup/moodle2/backup_lti_stepslib.php
  2. +7 −20 mod/lti/backup/moodle2/restore_lti_stepslib.php
View
12 mod/lti/backup/moodle2/backup_lti_stepslib.php
@@ -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 @@ protected function define_structure() {
// (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);
}
}
View
27 mod/lti/backup/moodle2/restore_lti_stepslib.php
@@ -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 @@ protected function process_lti($data) {
$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);
}
}

0 comments on commit e0c7cb6

Please sign in to comment.
Something went wrong with that request. Please try again.