function qformat_hotpot::process_jmix in Quiz 6.6        
                          
                  
                        Same name and namespace in other branches
- 6.5 includes/moodle/question/format/hotpot/format.php \qformat_hotpot::process_jmix()
1 call to qformat_hotpot::process_jmix()
  - qformat_hotpot::readquestions in includes/moodle/question/format/hotpot/format.php
- Parses an array of lines into an array of questions,
where each item is a question object as defined by
readquestion().   Questions are defined as anything
between blank lines.
File
 
   - includes/moodle/question/format/hotpot/format.php, line 302
Class
  
  - qformat_hotpot 
- @package questionbank
@subpackage importexport
Code
function process_jmix(&$xml, &$questions) {
  
  $defaultgrade = 1;
  $segment_count = 0;
  
  $tags = 'data,jumbled-order-exercise';
  $x = 0;
  while (($exercise = "[{$x}]['#']") && $xml
    ->xml_value($tags, $exercise)) {
    
    if (method_exists($this, 'defaultquestion')) {
      $question = $this
        ->defaultquestion();
    }
    else {
      $question = new stdClass();
      $question->usecase = 0;
      
      $question->image = "";
      
    }
    $question->qtype = SHORTANSWER;
    $question->name = $this
      ->hotpot_get_title($xml, $x);
    $question->answer = array();
    $question->fraction = array();
    $question->feedback = array();
    $i = 0;
    $segments = array();
    while ($segment = $xml
      ->xml_value($tags, $exercise . "['main-order'][0]['#']['segment'][{$i}]['#']")) {
      $segments[] = $this
        ->hotpot_prepare_str($segment);
      $segment_count++;
      $i++;
    }
    $answer = implode(' ', $segments);
    $this
      ->hotpot_seed_RNG();
    shuffle($segments);
    $question->questiontext = $this
      ->hotpot_get_reading($xml);
    $question->questiontext .= $this
      ->hotpot_get_instructions($xml);
    $question->questiontext .= '   <NOBR><B>[   ' . implode('   ', $segments) . '   ]</B></NOBR>';
    $a = 0;
    while (!empty($answer)) {
      $question->answer[$a] = $answer;
      $question->fraction[$a] = 1;
      $question->feedback[$a] = '';
      $answer = $this
        ->hotpot_prepare_str($xml
        ->xml_value($tags, $exercise . "['alternate'][{$a}]['#']"));
      $a++;
    }
    $question->defaultgrade = $segment_count * $defaultgrade;
    $questions[] = $question;
    $x++;
  }
}