public function process_fib($xml, &$questions) {
        if ($this->getpath($xml, array('POOL', '#', 'QUESTION_FILLINBLANK'), false, false)) {
            $fibquestions = $this->getpath($xml,
                    array('POOL', '#', 'QUESTION_FILLINBLANK'), false, false);
        } else {
            return;
        }

        foreach ($fibquestions as $thisquestion) {

            $question = $this->process_common($thisquestion);

            $question->qtype = 'shortanswer';
            $question->usecase = 0; // Ignore case.

            $correctfeedback = $this->getpath($thisquestion,
                    array('#', 'GRADABLE', 0, '#', 'FEEDBACK_WHEN_CORRECT', 0, '#'),
                    '', true);
            $incorrectfeedback = $this->getpath($thisquestion,
                    array('#', 'GRADABLE', 0, '#', 'FEEDBACK_WHEN_INCORRECT', 0, '#'),
                    '', true);
            $answers = $this->getpath($thisquestion, array('#', 'ANSWER'), false, false);
            foreach ($answers as $answer) {
                $question->answer[] = $this->getpath($answer,
                        array('#', 'TEXT', 0, '#'), '', true);
                $question->fraction[] = 1;
                $question->feedback[] = $this->cleaned_text_field($correctfeedback);
            }
            $question->answer[] = '*';
            $question->fraction[] = 0;
            $question->feedback[] = $this->cleaned_text_field($incorrectfeedback);

            $questions[] = $question;
        }
    }
public function process_fib($xml, &$questions) {
        if ($this->getpath($xml, array('POOL', '#', 'QUESTION_FILLINBLANK'), false, false)) {
            $fibquestions = $this->getpath($xml,
                    array('POOL', '#', 'QUESTION_FILLINBLANK'), false, false);
        } else {
            return;
        }

        foreach ($fibquestions as $thisquestion) {

            $question = $this->process_common($thisquestion);

            $question->qtype = 'shortanswer';
            $question->usecase = 0; // Ignore case.

            $correctfeedback = $this->getpath($thisquestion,
                    array('#', 'GRADABLE', 0, '#', 'FEEDBACK_WHEN_CORRECT', 0, '#'),
                    '', true);
            $incorrectfeedback = $this->getpath($thisquestion,
                    array('#', 'GRADABLE', 0, '#', 'FEEDBACK_WHEN_INCORRECT', 0, '#'),
                    '', true);
            $answers = $this->getpath($thisquestion, array('#', 'ANSWER'), false, false);
            foreach ($answers as $answer) {
                $question->answer[] = $this->getpath($answer,
                        array('#', 'TEXT', 0, '#'), '', true);
                $question->fraction[] = 1;
                $question->feedback[] = $this->cleaned_text_field($correctfeedback);
            }
            $question->answer[] = '*';
            $question->fraction[] = 0;
            $question->feedback[] = $this->cleaned_text_field($incorrectfeedback);

            $questions[] = $question;
        }
    }
public function process_fib ( $ xml , & $ questions ) { if ( $ this -> getpath ( $ xml , array ( 'POOL' , '#' , 'QUESTION_FILLINBLANK' ) , false , false ) ) { $ fibquestions = $ this -> getpath ( $ xml , array ( 'POOL' , '#' , 'QUESTION_FILLINBLANK' ) , false , false ) ; } else { return ; } foreach ( $ fibquestions as $ thisquestion ) { $ question = $ this -> process_common ( $ thisquestion ) ; $ question -> qtype = 'shortanswer' ; $ question -> usecase = 0 ; // Ignore case. $ correctfeedback = $ this -> getpath ( $ thisquestion , array ( '#' , 'GRADABLE' , 0 , '#' , 'FEEDBACK_WHEN_CORRECT' , 0 , '#' ) , '' , true ) ; $ incorrectfeedback = $ this -> getpath ( $ thisquestion , array ( '#' , 'GRADABLE' , 0 , '#' , 'FEEDBACK_WHEN_INCORRECT' , 0 , '#' ) , '' , true ) ; $ answers = $ this -> getpath ( $ thisquestion , array ( '#' , 'ANSWER' ) , false , false ) ; foreach ( $ answers as $ answer ) { $ question -> answer [ ] = $ this -> getpath ( $ answer , array ( '#' , 'TEXT' , 0 , '#' ) , '' , true ) ; $ question -> fraction [ ] = 1 ; $ question -> feedback [ ] = $ this -> cleaned_text_field ( $ correctfeedback ) ; } $ question -> answer [ ] = '*' ; $ question -> fraction [ ] = 0 ; $ question -> feedback [ ] = $ this -> cleaned_text_field ( $ incorrectfeedback ) ; $ questions [ ] = $ question ; } }
Process Fill in the Blank Questions
@param array $xml the xml tree
@param array $questions the questions already parsed
Process Fill in the Blank Questions