|
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 backup_assignment_offline_subplugin extends backup_subplugin { 00035 00039 protected function define_assignment_subplugin_structure() { 00040 00041 return false; // This subplugin backup is only one example. Skip it. 00042 00065 $subplugin = $this->get_subplugin_element(null, '/assignment/assignmenttype', 'offline'); 00066 00078 $assassoff = new backup_nested_element($this->get_recommended_name()); 00079 $config = new backup_nested_element('config', null, array('name', 'value')); 00080 00081 $subplugin->add_child($assassoff); 00082 $assassoff->add_child($config); 00083 00084 $config->set_source_table('config', array('id' => '/assignment/id')); 00085 00086 return $subplugin; // And we return the root subplugin element 00087 } 00088 00092 protected function define_submission_subplugin_structure() { 00093 00094 return false; // This subplugin backup is only one example. Skip it. 00095 00096 // remember this has not XML representation 00097 $subplugin = $this->get_subplugin_element(null, '/assignment/assignmenttype', 'offline'); 00098 00099 // type of the subplugin, name of the subplugin and name of the connection point (recommended) 00100 $asssuboff = new backup_nested_element($this->get_recommended_name()); 00101 // Why 'submission_config' name? Because it must be unique in the hierarchy and we 00102 // already are using 'config' above withing the same file 00103 $config = new backup_nested_element('submission_config', null, array('name', 'value')); 00104 00105 $subplugin->add_child($asssuboff); 00106 $asssuboff->add_child($config); 00107 00108 $config->set_source_table('config', array('id' => backup::VAR_PARENTID)); 00109 00110 return $subplugin; // And we return the root subplugin element 00111 } 00112 }