|
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 $id = required_param('id', PARAM_INT); // course_module ID 00031 $tool = required_param('tool', PARAM_ALPHA); 00032 00033 $cm = get_coursemodule_from_id('workshop', $id, 0, false, MUST_EXIST); 00034 $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); 00035 $workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST); 00036 00037 require_login($course, false, $cm); 00038 $workshop = new workshop($workshop, $cm, $course); 00039 require_sesskey(); 00040 00041 switch ($tool) { 00042 case 'clearaggregatedgrades': 00043 require_capability('mod/workshop:overridegrades', $workshop->context); 00044 $workshop->log('update clear aggregated grades'); 00045 $workshop->clear_submission_grades(); 00046 $workshop->clear_grading_grades(); 00047 break; 00048 00049 case 'clearassessments': 00050 require_capability('mod/workshop:overridegrades', $workshop->context); 00051 $workshop->log('update clear assessments'); 00052 $workshop->clear_assessments(); 00053 break; 00054 } 00055 00056 redirect($workshop->view_url());