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';
30 $courseid = optional_param('id', SITEID
, PARAM_INT
);
31 $action = optional_param('action', '', PARAM_ALPHA
);
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 if (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:manageletters', $context)) {
40 error('Missing permission to view letter grades');
43 $gpr = new grade_plugin_return(array('type'=>'edit', 'plugin'=>'letter', 'courseid'=>$courseid));
45 $strgrades = get_string('grades');
46 $pagename = get_string('letters', 'grades');
48 $navigation = grade_build_nav(__FILE__
, $pagename, $courseid);
51 print_header_simple($strgrades.': '.$pagename, ': '.$strgrades, $navigation, '', '', true, '', navmenu($course));
52 /// Print the plugin selector at the top
53 print_grade_plugin_selector($courseid, 'edit', 'letter');
55 $currenttab = 'lettersview';
58 $letters = grade_get_letters($context);
63 foreach($letters as $boundary=>$letter) {
65 $line[] = format_float($max,2).' %';
66 $line[] = format_float($boundary,2).' %';
67 $line[] = format_string($letter);
69 $max = $boundary - 0.01;
72 $table = new object();
73 $table->head
= array(get_string('max', 'grades'), get_string('min', 'grades'), get_string('letter', 'grades'));
74 $table->size
= array('30%', '30%', '40%');
75 $table->align
= array('left', 'left', 'left');
76 $table->width
= '30%';
80 print_footer($course);