|
|
|
@ -63,6 +63,7 @@ class Ims2Question extends Question |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Class |
|
|
|
|
* @package chamilo.exercise |
|
|
|
@ -104,12 +105,15 @@ class ImsAnswerMultipleChoice extends Answer |
|
|
|
|
{ |
|
|
|
|
$this->answerList = $this->getAnswersList(true); |
|
|
|
|
$type = $this->getQuestionType(); |
|
|
|
|
if ($type == MCMA) $cardinality = 'multiple'; else $cardinality = 'single'; |
|
|
|
|
if ($type == MCMA) { |
|
|
|
|
$cardinality = 'multiple'; |
|
|
|
|
} else { |
|
|
|
|
$cardinality = 'single'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$out = ' <responseDeclaration identifier="'.$questionIdent.'" cardinality="'.$cardinality.'" baseType="identifier">'."\n"; |
|
|
|
|
|
|
|
|
|
// Match the correct answers. |
|
|
|
|
|
|
|
|
|
$out .= ' <correctResponse>'."\n"; |
|
|
|
|
if (is_array($this->answerList)) { |
|
|
|
|
foreach ($this->answerList as $current_answer) { |
|
|
|
@ -120,8 +124,7 @@ class ImsAnswerMultipleChoice extends Answer |
|
|
|
|
} |
|
|
|
|
$out .= ' </correctResponse>'."\n"; |
|
|
|
|
|
|
|
|
|
//Add the grading |
|
|
|
|
|
|
|
|
|
// Add the grading |
|
|
|
|
$out .= ' <mapping>'."\n"; |
|
|
|
|
if (is_array($this->answerList)) { |
|
|
|
|
foreach ($this->answerList as $current_answer) { |
|
|
|
@ -257,7 +260,7 @@ class ImsAnswerMatching extends Answer |
|
|
|
|
if (isset($this->leftList) && is_array($this->leftList)) { |
|
|
|
|
foreach ($this->leftList as $leftKey => $leftElement) { |
|
|
|
|
$i = 0; |
|
|
|
|
foreach ($this->rightList as $rightKey=>$rightElement) { |
|
|
|
|
foreach ($this->rightList as $rightKey => $rightElement) { |
|
|
|
|
if (($leftElement['match'] == $rightElement['code'])) { |
|
|
|
|
$out .= ' <value>left_'.$leftKey.' right_'.$i.'</value>'."\n"; |
|
|
|
|
$gradeArray['left_'.$leftKey.' right_'.$i] = $leftElement['grade']; |
|
|
|
@ -269,7 +272,7 @@ class ImsAnswerMatching extends Answer |
|
|
|
|
$out .= ' </correctResponse>'."\n"; |
|
|
|
|
$out .= ' <mapping>'."\n"; |
|
|
|
|
if (is_array($gradeArray)) { |
|
|
|
|
foreach ($gradeArray as $gradeKey=>$grade) { |
|
|
|
|
foreach ($gradeArray as $gradeKey => $grade) { |
|
|
|
|
$out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>'."\n"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -304,7 +307,7 @@ class ImsAnswerHotspot extends Answer |
|
|
|
|
$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) { |
|
|
|
|
foreach ($this->answerList as $key => $answer) { |
|
|
|
|
$key = $answer['id']; |
|
|
|
|
$answerTxt = $answer['answer']; |
|
|
|
|
$len = api_strlen($answerTxt); |
|
|
|
@ -328,7 +331,7 @@ class ImsAnswerHotspot extends Answer |
|
|
|
|
$type = 'poly'; |
|
|
|
|
$coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']); |
|
|
|
|
break; |
|
|
|
|
case 'delineation' : |
|
|
|
|
case 'delineation': |
|
|
|
|
$type = 'delineation'; |
|
|
|
|
$coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']); |
|
|
|
|
break; |
|
|
|
@ -354,7 +357,7 @@ class ImsAnswerHotspot extends Answer |
|
|
|
|
$out .= ' <correctResponse>'."\n"; |
|
|
|
|
|
|
|
|
|
if (is_array($this->answerList)) { |
|
|
|
|
foreach ($this->answerList as $answerKey=>$answer) { |
|
|
|
|
foreach ($this->answerList as $answerKey => $answer) { |
|
|
|
|
$answerKey = $answer['id']; |
|
|
|
|
$answer = $answer['answer']; |
|
|
|
|
$out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>'; |
|
|
|
|