MDL-38633 folder: support show_expanded in backup.
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 21 Mar 2013 16:56:47 +0000 (17:56 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 28 Mar 2013 16:00:46 +0000 (17:00 +0100)
mod/folder/backup/moodle2/backup_folder_stepslib.php
mod/folder/backup/moodle2/restore_folder_stepslib.php

index a7bb672..6b57143 100644 (file)
@@ -39,7 +39,7 @@ class backup_folder_activity_structure_step extends backup_activity_structure_st
         // Define each element separated
         $folder = new backup_nested_element('folder', array('id'), array(
             'name', 'intro', 'introformat', 'revision',
         // Define each element separated
         $folder = new backup_nested_element('folder', array('id'), array(
             'name', 'intro', 'introformat', 'revision',
-            'timemodified', 'display'));
+            'timemodified', 'display', 'show_expanded'));
 
         // Build the tree
         // (nice mono-tree, lol)
 
         // Build the tree
         // (nice mono-tree, lol)
index 6c655e4..2618be2 100644 (file)
@@ -48,6 +48,11 @@ class restore_folder_activity_structure_step extends restore_activity_structure_
         $data->course = $this->get_courseid();
         $data->timemodified = $this->apply_date_offset($data->timemodified);
 
         $data->course = $this->get_courseid();
         $data->timemodified = $this->apply_date_offset($data->timemodified);
 
+        // If show_expanded is not set, apply site default.
+        if (!isset($data->show_expanded)) {
+            $data->show_expanded = get_config('folder', 'show_expanded');
+        }
+
         // insert the folder record
         $newitemid = $DB->insert_record('folder', $data);
         // immediately after inserting "activity" record, call this
         // insert the folder record
         $newitemid = $DB->insert_record('folder', $data);
         // immediately after inserting "activity" record, call this