public function addWordResponse(\UJM\ExoBundle\Entity\WordResponse $wordResponse) { $this->wordResponses[] = $wordResponse; $wordResponse->setHole($this); }
/** * Create wordResponseForList * * @access protected * * @param String $qtiId id of hole in the qti file * @param DOMNodelist::item $ib element itemBody * @param DOMNodelist::item $mapping element mapping * @param UJM\ExoBundle\Entity\Hole $hole * */ protected function wordResponseForList($qtiId, $ib, $mapping, $hole) { foreach ($ib->getElementsByTagName("inlineChoiceInteraction") as $ici) { if ($ici->getAttribute('responseIdentifier') == $qtiId) { foreach ($ici->getElementsByTagName('inlineChoice') as $ic) { $keyWord = new WordResponse(); $score = 0; $matchScore = false; $keyWord->setResponse($ic->nodeValue); foreach ($mapping->getElementsByTagName("mapEntry") as $mapEntry) { if ($mapEntry->getAttribute('mapKey') == $ic->getAttribute('identifier')) { $score = $mapEntry->getAttribute('mappedValue'); $matchScore = true; } if ($mapEntry->getAttribute('caseSensitive') == true) { $keyWord->setCaseSensitive(true); } else { $keyWord->setCaseSensitive(false); } } if ($matchScore === false) { foreach ($mapping->getElementsByTagName("mapEntry") as $mapEntry) { if ($mapEntry->getAttribute('mapKey') == $ic->nodeValue) { $score = $mapEntry->getAttribute('mappedValue'); } } } $keyWord->setScore($score); $keyWord->setHole($hole); $this->om->persist($keyWord); $this->tabWrOpt[] = $keyWord; } } } }