3 ///////////////////////////////////////////////////////////////////////////
5 // NOTICE OF COPYRIGHT //
7 // Moodle - Modular Object-Oriented Dynamic Learning Environment //
8 // http://moodle.com //
10 // Copyright (C) 2001-2007 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 require_capability('gradereport/grader:manage', $context);
43 // If data submitted, then process and store.
44 if ($form = data_submitted()) {
45 foreach ($form as $preference => $value) {
46 switch ($preference) {
48 set_user_preference('calendar_persistflt', intval($value));
51 if ($value == GRADE_REPORT_PREFERENCE_DEFAULT
) {
52 unset_user_preference($preference);
54 set_user_preference($preference, $value);
60 redirect($CFG->wwwroot
. '/grade/report/grader/index.php?id='.$courseid, get_string('changessaved'), 1);
64 $strgrades = get_string('grades');
65 $strgraderreport = get_string('modulename', 'gradereport_grader');
66 $strgradepreferences = get_string('gradepreferences', 'grades');
69 $navlinks[] = array('name' => $strgrades, 'link' => $CFG->wwwroot
. '/grade/index.php?id='.$courseid, 'type' => 'misc');
70 $navlinks[] = array('name' => $strgraderreport,
71 'link' => $CFG->wwwroot
. '/grade/report/grader/index.php?id=' . $courseid, 'type' => 'misc');
72 $navlinks[] = array('name' => $strgradepreferences, 'link' => '', 'type' => 'misc');
74 $navigation = build_navigation($navlinks);
76 print_header_simple($strgrades.': '.$strgraderreport . ': ' . $strgradepreferences,': '.$strgradepreferences, $navigation,
77 '', '', true, '', navmenu($course));
79 /// Print the plugin selector at the top
80 print_grade_plugin_selector($course->id
, 'report', 'grader');
83 $currenttab = 'preferences';
86 print_simple_box_start("center");
88 include('./preferences_form.php');
89 $mform = new grader_report_preferences_form('preferences.php', compact('course'));
90 echo $mform->display();
91 print_simple_box_end();
93 print_footer($course);