Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
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 * Form for grade history filters 19 * 20 * @package gradereport_history 21 * @copyright 2013 NetSpot Pty Ltd (https://www.netspot.com.au) 22 * @author Adam Olley <adam.olley@netspot.com.au> 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 namespace gradereport_history; 27 28 defined('MOODLE_INTERNAL') || die; 29 30 require_once($CFG->libdir.'/formslib.php'); 31 32 /** 33 * Form for grade history filters 34 * 35 * @since Moodle 2.8 36 * @package gradereport_history 37 * @copyright 2013 NetSpot Pty Ltd (https://www.netspot.com.au) 38 * @author Adam Olley <adam.olley@netspot.com.au> 39 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 40 */ 41 class filter_form extends \moodleform { 42 43 /** 44 * Definition of the Mform for filters displayed in the report. 45 */ 46 public function definition() { 47 48 $mform = $this->_form; 49 $course = $this->_customdata['course']; 50 $itemids = $this->_customdata['itemids']; 51 $graders = $this->_customdata['graders']; 52 $userbutton = $this->_customdata['userbutton']; 53 $names = \html_writer::span('', 'selectednames'); 54 55 $mform->addElement('static', 'userselect', get_string('selectusers', 'gradereport_history'), $userbutton); 56 $mform->addElement('static', 'selectednames', get_string('selectedusers', 'gradereport_history'), $names); 57 58 $mform->addElement('select', 'itemid', get_string('gradeitem', 'grades'), $itemids); 59 $mform->setType('itemid', PARAM_INT); 60 61 $mform->addElement('select', 'grader', get_string('grader', 'gradereport_history'), $graders); 62 $mform->setType('grader', PARAM_INT); 63 64 $mform->addElement('date_selector', 'datefrom', get_string('datefrom', 'gradereport_history'), array('optional' => true)); 65 $mform->addElement('date_selector', 'datetill', get_string('dateto', 'gradereport_history'), array('optional' => true)); 66 67 $mform->addElement('checkbox', 'revisedonly', get_string('revisedonly', 'gradereport_history')); 68 $mform->addHelpButton('revisedonly', 'revisedonly', 'gradereport_history'); 69 70 $mform->addElement('hidden', 'id', $course->id); 71 $mform->setType('id', PARAM_INT); 72 73 $mform->addElement('hidden', 'userids'); 74 $mform->setType('userids', PARAM_SEQUENCE); 75 76 $mform->addElement('hidden', 'userfullnames'); 77 $mform->setType('userfullnames', PARAM_TEXT); 78 79 // Add a submit button. 80 $mform->addElement('submit', 'submitbutton', get_string('submit')); 81 } 82 83 /** 84 * This method implements changes to the form that need to be made once the form data is set. 85 */ 86 public function definition_after_data() { 87 $mform = $this->_form; 88 89 if ($userfullnames = $mform->getElementValue('userfullnames')) { 90 $mform->getElement('selectednames')->setValue(\html_writer::span($userfullnames, 'selectednames')); 91 } 92 } 93 94 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body