diff --git a/main/exercise/export/qti2/qti2_classes.php b/main/exercise/export/qti2/qti2_classes.php index 9453f41654..991575024f 100755 --- a/main/exercise/export/qti2/qti2_classes.php +++ b/main/exercise/export/qti2/qti2_classes.php @@ -1,6 +1,28 @@ * @author Yannick Warnier - @@ -74,7 +96,7 @@ class Ims2Question extends Question * * @package chamilo.exercise */ -class ImsAnswerMultipleChoice extends Answer +class ImsAnswerMultipleChoice extends Answer implements ImsAnswerInterface { /** * Return the XML flow for the possible answers. @@ -105,7 +127,7 @@ class ImsAnswerMultipleChoice extends Answer /** * Return the XML flow of answer ResponsesDeclaration. */ - public function imsExportResponsesDeclaration($questionIdent) + public function imsExportResponsesDeclaration($questionIdent, Question $question = null) { $this->answerList = $this->getAnswersList(true); $type = $this->getQuestionType(); @@ -150,8 +172,11 @@ class ImsAnswerMultipleChoice extends Answer * * @package chamilo.exercise */ -class ImsAnswerFillInBlanks extends Answer +class ImsAnswerFillInBlanks extends Answer implements ImsAnswerInterface { + private $answerList = []; + private $gradeList = []; + /** * Export the text with missing words. */ @@ -171,7 +196,7 @@ class ImsAnswerFillInBlanks extends Answer return $text; } - public function imsExportResponsesDeclaration($questionIdent) + public function imsExportResponsesDeclaration($questionIdent, Question $question = null) { $this->answerList = $this->getAnswersList(true); $this->gradeList = $this->getGradesList(); @@ -203,10 +228,11 @@ class ImsAnswerFillInBlanks extends Answer * * @package chamilo.exercise */ -class ImsAnswerMatching extends Answer +class ImsAnswerMatching extends Answer implements ImsAnswerInterface { - public $leftList; - public $rightList; + public $leftList = []; + public $rightList = []; + private $answerList = []; /** * Export the question part as a matrix-choice, with only one possible answer per line. @@ -250,7 +276,7 @@ class ImsAnswerMatching extends Answer return $out; } - public function imsExportResponsesDeclaration($questionIdent) + public function imsExportResponsesDeclaration($questionIdent, Question $question = null) { $this->answerList = $this->getAnswersList(true); $out = ' '."\n"; @@ -290,8 +316,11 @@ class ImsAnswerMatching extends Answer * * @package chamilo.exercise */ -class ImsAnswerHotspot extends Answer +class ImsAnswerHotspot extends Answer implements ImsAnswerInterface { + private $answerList = []; + private $gradeList = []; + /** * TODO update this to match hot spots instead of copying matching * Export the question part as a matrix-choice, with only one possible answer per line. @@ -347,7 +376,7 @@ class ImsAnswerHotspot extends Answer return $text; } - public function imsExportResponsesDeclaration($questionIdent) + public function imsExportResponsesDeclaration($questionIdent, Question $question = null) { $this->answerList = $this->getAnswersList(true); $this->gradeList = $this->getGradesList(); @@ -372,7 +401,7 @@ class ImsAnswerHotspot extends Answer * * @package chamilo.exercise */ -class ImsAnswerFree extends Answer +class ImsAnswerFree extends Answer implements ImsAnswerInterface { /** * TODO implement @@ -393,7 +422,7 @@ class ImsAnswerFree extends Answer '; } - public function imsExportResponsesDeclaration($questionIdent, $question) + public function imsExportResponsesDeclaration($questionIdent, Question $question = null) { $out = ' '; $out .= ' diff --git a/main/exercise/export/qti2/qti2_export.php b/main/exercise/export/qti2/qti2_export.php index fc7d92a4b4..7fcdb25b49 100755 --- a/main/exercise/export/qti2/qti2_export.php +++ b/main/exercise/export/qti2/qti2_export.php @@ -22,8 +22,17 @@ require __DIR__.'/qti2_classes.php'; */ class ImsAssessmentItem { + /** + * @var Ims2Question + */ public $question; + /** + * @var string + */ public $questionIdent; + /** + * @var ImsAnswerInterface + */ public $answer; /**