MDL-10451 Fixed HTML errors, merging from 1.9
[moodle.git] / grade / edit / letter / edit_form.php
CommitLineData
284abb09 1<?php //$Id$
2
8ad36f4c 3///////////////////////////////////////////////////////////////////////////
4// //
5// NOTICE OF COPYRIGHT //
6// //
7// Moodle - Modular Object-Oriented Dynamic Learning Environment //
8// http://moodle.com //
9// //
10// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.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
284abb09 26require_once $CFG->libdir.'/formslib.php';
27
28class edit_letter_form extends moodleform {
29
30 function definition() {
31 $mform =& $this->_form;
32 $num = $this->_customdata['num'];
33 $admin = $this->_customdata['admin'];
34
35 $mform->addElement('header', 'gradeletters', get_string('gradeletters', 'grades'));
36
37 $mform->addElement('checkbox', 'override', get_string('overridesitedefaultgradedisplaytype', 'grades'));
38 $mform->setHelpButton('override', array(false, get_string('overridesitedefaultgradedisplaytype', 'grades'),
39 false, true, false, get_string('overridesitedefaultgradedisplaytypehelp', 'grades')));
40
41 $gradeletterhelp = get_string('configgradeletter', 'grades');
42 $gradeboundaryhelp = get_string('configgradeboundary', 'grades');
43 $gradeletter = get_string('gradeletter', 'grades');
44 $gradeboundary = get_string('gradeboundary', 'grades');
45
46 $percentages = array(-1 => get_string('unused', 'grades'));
47 for ($i=100; $i > -1; $i--) {
48 $percentages[$i] = "$i %";
49 }
50
51 for($i=1; $i<$num+1; $i++) {
52 $gradelettername = 'gradeletter'.$i;
53 $gradeboundaryname = 'gradeboundary'.$i;
54
55 $mform->addElement('text', $gradelettername, $gradeletter." $i");
56 $mform->setHelpButton($gradelettername, array(false, $gradeletter." $i", false, true, false, $gradeletterhelp));
57 $mform->setType($gradelettername, PARAM_TEXT);
58 $mform->disabledIf($gradelettername, 'override', 'notchecked');
59 $mform->disabledIf($gradelettername, $gradeboundaryname, 'eq', -1);
60
61 $mform->addElement('select', $gradeboundaryname, $gradeboundary." $i", $percentages);
62 $mform->setHelpButton($gradeboundaryname, array(false, $gradeboundary." $i", false, true, false, $gradeboundaryhelp));
63 $mform->setDefault($gradeboundaryname, -1);
64 $mform->setType($gradeboundaryname, PARAM_INT);
65 $mform->disabledIf($gradeboundaryname, 'override', 'notchecked');
66 }
67
68 // hidden params
69 $mform->addElement('hidden', 'id');
70 $mform->setType('id', PARAM_INT);
71
72//-------------------------------------------------------------------------------
73 // buttons
74 $this->add_action_buttons(!$admin);
75 }
76
77}
78
79?>