public static function buildGapMatchInteraction($identifier, array $gapTextList, array $gapImgList, array $gapList) { $gapChoiceCollection = new GapChoiceCollection(); foreach ($gapTextList as $identifier => $contentStr) { $gapText = new GapText($identifier, 1); $content = new TextOrVariableCollection(); $content->attach(new TextRun($contentStr)); $gapText->setContent($content); $gapChoiceCollection->attach($gapText); } foreach ($gapImgList as $identifier => $imagedURL) { $obj = new Object($imagedURL, 'image/png'); $gapImg = new GapImg($identifier, 1, $obj); $gapChoiceCollection->attach($gapImg); } $content = new BlockStaticCollection(); $p = new P(); $inlineCollection = new InlineCollection(); foreach ($gapList as $gapIdentifier) { $gap = new Gap($gapIdentifier); $inlineCollection->attach($gap); } $p->setContent($inlineCollection); $content->attach($p); return new GapMatchInteraction($identifier, $gapChoiceCollection, $content); }
public static function buildBlockStaticCollectionContent(QtiComponentCollection $content) { $collection = new BlockStaticCollection(); foreach ($content as $component) { $collection->attach($component); } return $collection; }
public static function buildSimple($identifier, $contentMap) { $interactionContent = new BlockStaticCollection(); $p = new P(); $pCollection = new InlineCollection(); foreach ($contentMap as $content) { if (is_array($content)) { $hottext = new Hottext(key($content)); $hottextContent = new InlineStaticCollection(); $hottextContent->attach(new TextRun($content[key($content)])); $hottext->setContent($hottextContent); $pCollection->attach($hottext); } else { if (is_string($content)) { $pCollection->attach(new TextRun($content)); } } } $p->setContent($pCollection); $interactionContent->attach($p); return new HottextInteraction($identifier, $interactionContent); }