3 ///////////////////////////////////////////////////////////////////////////
5 // NOTICE OF COPYRIGHT //
7 // Moodle - Modular Object-Oriented Dynamic Learning Environment //
8 // http://moodle.com //
10 // Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
12 // This program is free software; you can redistribute it and/or modify //
13 // it under the terms of the GNU General Public License as published by //
14 // the Free Software Foundation; either version 2 of the License, or //
15 // (at your option) any later version. //
17 // This program is distributed in the hope that it will be useful, //
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
20 // GNU General Public License for more details: //
22 // http://www.gnu.org/copyleft/gpl.html //
24 ///////////////////////////////////////////////////////////////////////////
26 require_once '../../../config.php';
27 require_once $CFG->dirroot
.'/grade/lib.php';
28 require_once $CFG->libdir
.'/gradelib.php';
29 require_once 'form.php';
31 $courseid = optional_param('id', SITEID
, PARAM_INT
);
33 if (!$course = get_record('course', 'id', $courseid)) {
34 print_error('nocourseid');
36 require_login($course);
37 $context = get_context_instance(CONTEXT_COURSE
, $course->id
);
39 require_capability('moodle/grade:manage', $context);
41 $gpr = new grade_plugin_return(array('type'=>'edit', 'plugin'=>'settings', 'courseid'=>$courseid));
43 $strgrades = get_string('grades');
44 $pagename = get_string('coursesettings', 'grades');
46 $navigation = grade_build_nav(__FILE__
, $pagename, $courseid);
48 $returnurl = $CFG->wwwroot
.'/grade/index.php?id='.$course->id
;
50 $mform = new course_settings_form();
52 $settings = grade_get_settings($course->id
);
54 $mform->set_data($settings);
56 if ($mform->is_cancelled()) {
59 } else if ($data = $mform->get_data()) {
61 $general = array('displaytype', 'decimalpoints', 'aggregationposition');
62 foreach ($data as $key=>$value) {
63 if (!in_array($key, $general) and strpos($key, 'report_') !== 0
64 and strpos($key, 'import_') !== 0
65 and strpos($key, 'export_') !== 0) {
71 grade_set_setting($course->id
, $key, $value);
78 print_header_simple($strgrades.': '.$pagename, ': '.$strgrades, $navigation, '', '', true, '', navmenu($course));
79 /// Print the plugin selector at the top
80 print_grade_plugin_selector($courseid, 'edit', 'settings');
84 print_footer($course);