MDL-19799 Adding missing echo
[moodle.git] / grade / edit / letter / index.php
CommitLineData
e060e33d 1<?php
284abb09 2
e060e33d 3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
8ad36f4c 17
284abb09 18require_once '../../../config.php';
19require_once $CFG->dirroot.'/grade/lib.php';
20require_once $CFG->libdir.'/gradelib.php';
21
22$courseid = optional_param('id', SITEID, PARAM_INT);
23$action = optional_param('action', '', PARAM_ALPHA);
24
d24832f9 25if (!$course = $DB->get_record('course', array('id' => $courseid))) {
284abb09 26 print_error('nocourseid');
27}
28require_login($course);
29$context = get_context_instance(CONTEXT_COURSE, $course->id);
9376f5a6 30
31if (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:manageletters', $context)) {
c7a4be5e 32 print_error('nopermissiontoviewletergrade');
9376f5a6 33}
284abb09 34
35$gpr = new grade_plugin_return(array('type'=>'edit', 'plugin'=>'letter', 'courseid'=>$courseid));
36
37$strgrades = get_string('grades');
38$pagename = get_string('letters', 'grades');
39
dc482cfa 40print_grade_page_head($courseid, 'letter', 'view', get_string('gradeletters', 'grades'));
284abb09 41
42$letters = grade_get_letters($context);
43
44$data = array();
45
46$max = 100;
47foreach($letters as $boundary=>$letter) {
48 $line = array();
49 $line[] = format_float($max,2).' %';
50 $line[] = format_float($boundary,2).' %';
51 $line[] = format_string($letter);
52 $data[] = $line;
53 $max = $boundary - 0.01;
54}
55
03fcc729 56$table = new html_table();
284abb09 57$table->head = array(get_string('max', 'grades'), get_string('min', 'grades'), get_string('letter', 'grades'));
58$table->size = array('30%', '30%', '40%');
59$table->align = array('left', 'left', 'left');
60$table->width = '30%';
61$table->data = $data;
03fcc729 62echo $OUTPUT->table($table);
284abb09 63
5a931394 64echo $OUTPUT->footer();
284abb09 65
66?>