|
| 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 | +namespace mod_questionnaire\local\db; |
| 18 | + |
| 19 | +/** |
| 20 | + * Question record class for Questionnaire. |
| 21 | + * Handles all operations for questionnaire questions. |
| 22 | + * |
| 23 | + * @package mod_questionnaire |
| 24 | + * @copyright 2025 onward Mike Churchward ([email protected]) |
| 25 | + * @author Mike Churchward |
| 26 | + * @license http://www.gnu.org/copyleft/gpl.html GNU Public License |
| 27 | + */ |
| 28 | +class question_record extends \core\persistent { |
| 29 | + /** Table name for the persistent. */ |
| 30 | + const TABLE = 'questionnaire_question'; |
| 31 | + |
| 32 | + /** @var int The question id. */ |
| 33 | + protected $id; |
| 34 | + |
| 35 | + /** @var int The survey id. */ |
| 36 | + protected $surveyid; |
| 37 | + |
| 38 | + /** @var string Question name. */ |
| 39 | + protected $name; |
| 40 | + |
| 41 | + /** @var int Question type id. */ |
| 42 | + protected $type_id; |
| 43 | + |
| 44 | + /** @var int Result id. */ |
| 45 | + protected $result_id; |
| 46 | + |
| 47 | + /** @var int Question length. */ |
| 48 | + protected $length; |
| 49 | + |
| 50 | + /** @var int Precision. */ |
| 51 | + protected $precise; |
| 52 | + |
| 53 | + /** @var int Question position. */ |
| 54 | + protected $position; |
| 55 | + |
| 56 | + /** @var string Question content. */ |
| 57 | + protected $content; |
| 58 | + |
| 59 | + /** @var string Required flag. */ |
| 60 | + protected $required; |
| 61 | + |
| 62 | + /** @var int Deletion timestamp. */ |
| 63 | + protected $deleted; |
| 64 | + |
| 65 | + /** @var string Extra data for additional fields. */ |
| 66 | + protected $extradata; |
| 67 | + |
| 68 | + /** |
| 69 | + * Return the definition of the properties of this model. |
| 70 | + * |
| 71 | + * @return array |
| 72 | + */ |
| 73 | + protected static function define_properties() { |
| 74 | + return [ |
| 75 | + 'id' => [ |
| 76 | + 'type' => PARAM_INT, |
| 77 | + 'null' => NULL_NOT_ALLOWED, |
| 78 | + 'description' => 'The question id.', |
| 79 | + ], |
| 80 | + 'surveyid' => [ |
| 81 | + 'type' => PARAM_INT, |
| 82 | + 'default' => 0, |
| 83 | + 'null' => NULL_NOT_ALLOWED, |
| 84 | + 'description' => 'The survey id.', |
| 85 | + ], |
| 86 | + 'name' => [ |
| 87 | + 'type' => PARAM_TEXT, |
| 88 | + 'default' => null, |
| 89 | + 'null' => NULL_ALLOWED, |
| 90 | + 'description' => 'Question name.', |
| 91 | + ], |
| 92 | + 'type_id' => [ |
| 93 | + 'type' => PARAM_INT, |
| 94 | + 'default' => 0, |
| 95 | + 'null' => NULL_NOT_ALLOWED, |
| 96 | + 'description' => 'Question type id.', |
| 97 | + ], |
| 98 | + 'result_id' => [ |
| 99 | + 'type' => PARAM_INT, |
| 100 | + 'default' => null, |
| 101 | + 'null' => NULL_ALLOWED, |
| 102 | + 'description' => 'Result id.', |
| 103 | + ], |
| 104 | + 'length' => [ |
| 105 | + 'type' => PARAM_INT, |
| 106 | + 'default' => 0, |
| 107 | + 'null' => NULL_NOT_ALLOWED, |
| 108 | + 'description' => 'Question length.', |
| 109 | + ], |
| 110 | + 'precise' => [ |
| 111 | + 'type' => PARAM_INT, |
| 112 | + 'default' => 0, |
| 113 | + 'null' => NULL_NOT_ALLOWED, |
| 114 | + 'description' => 'Precision.', |
| 115 | + ], |
| 116 | + 'position' => [ |
| 117 | + 'type' => PARAM_INT, |
| 118 | + 'default' => 0, |
| 119 | + 'null' => NULL_NOT_ALLOWED, |
| 120 | + 'description' => 'Question position.', |
| 121 | + ], |
| 122 | + 'content' => [ |
| 123 | + 'type' => PARAM_RAW, |
| 124 | + 'null' => NULL_NOT_ALLOWED, |
| 125 | + 'description' => 'Question content.', |
| 126 | + ], |
| 127 | + 'required' => [ |
| 128 | + 'type' => PARAM_TEXT, |
| 129 | + 'default' => 'n', |
| 130 | + 'null' => NULL_NOT_ALLOWED, |
| 131 | + 'description' => 'Required flag.', |
| 132 | + ], |
| 133 | + 'deleted' => [ |
| 134 | + 'type' => PARAM_INT, |
| 135 | + 'default' => null, |
| 136 | + 'null' => NULL_ALLOWED, |
| 137 | + 'description' => 'The timestamp record last deleted.', |
| 138 | + ], |
| 139 | + 'extradata' => [ |
| 140 | + 'type' => PARAM_RAW, |
| 141 | + 'default' => null, |
| 142 | + 'null' => NULL_ALLOWED, |
| 143 | + 'description' => 'Extra data for additional fields.', |
| 144 | + ], |
| 145 | + ]; |
| 146 | + } |
| 147 | +} |
0 commit comments