From 90090b361037d2c02629f7285b53a61597a0b436 Mon Sep 17 00:00:00 2001 From: harris wong Date: Fri, 26 Aug 2011 21:05:58 +0000 Subject: [PATCH] 4772: Now import QTI packages with the correct multiple-choice answers. --- docs/mods/_core/imsqti/classes/QTIParser.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/mods/_core/imsqti/classes/QTIParser.class.php b/docs/mods/_core/imsqti/classes/QTIParser.class.php index f69c7ac7b..fe0ec95eb 100644 --- a/docs/mods/_core/imsqti/classes/QTIParser.class.php +++ b/docs/mods/_core/imsqti/classes/QTIParser.class.php @@ -230,6 +230,10 @@ class QTIParser { break; case 'varequal': //stores the answers (either correct or incorrect) into a stack + if (in_array('not', $this->element_path)) { + //if there is a "not", it's a multiple answer, and this should be included to the answer + break; + } $this->temp_answer[$this->attributes[$this->item_num][$name]['respident']]['name'][] = $this->character_data; //responses handling, remember to save the answers or match them up if (!is_array($this->answers[$this->item_num])){ @@ -250,7 +254,7 @@ class QTIParser { $tv = $this->temp_answer[$this->attributes[$this->item_num]['varequal']['respident']]; //debug($tv, 'harris'.$this->item_num); //debug($this->choices[$this->item_num], 'choices'); - //debug($this->answers_for_matching[$this->item_num], 'answers'); + //debug($this->answers_for_matching[$this->item_num], 'answers for matching'); //If matching, then attribute = 'Respondus_correct'; otherwise it is 'que_score' if ($this->getQuestionType($this->item_num) == 5){ @@ -286,8 +290,7 @@ class QTIParser { $this->answers_for_matching[$this->item_num] = array(); } // if (!in_array($tv['name'][$val_id], $this->answers_for_matching[$this->item_num])){ - array_push($this->answers_for_matching[$this->item_num], $tv['name'][$this->item_num]); - + array_push($this->answers_for_matching[$this->item_num], $tv['name'][sizeof($tv['name'])-1]); //add mark $this->weights[$this->item_num] += floatval($current_answer); // } @@ -471,4 +474,4 @@ class QTIParser { } -?> \ No newline at end of file +?> -- 2.17.1