|
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 00034 class restore_assignment_offline_subplugin extends restore_subplugin { 00035 00039 protected function define_assignment_subplugin_structure() { 00040 00041 return false; // This subplugin restore is only one example. Skip it. 00042 00043 $paths = array(); 00044 00045 $elename = $this->get_namefor('config'); 00046 $elepath = $this->get_pathfor('/config'); // because we used get_recommended_name() in backup this works 00047 $paths[] = new restore_path_element($elename, $elepath); 00048 00049 return $paths; // And we return the interesting paths 00050 } 00051 00055 protected function define_submission_subplugin_structure() { 00056 00057 return false; // This subplugin restore is only one example. Skip it. 00058 00059 $paths = array(); 00060 00061 $elename = $this->get_namefor('submission_config'); 00062 $elepath = $this->get_pathfor('/submission_config'); // because we used get_recommended_name() in backup this works 00063 $paths[] = new restore_path_element($elename, $elepath); 00064 00065 return $paths; // And we return the interesting paths 00066 } 00067 00071 public function process_assignment_offline_config($data) { 00072 $data = (object)$data; 00073 print_object($data); // Nothing to do, just print the data 00074 00075 // Just to check that the whole API is available here 00076 $this->set_mapping('assignment_offline_config', 1, 1, true); 00077 $this->add_related_files('mod_assignment', 'intro', 'assignment_offline_config'); 00078 print_object($this->get_mappingid('assignment_offline_config', 1)); 00079 print_object($this->get_old_parentid('assignment')); 00080 print_object($this->get_new_parentid('assignment')); 00081 print_object($this->get_mapping('assignment', $this->get_old_parentid('assignment'))); 00082 print_object($this->apply_date_offset(1)); 00083 print_object($this->task->get_courseid()); 00084 print_object($this->task->get_contextid()); 00085 print_object($this->get_restoreid()); 00086 } 00087 00091 public function process_assignment_offline_submission_config($data) { 00092 $data = (object)$data; 00093 print_object($data); // Nothing to do, just print the data 00094 } 00095 }