|
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(__FILE__))).'/config.php'); 00028 require_once(dirname(__FILE__).'/locallib.php'); 00029 00030 $cmid = required_param('cmid', PARAM_INT); // course module 00031 $confirm = optional_param('confirm', false, PARAM_BOOL); // confirmation 00032 00033 // the params to be re-passed to view.php 00034 $page = optional_param('page', 0, PARAM_INT); 00035 $sortby = optional_param('sortby', 'lastname', PARAM_ALPHA); 00036 $sorthow = optional_param('sorthow', 'ASC', PARAM_ALPHA); 00037 00038 $cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST); 00039 $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); 00040 $workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST); 00041 $workshop = new workshop($workshop, $cm, $course); 00042 00043 $PAGE->set_url($workshop->aggregate_url(), compact('confirm', 'page', 'sortby', 'sorthow')); 00044 00045 require_login($course, false, $cm); 00046 require_capability('mod/workshop:overridegrades', $PAGE->context); 00047 00048 // load and init the grading evaluator 00049 $evaluator = $workshop->grading_evaluation_instance(); 00050 $settingsform = $evaluator->get_settings_form($PAGE->url); 00051 00052 if ($settingsdata = $settingsform->get_data()) { 00053 $workshop->aggregate_submission_grades(); // updates 'grade' in {workshop_submissions} 00054 $evaluator->update_grading_grades($settingsdata); // updates 'gradinggrade' in {workshop_assessments} 00055 $workshop->aggregate_grading_grades(); // updates 'gradinggrade' in {workshop_aggregations} 00056 $workshop->log('update aggregate grades'); 00057 } 00058 00059 redirect(new moodle_url($workshop->view_url(), compact('page', 'sortby', 'sorthow')));