MDL-36835 Assignment: Do not show javascript warning when toggling quickgrading
[moodle.git] / mod / assign / gradingoptionsform.php
CommitLineData
bbd0e548
DW
1<?php
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * This file contains the forms to create and edit an instance of this module
19 *
20 * @package mod_assign
21 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
26
27
28/** Include formslib.php */
29require_once ($CFG->libdir.'/formslib.php');
30/** Include locallib.php */
31require_once($CFG->dirroot . '/mod/assign/locallib.php');
32
33/**
34 * Assignment grading options form
35 *
36 * @package mod_assign
37 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
39 */
40class mod_assign_grading_options_form extends moodleform {
41 /**
42 * Define this form - called from the parent constructor
43 */
44 function definition() {
45 $mform = $this->_form;
46 $instance = $this->_customdata;
36c7b866 47 $dirtyclass = array('class'=>'ignoredirty');
bbd0e548
DW
48
49 $mform->addElement('header', 'general', get_string('gradingoptions', 'assign'));
50 // visible elements
7056953a 51 $options = array(-1=>get_string('all'),10=>'10', 20=>'20', 50=>'50', 100=>'100');
36c7b866 52 $mform->addElement('select', 'perpage', get_string('assignmentsperpage', 'assign'), $options, $dirtyclass);
ec1ca389
SH
53 $options = array('' => get_string('filternone', 'assign'),
54 ASSIGN_FILTER_SUBMITTED => get_string('filtersubmitted', 'assign'),
55 ASSIGN_FILTER_REQUIRE_GRADING => get_string('filterrequiregrading', 'assign'));
145a300b 56 if ($instance['submissionsenabled']) {
36c7b866 57 $mform->addElement('select', 'filter', get_string('filter', 'assign'), $options, $dirtyclass);
145a300b 58 }
bf78ebd6
DW
59
60 // quickgrading
61 if ($instance['showquickgrading']) {
4f6e4a5b 62 $mform->addElement('checkbox', 'quickgrading', get_string('quickgrading', 'assign'), '', $dirtyclass);
bf78ebd6
DW
63 $mform->addHelpButton('quickgrading', 'quickgrading', 'assign');
64 $mform->setDefault('quickgrading', $instance['quickgrading']);
65 }
bbd0e548
DW
66
67 // hidden params
68 $mform->addElement('hidden', 'contextid', $instance['contextid']);
69 $mform->setType('contextid', PARAM_INT);
70 $mform->addElement('hidden', 'id', $instance['cm']);
71 $mform->setType('id', PARAM_INT);
72 $mform->addElement('hidden', 'userid', $instance['userid']);
73 $mform->setType('userid', PARAM_INT);
74 $mform->addElement('hidden', 'action', 'saveoptions');
75 $mform->setType('action', PARAM_ALPHA);
76
77 // buttons
78 $this->add_action_buttons(false, get_string('updatetable', 'assign'));
79 }
80}
81