Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/workshop/form/rubric/backup/moodle2/backup_workshopform_rubric_subplugin.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 
00024 defined('MOODLE_INTERNAL') || die();
00025 
00029 class backup_workshopform_rubric_subplugin extends backup_subplugin {
00030 
00034     protected function define_workshop_subplugin_structure() {
00035 
00036         // XML nodes declaration
00037         $subplugin = $this->get_subplugin_element(); // virtual optigroup element
00038         $subpluginwrapper = new backup_nested_element($this->get_recommended_name());
00039         $subpluginconfig = new backup_nested_element('workshopform_rubric_config', null, 'layout');
00040         $subplugindimension = new backup_nested_element('workshopform_rubric_dimension', array('id'), array(
00041             'sort', 'description', 'descriptionformat'));
00042         $subpluginlevel = new backup_nested_element('workshopform_rubric_level', array('id'), array(
00043             'grade', 'definition', 'definitionformat'));
00044 
00045         // connect XML elements into the tree
00046         $subplugin->add_child($subpluginwrapper);
00047         $subpluginwrapper->add_child($subpluginconfig);
00048         $subpluginwrapper->add_child($subplugindimension);
00049         $subplugindimension->add_child($subpluginlevel);
00050 
00051         // set source to populate the data
00052         $subpluginconfig->set_source_table('workshopform_rubric_config', array('workshopid' => backup::VAR_ACTIVITYID));
00053         $subplugindimension->set_source_table('workshopform_rubric', array('workshopid' => backup::VAR_ACTIVITYID));
00054         $subpluginlevel->set_source_table('workshopform_rubric_levels', array('dimensionid' => backup::VAR_PARENTID));
00055 
00056         // file annotations
00057         $subplugindimension->annotate_files('workshopform_rubric', 'description', 'id');
00058 
00059         return $subplugin;
00060     }
00061 
00065     protected function define_referenceassessment_subplugin_structure() {
00066         return $this->dimension_grades_structure('workshopform_rubric_referencegrade');
00067     }
00068 
00072     protected function define_exampleassessment_subplugin_structure() {
00073         return $this->dimension_grades_structure('workshopform_rubric_examplegrade');
00074     }
00075 
00079     protected function define_assessment_subplugin_structure() {
00080         return $this->dimension_grades_structure('workshopform_rubric_grade');
00081     }
00082 
00084     // internal private methods
00086 
00092     private function dimension_grades_structure($elementname) {
00093 
00094         // create XML elements
00095         $subplugin = $this->get_subplugin_element(); // virtual optigroup element
00096         $subpluginwrapper = new backup_nested_element($this->get_recommended_name());
00097         $subplugingrade = new backup_nested_element($elementname, array('id'), array(
00098             'dimensionid', 'grade'));
00099 
00100         // connect XML elements into the tree
00101         $subplugin->add_child($subpluginwrapper);
00102         $subpluginwrapper->add_child($subplugingrade);
00103 
00104         // set source to populate the data
00105         $subplugingrade->set_source_sql(
00106             "SELECT id, dimensionid, grade
00107                FROM {workshop_grades}
00108               WHERE strategy = 'rubric' AND assessmentid = ?",
00109               array(backup::VAR_PARENTID));
00110 
00111         return $subplugin;
00112     }
00113 }
 All Data Structures Namespaces Files Functions Variables Enumerations