Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-25553 lesson restore - add missing jumpto remapping. Credit goes …

…to Mike Churchward
  • Loading branch information...
commit bd9e6629538d53e09a4067f1905078801cfea9e2 1 parent d911c72
Eloy Lafuente (stronk7) stronk7 authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 mod/lesson/backup/moodle2/restore_lesson_stepslib.php
11 mod/lesson/backup/moodle2/restore_lesson_stepslib.php
View
@@ -181,6 +181,17 @@ protected function after_execute() {
}
$rs->close();
+ // Remap all the restored 'jumpto' fields now that we have all the pages and their mappings
+ $rs = $DB->get_recordset('lesson_answers', array('lessonid' => $this->task->get_activityid()),
+ '', 'id, jumpto');
+ foreach ($rs as $answer) {
+ if ($answer->jumpto > 0) {
+ $answer->jumpto = $this->get_mappingid('lesson_page', $answer->jumpto);
+ $DB->update_record('lesson_answers', $answer);
+ }
+ }
+ $rs->close();
+
// TODO: somewhere at the end of the restore... when all the activities have been restored
// TODO: we need to decode the lesson->activitylink that points to another activity in the course
// TODO: great functionality that breaks self-contained principles, grrr
Please sign in to comment.
Something went wrong with that request. Please try again.