Skip to content

Commit

Permalink
5676 decode,stripslashes and hack to increment multiple answer questi…
Browse files Browse the repository at this point in the history
…on on QTI import
  • Loading branch information
gregrgay committed Apr 16, 2016
1 parent 1d49cca commit a08053f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions mods/_core/imsqti/classes/QTIImport.class.php
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -185,7 +189,7 @@ function importQuestions($attributes){
$this->copyMedia($attrs['file'], $xml_items);
}
}

debug_to_log($test_obj['answers']);
return $qids;
}

Expand Down

0 comments on commit a08053f

Please sign in to comment.