MDL-11495 grade letter setting improvements:
[moodle.git] / grade / edit / letter / index.php
CommitLineData
284abb09 1<?php // $Id$
2
3require_once '../../../config.php';
4require_once $CFG->dirroot.'/grade/lib.php';
5require_once $CFG->libdir.'/gradelib.php';
6
7$courseid = optional_param('id', SITEID, PARAM_INT);
8$action = optional_param('action', '', PARAM_ALPHA);
9
10if (!$course = get_record('course', 'id', $courseid)) {
11 print_error('nocourseid');
12}
13require_login($course);
14$context = get_context_instance(CONTEXT_COURSE, $course->id);
15require_capability('moodle/grade:manage', $context);
16
17$gpr = new grade_plugin_return(array('type'=>'edit', 'plugin'=>'letter', 'courseid'=>$courseid));
18
19$strgrades = get_string('grades');
20$pagename = get_string('letters', 'grades');
21
22$navigation = grade_build_nav(__FILE__, $pagename, $courseid);
23
24/// Print header
25print_header_simple($strgrades.': '.$pagename, ': '.$strgrades, $navigation, '', '', true, '', navmenu($course));
26/// Print the plugin selector at the top
27print_grade_plugin_selector($courseid, 'edit', 'letter');
28
29$currenttab = 'lettersview';
30require('tabs.php');
31
32$letters = grade_get_letters($context);
33
34$data = array();
35
36$max = 100;
37foreach($letters as $boundary=>$letter) {
38 $line = array();
39 $line[] = format_float($max,2).' %';
40 $line[] = format_float($boundary,2).' %';
41 $line[] = format_string($letter);
42 $data[] = $line;
43 $max = $boundary - 0.01;
44}
45
46$table = new object();
47$table->head = array(get_string('max', 'grades'), get_string('min', 'grades'), get_string('letter', 'grades'));
48$table->size = array('30%', '30%', '40%');
49$table->align = array('left', 'left', 'left');
50$table->width = '30%';
51$table->data = $data;
52print_table($table);
53
54print_footer($course);
55
56?>
57