2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 * This file contains the forms to create and edit an instance of this module
21 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 defined('MOODLE_INTERNAL') ||
die('Direct access to this script is forbidden.');
28 require_once($CFG->libdir
.'/formslib.php');
29 require_once($CFG->dirroot
. '/mod/assign/locallib.php');
32 * Assignment grading options form
35 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
36 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38 class mod_assign_grading_options_form
extends moodleform
{
40 * Define this form - called from the parent constructor.
42 public function definition() {
43 $mform = $this->_form
;
44 $instance = $this->_customdata
;
45 $dirtyclass = array('class'=>'ignoredirty');
47 $mform->addElement('header', 'general', get_string('gradingoptions', 'assign'));
49 $options = array(-1=>get_string('all'), 10=>'10', 20=>'20', 50=>'50', 100=>'100');
50 $mform->addElement('select', 'perpage', get_string('assignmentsperpage', 'assign'), $options, $dirtyclass);
51 $options = array('' => get_string('filternone', 'assign'),
52 ASSIGN_FILTER_SUBMITTED
=> get_string('filtersubmitted', 'assign'),
53 ASSIGN_FILTER_REQUIRE_GRADING
=> get_string('filterrequiregrading', 'assign'));
54 if ($instance['submissionsenabled']) {
55 $mform->addElement('select', 'filter', get_string('filter', 'assign'), $options, $dirtyclass);
57 if (!empty($instance['markingallocationopt'])) {
58 $markingfilter = get_string('markerfilter', 'assign');
59 $mform->addElement('select', 'markerfilter', $markingfilter, $instance['markingallocationopt'], $dirtyclass);
61 if (!empty($instance['markingworkflowopt'])) {
62 $workflowfilter = get_string('workflowfilter', 'assign');
63 $mform->addElement('select', 'workflowfilter', $workflowfilter, $instance['markingworkflowopt'], $dirtyclass);
66 if ($instance['showquickgrading']) {
67 $mform->addElement('checkbox', 'quickgrading', get_string('quickgrading', 'assign'), '', $dirtyclass);
68 $mform->addHelpButton('quickgrading', 'quickgrading', 'assign');
69 $mform->setDefault('quickgrading', $instance['quickgrading']);
72 // Show active/suspended user option.
73 if ($instance['showonlyactiveenrolopt']) {
74 $mform->addElement('checkbox', 'showonlyactiveenrol', get_string('showonlyactiveenrol', 'grades'), '', $dirtyclass);
75 $mform->addHelpButton('showonlyactiveenrol', 'showonlyactiveenrol', 'grades');
76 $mform->setDefault('showonlyactiveenrol', $instance['showonlyactiveenrol']);
80 $mform->addElement('hidden', 'contextid', $instance['contextid']);
81 $mform->setType('contextid', PARAM_INT
);
82 $mform->addElement('hidden', 'id', $instance['cm']);
83 $mform->setType('id', PARAM_INT
);
84 $mform->addElement('hidden', 'userid', $instance['userid']);
85 $mform->setType('userid', PARAM_INT
);
86 $mform->addElement('hidden', 'action', 'saveoptions');
87 $mform->setType('action', PARAM_ALPHA
);
90 $this->add_action_buttons(false, get_string('updatetable', 'assign'));