Merge branch 'MDL-49474_28' of git://github.com/jmvedrine/moodle into MOODLE_28_STABLE
This commit is contained in:
@@ -69,13 +69,14 @@ class backup_lesson_activity_structure_step extends backup_activity_structure_st
|
||||
// alot goes into it but nothing relational other than course when will
|
||||
// need to be corrected upon restore
|
||||
$lesson = new backup_nested_element('lesson', array('id'), array(
|
||||
'course','name','practice','modattempts','usepassword','password',
|
||||
'dependency','conditions','grade','custom','ongoing','usemaxgrade',
|
||||
'maxanswers','maxattempts','review','nextpagedefault','feedback',
|
||||
'minquestions','maxpages','timed','maxtime','retake','activitylink',
|
||||
'mediafile','mediaheight','mediawidth','mediaclose','slideshow',
|
||||
'width','height','bgcolor','displayleft','displayleftif','progressbar',
|
||||
'showhighscores','maxhighscores','available','deadline','timemodified'
|
||||
'course', 'name', 'intro', 'introformat', 'practice', 'modattempts',
|
||||
'usepassword', 'password',
|
||||
'dependency', 'conditions', 'grade', 'custom', 'ongoing', 'usemaxgrade',
|
||||
'maxanswers', 'maxattempts', 'review', 'nextpagedefault', 'feedback',
|
||||
'minquestions', 'maxpages', 'timed', 'maxtime', 'retake', 'activitylink',
|
||||
'mediafile', 'mediaheight', 'mediawidth', 'mediaclose', 'slideshow',
|
||||
'width', 'height', 'bgcolor', 'displayleft', 'displayleftif', 'progressbar',
|
||||
'showhighscores', 'maxhighscores', 'available', 'deadline', 'timemodified'
|
||||
));
|
||||
// Tell the lesson element about the showhighscores elements mapping to the highscores
|
||||
// database field.
|
||||
@@ -188,6 +189,7 @@ class backup_lesson_activity_structure_step extends backup_activity_structure_st
|
||||
$timer->annotate_ids('user', 'userid');
|
||||
|
||||
// Annotate the file areas in user by the lesson module.
|
||||
$lesson->annotate_files('mod_lesson', 'intro', null);
|
||||
$lesson->annotate_files('mod_lesson', 'mediafile', null);
|
||||
$page->annotate_files('mod_lesson', 'page_contents', 'id');
|
||||
$answer->annotate_files('mod_lesson', 'page_answers', 'id');
|
||||
|
||||
@@ -54,6 +54,7 @@ class restore_lesson_activity_task extends restore_activity_task {
|
||||
static public function define_decode_contents() {
|
||||
$contents = array();
|
||||
|
||||
$contents[] = new restore_decode_content('lesson', array('intro'), 'lesson');
|
||||
$contents[] = new restore_decode_content('lesson_pages', array('contents'), 'lesson_page');
|
||||
$contents[] = new restore_decode_content('lesson_answers', array('answer', 'response'), 'lesson_answer');
|
||||
|
||||
|
||||
@@ -72,6 +72,12 @@ class restore_lesson_activity_structure_step extends restore_activity_structure_
|
||||
unset($data->showhighscores);
|
||||
}
|
||||
|
||||
// Supply item that maybe missing from previous versions.
|
||||
if (!isset($data->intro)) {
|
||||
$data->intro = '';
|
||||
$data->introformat = FORMAT_HTML;
|
||||
}
|
||||
|
||||
// insert the lesson record
|
||||
$newitemid = $DB->insert_record('lesson', $data);
|
||||
// immediately after inserting "activity" record, call this
|
||||
@@ -195,7 +201,8 @@ class restore_lesson_activity_structure_step extends restore_activity_structure_
|
||||
'answerid' => $answer->id));
|
||||
}
|
||||
|
||||
// Add lesson mediafile, no need to match by itemname (just internally handled context)
|
||||
// Add lesson files, no need to match by itemname (just internally handled context).
|
||||
$this->add_related_files('mod_lesson', 'intro', null);
|
||||
$this->add_related_files('mod_lesson', 'mediafile', null);
|
||||
// Add lesson page files, by lesson_page itemname
|
||||
$this->add_related_files('mod_lesson', 'page_contents', 'lesson_page');
|
||||
|
||||
Reference in New Issue
Block a user