Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/grade/grading/form/rubric/backup/moodle2/backup_gradingform_rubric_plugin.class.php
Go to the documentation of this file.
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 
00027 defined('MOODLE_INTERNAL') || die();
00028 
00032 class backup_gradingform_rubric_plugin extends backup_gradingform_plugin {
00033 
00037     protected function define_definition_plugin_structure() {
00038 
00039         // Append data only if the grand-parent element has 'method' set to 'rubric'
00040         $plugin = $this->get_plugin_element(null, '../../method', 'rubric');
00041 
00042         // Create a visible container for our data
00043         $pluginwrapper = new backup_nested_element($this->get_recommended_name());
00044 
00045         // Connect our visible container to the parent
00046         $plugin->add_child($pluginwrapper);
00047 
00048         // Define our elements
00049 
00050         $criteria = new backup_nested_element('criteria');
00051 
00052         $criterion = new backup_nested_element('criterion', array('id'), array(
00053             'sortorder', 'description', 'descriptionformat'));
00054 
00055         $levels = new backup_nested_element('levels');
00056 
00057         $level = new backup_nested_element('level', array('id'), array(
00058             'score', 'definition', 'definitionformat'));
00059 
00060         // Build elements hierarchy
00061 
00062         $pluginwrapper->add_child($criteria);
00063         $criteria->add_child($criterion);
00064         $criterion->add_child($levels);
00065         $levels->add_child($level);
00066 
00067         // Set sources to populate the data
00068 
00069         $criterion->set_source_table('gradingform_rubric_criteria',
00070                 array('definitionid' => backup::VAR_PARENTID));
00071 
00072         $level->set_source_table('gradingform_rubric_levels',
00073                 array('criterionid' => backup::VAR_PARENTID));
00074 
00075         // no need to annotate ids or files yet (one day when criterion definition supports
00076         // embedded files, they must be annotated here)
00077 
00078         return $plugin;
00079     }
00080 
00084     protected function define_instance_plugin_structure() {
00085 
00086         // Append data only if the ancestor 'definition' element has 'method' set to 'rubric'
00087         $plugin = $this->get_plugin_element(null, '../../../../method', 'rubric');
00088 
00089         // Create a visible container for our data
00090         $pluginwrapper = new backup_nested_element($this->get_recommended_name());
00091 
00092         // Connect our visible container to the parent
00093         $plugin->add_child($pluginwrapper);
00094 
00095         // Define our elements
00096 
00097         $fillings = new backup_nested_element('fillings');
00098 
00099         $filling = new backup_nested_element('filling', array('id'), array(
00100             'criterionid', 'levelid', 'remark', 'remarkformat'));
00101 
00102         // Build elements hierarchy
00103 
00104         $pluginwrapper->add_child($fillings);
00105         $fillings->add_child($filling);
00106 
00107         // Set sources to populate the data
00108 
00109         $filling->set_source_table('gradingform_rubric_fillings',
00110             array('instanceid' => backup::VAR_PARENTID));
00111 
00112         // no need to annotate ids or files yet (one day when remark field supports
00113         // embedded fileds, they must be annotated here)
00114 
00115         return $plugin;
00116     }
00117 }
 All Data Structures Namespaces Files Functions Variables Enumerations