[svn r18575] Minor - Fixed warning when you export an exercise - see FS#3679

skala
Cristian Fasanando 16 years ago
parent b5e41b8085
commit a12dca3f3d
  1. 31
      main/exercice/export/qti2/qti2_classes.php

@ -90,7 +90,7 @@ class ImsAnswerMultipleChoice extends Answer
$this->answerList = $this->getAnswersList();
$out = ' <choiceInteraction responseIdentifier="' . $questionIdent . '" >' . "\n";
$out .= ' <prompt> ' . $questionStatment . ' </prompt>'. "\n";
if (is_array($this->answerList)) {
foreach ($this->answerList as $current_answer)
{
$out .= ' <simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false">' . $current_answer['answer'];
@ -100,7 +100,7 @@ class ImsAnswerMultipleChoice extends Answer
}
$out .= '</simpleChoice>'. "\n";
}
}
$out .= ' </choiceInteraction>'. "\n";
return $out;
}
@ -120,7 +120,7 @@ class ImsAnswerMultipleChoice extends Answer
//Match the correct answers
$out .= ' <correctResponse>'. "\n";
if (is_array($this->answerList)) {
foreach($this->answerList as $current_answer)
{
if ($current_answer['correct'])
@ -128,12 +128,13 @@ class ImsAnswerMultipleChoice extends Answer
$out .= ' <value>answer_'. $current_answer['id'] .'</value>'. "\n";
}
}
}
$out .= ' </correctResponse>'. "\n";
//Add the grading
$out .= ' <mapping>'. "\n";
if (is_array($this->answerList)) {
foreach($this->answerList as $current_answer)
{
if (isset($current_answer['grade']))
@ -141,6 +142,7 @@ class ImsAnswerMultipleChoice extends Answer
$out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n";
}
}
}
$out .= ' </mapping>'. "\n";
$out .= ' </responseDeclaration>'. "\n";
@ -167,7 +169,7 @@ class ImsAnswerFillInBlanks extends Answer
// {
$text = '';
$text .= $this->answerText;
if (is_array($this->answerList)) {
foreach ($this->answerList as $key=>$answer)
{
$key = $answer['id'];
@ -175,6 +177,7 @@ class ImsAnswerFillInBlanks extends Answer
$len = strlen($answer);
$text = str_replace('['.$answer.']','<textEntryInteraction responseIdentifier="fill_'.$key.'" expectedLength="'.strlen($answer).'"/>', $text);
}
}
$out = $text;
// }
// break;
@ -234,7 +237,7 @@ class ImsAnswerFillInBlanks extends Answer
$this->answerList = $this->getAnswersList();
$this->gradeList = $this->getGradesList();
$out = '';
if (is_array($this->answerList)) {
foreach ($this->answerList as $answerKey=>$answer)
{
$answerKey = $answer['id'];
@ -271,6 +274,7 @@ class ImsAnswerFillInBlanks extends Answer
$out .= ' </responseDeclaration>'. "\n";
}
}
return $out;
}
@ -294,11 +298,12 @@ class ImsAnswerMatching extends Answer
//add left column
$out .= ' <simpleMatchSet>'. "\n";
if (is_array($this->leftList)) {
foreach ($this->leftList as $leftKey=>$leftElement)
{
$out .= ' <simpleAssociableChoice identifier="left_'.$leftKey.'" >'. $leftElement['answer'] .'</simpleAssociableChoice>'. "\n";
}
}
$out .= ' </simpleMatchSet>'. "\n";
@ -308,12 +313,13 @@ class ImsAnswerMatching extends Answer
$i = 0;
if (is_array($this->rightList)) {
foreach($this->rightList as $rightKey=>$rightElement)
{
$out .= ' <simpleAssociableChoice identifier="right_'.$i.'" >'. $rightElement['answer'] .'</simpleAssociableChoice>'. "\n";
$i++;
}
}
$out .= ' </simpleMatchSet>'. "\n";
$out .= '</matchInteraction>'. "\n";
@ -331,7 +337,7 @@ class ImsAnswerMatching extends Answer
$out .= ' <correctResponse>' . "\n";
$gradeArray = array();
if (is_array($this->leftList)) {
foreach ($this->leftList as $leftKey=>$leftElement)
{
$i=0;
@ -346,12 +352,15 @@ class ImsAnswerMatching extends Answer
$i++;
}
}
}
$out .= ' </correctResponse>'. "\n";
$out .= ' <mapping>' . "\n";
if (is_array($gradeArray)) {
foreach ($gradeArray as $gradeKey=>$grade)
{
$out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n";
}
}
$out .= ' </mapping>' . "\n";
$out .= ' </responseDeclaration>'. "\n";
@ -380,6 +389,7 @@ class ImsAnswerHotspot extends Answer
$text .= ' <graphicOrderInteraction responseIdentifier="hotspot_'.$questionIdent.'">'."\n";
$text .= ' <prompt>'.$questionDesc.'</prompt>'."\n";
$text .= ' <object type="'.$mimetype.'" width="250" height="230" data="'.$questionMedia.'">-</object>'."\n";
if (is_array($this->answerList)) {
foreach ($this->answerList as $key=>$answer)
{
$key = $answer['id'];
@ -412,6 +422,7 @@ class ImsAnswerHotspot extends Answer
}
$text .= ' <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n";
}
}
$text .= ' </graphicOrderInteraction>'."\n";
$out = $text;
@ -432,6 +443,7 @@ class ImsAnswerHotspot extends Answer
$out .= ' <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">' . "\n";
$out .= ' <correctResponse>'. "\n";
if (is_array($this->answerList)) {
foreach ($this->answerList as $answerKey=>$answer)
{
$answerKey = $answer['id'];
@ -439,6 +451,7 @@ class ImsAnswerHotspot extends Answer
$out .= ' <value>'.$answerKey.'</value>'. "\n";
}
}
$out .= ' </correctResponse>'. "\n";
$out .= ' </responseDeclaration>'. "\n";

Loading…
Cancel
Save