From a08053f5f4abbe98b80f261a2b5032c17831ebfe Mon Sep 17 00:00:00 2001 From: Greg Gay Date: Sat, 16 Apr 2016 15:27:52 -0400 Subject: [PATCH] 5676 decode,stripslashes and hack to increment multiple answer question on QTI import --- mods/_core/imsqti/classes/QTIImport.class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mods/_core/imsqti/classes/QTIImport.class.php b/mods/_core/imsqti/classes/QTIImport.class.php index f61fb9694..71dc6fad5 100644 --- a/mods/_core/imsqti/classes/QTIImport.class.php +++ b/mods/_core/imsqti/classes/QTIImport.class.php @@ -120,8 +120,8 @@ function importQuestions($attributes){ $test_obj['required'] = 1; $test_obj['preset_num'] = 0; $test_obj['category_id'] = 0; - $test_obj['question'] = htmlspecialchars($xml->question[$loopcounter], ENT_QUOTES); - $test_obj['feedback'] = htmlspecialchars($xml->feedback[$loopcounter], ENT_QUOTES); + $test_obj['question'] = htmlspecialchars_decode(stripslashes($xml->question[$loopcounter]), ENT_QUOTES); + $test_obj['feedback'] = htmlspecialchars_decode(stripslashes($xml->feedback[$loopcounter]), ENT_QUOTES); $test_obj['groups'] = $xml->groups[$loopcounter]; $test_obj['property'] = intval($xml->attributes[$loopcounter]['render_fib']['property']); $test_obj['choice'] = array(); @@ -163,8 +163,12 @@ function importQuestions($attributes){ $this->getQuestionType($xml->getQuestionType($loopcounter)); //save question id - $qids[] = $this->qid; - + if(in_array($this->qid, $qids)){ + // This condition is a hack to deal with multiple answer questions 5676 + // Increment the counter by one, if the qid already exists + $this->qid = $this->qid+1; + } + $qids[] = $this->qid; //Dependency handling if (!empty($attrs['dependency'])){ $xml_items = array_merge($xml_items, $xml->items); @@ -185,7 +189,7 @@ function importQuestions($attributes){ $this->copyMedia($attrs['file'], $xml_items); } } - + debug_to_log($test_obj['answers']); return $qids; }