MDL-10210 Removed the loading of the $CFG versions of the preferences when the user...
[moodle-linuxchix.git] / grade / report / grader / preferences.php
blob38bdd67b1e83ea37ca529a3181c057aac8085518
1 <?php // $Id$
3 ///////////////////////////////////////////////////////////////////////////
4 // //
5 // NOTICE OF COPYRIGHT //
6 // //
7 // Moodle - Modular Object-Oriented Dynamic Learning Environment //
8 // http://moodle.com //
9 // //
10 // Copyright (C) 2001-2007 Martin Dougiamas http://dougiamas.com //
11 // //
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. //
16 // //
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: //
21 // //
22 // http://www.gnu.org/copyleft/gpl.html //
23 // //
24 ///////////////////////////////////////////////////////////////////////////
25 set_time_limit(0);
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) {
47 case 'persistflt':
48 set_user_preference('calendar_persistflt', intval($value));
49 break;
50 default:
51 if ($value == GRADE_REPORT_PREFERENCE_DEFAULT) {
52 unset_user_preference($preference);
53 } else {
54 set_user_preference($preference, $value);
56 break;
60 redirect($CFG->wwwroot . '/grade/report/grader/index.php?id='.$courseid, get_string('changessaved'), 1);
61 exit;
64 $strgrades = get_string('grades');
65 $strgraderreport = get_string('modulename', 'gradereport_grader');
66 $strgradepreferences = get_string('gradepreferences', 'grades');
68 $navlinks = array();
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');
82 // Add tabs
83 $currenttab = 'preferences';
84 include('tabs.php');
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);