Minor - Format code, fix PHP warnings

pull/2487/head
jmontoyaa 9 years ago
parent e3a2809867
commit a0bffd4f87
  1. 14
      main/exercise/export/qti2/qti2_classes.php

@ -151,8 +151,8 @@ class ImsAnswerFillInBlanks extends Answer
public function imsExportResponses($questionIdent, $questionStatment) public function imsExportResponses($questionIdent, $questionStatment)
{ {
$this->answerList = $this->getAnswersList(true); $this->answerList = $this->getAnswersList(true);
$text = '';
$text .= $this->answerText; $text = isset($this->answerText) ? $this->answerText : '';
if (is_array($this->answerList)) { if (is_array($this->answerList)) {
foreach ($this->answerList as $key => $answer) { foreach ($this->answerList as $key => $answer) {
$key = $answer['id']; $key = $answer['id'];
@ -210,13 +210,10 @@ class ImsAnswerMatching extends Answer
$this->answerList = $this->getAnswersList(true); $this->answerList = $this->getAnswersList(true);
$maxAssociation = max(count($this->leftList), count($this->rightList)); $maxAssociation = max(count($this->leftList), count($this->rightList));
$out = ""; $out = '<matchInteraction responseIdentifier="' . $questionIdent . '" maxAssociations="'. $maxAssociation .'">'. "\n";
$out .= '<matchInteraction responseIdentifier="' . $questionIdent . '" maxAssociations="'. $maxAssociation .'">'. "\n";
$out .= $questionStatment; $out .= $questionStatment;
//add left column //add left column
$out .= ' <simpleMatchSet>'. "\n"; $out .= ' <simpleMatchSet>'. "\n";
if (is_array($this->leftList)) { if (is_array($this->leftList)) {
foreach ($this->leftList as $leftKey=>$leftElement) { foreach ($this->leftList as $leftKey=>$leftElement) {
@ -230,9 +227,7 @@ class ImsAnswerMatching extends Answer
$out .= ' </simpleMatchSet>'. "\n"; $out .= ' </simpleMatchSet>'. "\n";
//add right column //add right column
$out .= ' <simpleMatchSet>'. "\n"; $out .= ' <simpleMatchSet>'. "\n";
$i = 0; $i = 0;
if (is_array($this->rightList)) { if (is_array($this->rightList)) {
@ -259,13 +254,12 @@ class ImsAnswerMatching extends Answer
$out .= ' <correctResponse>' . "\n"; $out .= ' <correctResponse>' . "\n";
$gradeArray = array(); $gradeArray = array();
if (is_array($this->leftList)) { if (isset($this->leftList) && is_array($this->leftList)) {
foreach ($this->leftList as $leftKey => $leftElement) { foreach ($this->leftList as $leftKey => $leftElement) {
$i=0; $i=0;
foreach ($this->rightList as $rightKey=>$rightElement) { foreach ($this->rightList as $rightKey=>$rightElement) {
if (($leftElement['match'] == $rightElement['code'])) { if (($leftElement['match'] == $rightElement['code'])) {
$out .= ' <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n"; $out .= ' <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n";
$gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade']; $gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade'];
} }
$i++; $i++;

Loading…
Cancel
Save