MDL-47494 gapselect: work-in-progress converting the ddwtos and gapselect qtypes.
[moodle.git] / question / type / gapselect / edit_gapselect_form.php
CommitLineData
0d24b17a
TH
1<?php
2
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18
19/**
20 * Defines the editing form for the select missing words question type.
21 *
22 * @package qtype
23 * @subpackage gapselect
24 * @copyright 2011 The Open University
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 */
27
28require_once($CFG->dirroot . '/question/type/gapselect/edit_form_base.php');
29
30
31/**
32 * Select from drop down list question editing form definition.
33 *
34 * @copyright 2009 The Open University
35 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36 */
37class qtype_gapselect_edit_form extends qtype_gapselect_edit_form_base {
38
39 // HTML tags allowed in answers (choices).
40 protected $allowedhtmltags = array();
41
42 function qtype() {
43 return 'gapselect';
44 }
45
46 protected function default_values_from_feedback_field($feedback, $key) {
47 $default_values = array();
48 $default_values['choices['.$key.'][selectgroup]'] = $feedback;
49 return $default_values;
50 }
51
52 protected function repeated_options() {
53 $repeatedoptions = array();
54 $repeatedoptions['selectgroup']['default'] = '1';
55 return $repeatedoptions;
56 }
57 protected function choice_group(&$mform, $grouparray) {
58 $options = array();
59 for ($i = 1; $i <= 8; $i += 1) {
60 $options[$i] = $i;
61 }
62 $grouparray[] =& $mform->createElement('select', 'selectgroup', get_string('group', 'qtype_gapselect'), $options);
63 return $grouparray;
64 }
65}