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://dougiamas.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->libdir
. '/gradelib.php';
28 require_once '../../lib.php';
30 $courseid = required_param('id', PARAM_INT
);
32 /// Make sure they can even access this course
34 if (!$course = get_record('course', 'id', $courseid)) {
35 print_error('nocourseid');
38 require_login($course->id
);
40 $context = get_context_instance(CONTEXT_COURSE
, $course->id
);
41 $systemcontext = get_context_instance(CONTEXT_SYSTEM
);
42 require_capability('gradereport/grader:view', $context);
44 require('preferences_form.php');
45 $mform = new grader_report_preferences_form('preferences.php', compact('course'));
47 if ($mform->is_cancelled()){
48 redirect($CFG->wwwroot
. '/grade/report/grader/index.php?id='.$courseid);
51 // If data submitted, then process and store.
52 if ($data = $mform->get_data()) {
53 foreach ($data as $preference => $value) {
54 if (substr($preference, 0, 6) !== 'grade_') {
58 if ($value == GRADE_REPORT_PREFERENCE_DEFAULT ||
strlen($value) == 0) {
59 unset_user_preference($preference);
61 set_user_preference($preference, $value);
65 redirect($CFG->wwwroot
. '/grade/report/grader/index.php?id='.$courseid); // message here breaks accessability and is sloooowww
69 $strgrades = get_string('grades');
70 $strgraderreport = get_string('modulename', 'gradereport_grader');
71 $strgradepreferences = get_string('gradepreferences', 'grades');
73 $navigation = grade_build_nav(__FILE__
, $strgradepreferences, $courseid);
75 print_header_simple($strgrades.': '.$strgraderreport . ': ' . $strgradepreferences,': '.$strgradepreferences, $navigation,
76 '', '', true, '', navmenu($course));
78 /// Print the plugin selector at the top
79 print_grade_plugin_selector($course->id
, 'report', 'grader');
82 $currenttab = 'preferences';
85 // If USER has admin capability, print a link to the site config page for this report
86 if (has_capability('moodle/site:config', $systemcontext)) {
87 echo '<div id="siteconfiglink"><a href="'.$CFG->wwwroot
.'/'.$CFG->admin
.'/settings.php?section=gradereportgrader">';
88 echo get_string('changereportdefaults', 'grades');
92 print_simple_box_start("center");
95 print_simple_box_end();
97 print_footer($course);