|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00032 class restore_page_activity_structure_step extends restore_activity_structure_step { 00033 00034 protected function define_structure() { 00035 00036 $paths = array(); 00037 $paths[] = new restore_path_element('page', '/activity/page'); 00038 00039 // Return the paths wrapped into standard activity structure 00040 return $this->prepare_activity_structure($paths); 00041 } 00042 00043 protected function process_page($data) { 00044 global $DB; 00045 00046 $data = (object)$data; 00047 $oldid = $data->id; 00048 $data->course = $this->get_courseid(); 00049 00050 // insert the page record 00051 $newitemid = $DB->insert_record('page', $data); 00052 // immediately after inserting "activity" record, call this 00053 $this->apply_activity_instance($newitemid); 00054 } 00055 00056 protected function after_execute() { 00057 // Add page related files, no need to match by itemname (just internally handled context) 00058 $this->add_related_files('mod_page', 'intro', null); 00059 $this->add_related_files('mod_page', 'content', null); 00060 } 00061 }