Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
84.62% |
11 / 13 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| text_form | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| definition | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | // This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. |
| 16 | |
| 17 | namespace local_integritycase\form; |
| 18 | |
| 19 | defined('MOODLE_INTERNAL') || die(); |
| 20 | |
| 21 | require_once($CFG->libdir . '/formslib.php'); |
| 22 | |
| 23 | /** |
| 24 | * One text box and a button: a private note, a student response or an appeal. |
| 25 | * |
| 26 | * @package local_integritycase |
| 27 | * @copyright 2026 DevLMS <contact@devlms.com> |
| 28 | * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
| 29 | */ |
| 30 | class text_form extends \moodleform { |
| 31 | /** |
| 32 | * Define the fields. Custom data: action (note, respond or appeal), header, label, button. |
| 33 | */ |
| 34 | protected function definition() { |
| 35 | $mform = $this->_form; |
| 36 | $data = $this->_customdata; |
| 37 | $mform->addElement('hidden', 'id'); |
| 38 | $mform->setType('id', PARAM_INT); |
| 39 | $mform->addElement('hidden', 'action', $data['action']); |
| 40 | $mform->setType('action', PARAM_ALPHA); |
| 41 | $mform->addElement('header', $data['action'] . 'hdr', $data['header']); |
| 42 | $mform->addElement('textarea', 'text', $data['label'], ['rows' => 5, 'cols' => 60]); |
| 43 | $mform->setType('text', PARAM_TEXT); |
| 44 | $mform->addRule('text', null, 'required', null, 'client'); |
| 45 | $this->add_action_buttons(false, $data['button']); |
| 46 | } |
| 47 | } |