|
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 00025 require_once($CFG->dirroot.'/backup/util/xml/parser/processors/grouped_parser_processor.class.php'); 00026 00034 class restore_moodlexml_parser_processor extends grouped_parser_processor { 00035 00036 protected $accumchunks; 00037 00038 public function __construct() { 00039 $this->accumchunks = array(); 00040 parent::__construct(); 00041 // Let's add all the paths we are interested on 00042 $this->add_path('/moodle_backup/information', true); // Everything will be grouped below this 00043 $this->add_path('/moodle_backup/information/details/detail'); 00044 $this->add_path('/moodle_backup/information/contents/activities/activity'); 00045 $this->add_path('/moodle_backup/information/contents/sections/section'); 00046 $this->add_path('/moodle_backup/information/contents/course'); 00047 $this->add_path('/moodle_backup/information/settings/setting'); 00048 } 00049 00050 protected function dispatch_chunk($data) { 00051 $this->accumchunks[] = $data; 00052 } 00053 00054 protected function notify_path_start($path) { 00055 // nothing to do 00056 } 00057 00058 protected function notify_path_end($path) { 00059 // nothing to do 00060 } 00061 00062 public function get_all_chunks() { 00063 return $this->accumchunks; 00064 } 00065 00066 }