public function getQuestionType() { /* @var QtiMatchInteraction $interaction */ $interaction = $this->interaction; if ($interaction->mustShuffle()) { LogService::log('Shuffle attribute is not supported'); } $simpleMatchSetCollection = $interaction->getSimpleMatchSets(); $stems = $this->buildOptions($simpleMatchSetCollection[0], $this->stemMapping); $options = $this->buildOptions($simpleMatchSetCollection[1], $this->optionsMapping); // Build validation $validationBuilder = new MatchInteractionValidationBuilder($this->stemMapping, $this->optionsMapping, $this->responseDeclaration); $validation = $validationBuilder->buildValidation($this->responseProcessingTemplate); if ($interaction->getMaxAssociations() !== count($stems)) { LogService::log('Max Association number not equals to number of stems is not supported'); } $uiStyle = new choicematrix_ui_style(); $uiStyle->set_type('table'); $isMultipleResponse = $this->isMultipleResponse($interaction); $question = new choicematrix('choicematrix', $options, $stems); $question->set_multiple_responses($isMultipleResponse); $question->set_stimulus($this->getPrompt()); $question->set_ui_style($uiStyle); if ($validation) { $question->set_validation($validation); } return $question; }
private function buildSimpleChoiceMatrixQuestion() { $question = new choicematrix('choicematrix', ["Option 1", "Option 2", "Option 3"], ["Stem 1", "Stem 2"]); $question->set_multiple_responses(false); $question->set_stimulus('My stimulus string'); return $question; }