|
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 00027 require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.php'); 00028 require_once(dirname(__FILE__).'/lib.php'); 00029 require_once(dirname(__FILE__).'/edit_form.php'); 00030 require_once($CFG->dirroot.'/grade/grading/lib.php'); 00031 00032 $areaid = required_param('areaid', PARAM_INT); 00033 00034 $manager = get_grading_manager($areaid); 00035 00036 list($context, $course, $cm) = get_context_info_array($manager->get_context()->id); 00037 00038 require_login($course, true, $cm); 00039 require_capability('moodle/grade:managegradingforms', $context); 00040 00041 $controller = $manager->get_controller('rubric'); 00042 00043 $PAGE->set_url(new moodle_url('/grade/grading/form/rubric/edit.php', array('areaid' => $areaid))); 00044 $PAGE->set_title(get_string('definerubric', 'gradingform_rubric')); 00045 $PAGE->set_heading(get_string('definerubric', 'gradingform_rubric')); 00046 00047 $mform = new gradingform_rubric_editrubric(null, array('areaid' => $areaid, 'context' => $context, 'allowdraft' => !$controller->has_active_instances()), 'post', '', array('class' => 'gradingform_rubric_editform')); 00048 $data = $controller->get_definition_for_editing(true); 00049 $returnurl = optional_param('returnurl', $manager->get_management_url(), PARAM_LOCALURL); 00050 $data->returnurl = $returnurl; 00051 $mform->set_data($data); 00052 if ($mform->is_cancelled()) { 00053 redirect($returnurl); 00054 } else if ($mform->is_submitted() && $mform->is_validated() && !$mform->need_confirm_regrading($controller)) { 00055 // everything ok, validated, re-grading confirmed if needed. Make changes to the rubric 00056 $controller->update_definition($mform->get_data()); 00057 redirect($returnurl); 00058 } 00059 00060 echo $OUTPUT->header(); 00061 $mform->display(); 00062 echo $OUTPUT->footer();