protected function add_per_answer_fields(&$mform, $label, $gradeoptions,
            $minoptions = QUESTION_NUMANS_START, $addoptions = QUESTION_NUMANS_ADD) {
        $mform->addElement('header', 'answerhdr',
                    get_string('answers', 'question'), '');
        $mform->setExpanded('answerhdr', 1);
        $answersoption = '';
        $repeatedoptions = array();
        $repeated = $this->get_per_answer_fields($mform, $label, $gradeoptions,
                $repeatedoptions, $answersoption);

        if (isset($this->question->options)) {
            $repeatsatstart = count($this->question->options->$answersoption);
        } else {
            $repeatsatstart = $minoptions;
        }

        $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions,
                'noanswers', 'addanswers', $addoptions,
                $this->get_more_choices_string(), true);
    }
protected function add_per_answer_fields(&$mform, $label, $gradeoptions,
            $minoptions = QUESTION_NUMANS_START, $addoptions = QUESTION_NUMANS_ADD) {
        $mform->addElement('header', 'answerhdr',
                    get_string('answers', 'question'), '');
        $mform->setExpanded('answerhdr', 1);
        $answersoption = '';
        $repeatedoptions = array();
        $repeated = $this->get_per_answer_fields($mform, $label, $gradeoptions,
                $repeatedoptions, $answersoption);

        if (isset($this->question->options)) {
            $repeatsatstart = count($this->question->options->$answersoption);
        } else {
            $repeatsatstart = $minoptions;
        }

        $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions,
                'noanswers', 'addanswers', $addoptions,
                $this->get_more_choices_string(), true);
    }
protected function add_per_answer_fields ( & $ mform , $ label , $ gradeoptions , $ minoptions = QUESTION_NUMANS_START , $ addoptions = QUESTION_NUMANS_ADD ) { $ mform -> addElement ( 'header' , 'answerhdr' , get_string ( 'answers' , 'question' ) , '' ) ; $ mform -> setExpanded ( 'answerhdr' , 1 ) ; $ answersoption = '' ; $ repeatedoptions = array ( ) ; $ repeated = $ this -> get_per_answer_fields ( $ mform , $ label , $ gradeoptions , $ repeatedoptions , $ answersoption ) ; if ( isset ( $ this -> question -> options ) ) { $ repeatsatstart = count ( $ this -> question -> options -> $ answersoption ) ; } else { $ repeatsatstart = $ minoptions ; } $ this -> repeat_elements ( $ repeated , $ repeatsatstart , $ repeatedoptions , 'noanswers' , 'addanswers' , $ addoptions , $ this -> get_more_choices_string ( ) , true ) ; }
Add a set of form fields, obtained from get_per_answer_fields, to the form,
one for each existing answer, with some blanks for some new ones.
@param object $mform the form being built.
@param $label the label to use for each option.
@param $gradeoptions the possible grades for each answer.
@param $minoptions the minimum number of answer blanks to display.
Default QUESTION_NUMANS_START.
@param $addoptions the number of answer blanks to add. Default QUESTION_NUMANS_ADD.
Add a set of form fields obtained from get_per_answer_fields to the form one for each existing answer with some blanks for some new ones .