/** * @param moodleform $combinedform * @param MoodleQuickForm $mform * @param $repeatenabled */ public function add_form_fragment(moodleform $combinedform, MoodleQuickForm $mform, $repeatenabled) { $mform->addElement('advcheckbox', $this->form_field_name('shuffleanswers'), get_string('shuffle', 'qtype_gapselect')); $answerel = array($mform->createElement('text', $this->form_field_name('answer'), get_string('choicex', 'qtype_gapselect'), array('size' => 57, 'class' => 'tweakcss'))); if ($this->questionrec !== null) { $countanswers = count($this->questionrec->options->answers); } else { $countanswers = 0; } if ($repeatenabled) { $defaultstartnumbers = QUESTION_NUMANS_START * 2; $repeatsatstart = max($defaultstartnumbers, $countanswers + QUESTION_NUMANS_ADD); } else { $repeatsatstart = $countanswers; } $combinedform->repeat_elements($answerel, $repeatsatstart, array(), $this->form_field_name('noofchoices'), $this->form_field_name('morechoices'), QUESTION_NUMANS_ADD, get_string('addmorechoiceblanks', 'qtype_gapselect'), true); $mform->setType($this->form_field_name('answer'), PARAM_RAW_TRIMMED); }