Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/grade/grading/form/rubric/backup/moodle2/restore_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 restore_gradingform_rubric_plugin extends restore_gradingform_plugin {
00033 
00039     protected function define_definition_plugin_structure() {
00040 
00041         $paths = array();
00042 
00043         $paths[] = new restore_path_element('gradingform_rubric_criterion',
00044             $this->get_pathfor('/criteria/criterion'));
00045 
00046         $paths[] = new restore_path_element('gradingform_rubric_level',
00047             $this->get_pathfor('/criteria/criterion/levels/level'));
00048 
00049         return $paths;
00050     }
00051 
00057     protected function define_instance_plugin_structure() {
00058 
00059         $paths = array();
00060 
00061         $paths[] = new restore_path_element('gradinform_rubric_filling',
00062             $this->get_pathfor('/fillings/filling'));
00063 
00064         return $paths;
00065     }
00066 
00073     public function process_gradingform_rubric_criterion($data) {
00074         global $DB;
00075 
00076         $data = (object)$data;
00077         $oldid = $data->id;
00078         $data->definitionid = $this->get_new_parentid('grading_definition');
00079 
00080         $newid = $DB->insert_record('gradingform_rubric_criteria', $data);
00081         $this->set_mapping('gradingform_rubric_criterion', $oldid, $newid);
00082     }
00083 
00090     public function process_gradingform_rubric_level($data) {
00091         global $DB;
00092 
00093         $data = (object)$data;
00094         $oldid = $data->id;
00095         $data->criterionid = $this->get_new_parentid('gradingform_rubric_criterion');
00096 
00097         $newid = $DB->insert_record('gradingform_rubric_levels', $data);
00098         $this->set_mapping('gradingform_rubric_level', $oldid, $newid);
00099     }
00100 
00104     public function process_gradinform_rubric_filling($data) {
00105         global $DB;
00106 
00107         $data = (object)$data;
00108         $data->instanceid = $this->get_new_parentid('grading_instance');
00109         $data->criterionid = $this->get_mappingid('gradingform_rubric_criterion', $data->criterionid);
00110         $data->levelid = $this->get_mappingid('gradingform_rubric_level', $data->levelid);
00111 
00112         $DB->insert_record('gradingform_rubric_fillings', $data);
00113     }
00114 }
 All Data Structures Namespaces Files Functions Variables Enumerations