private function transferAssignmentsFromOriginalToDuplicatedTaxonomy($originalTaxonomyId, $mappedTaxonomyId) { $originalTaxAssignment = new ilTaxNodeAssignment($this->getSourceObjType(), $this->getSourceObjId(), 'quest', $originalTaxonomyId); $duplicatedTaxAssignment = new ilTaxNodeAssignment($this->getTargetObjType(), $this->getTargetObjId(), 'quest', $mappedTaxonomyId); foreach ($this->getQuestionIdMapping() as $originalQuestionId => $duplicatedQuestionId) { $assignments = $originalTaxAssignment->getAssignmentsOfItem($originalQuestionId); foreach ($assignments as $assData) { $mappedNodeId = $this->duplicatedTaxonomiesKeysMap->getMappedTaxNodeId($assData['node_id']); $duplicatedTaxAssignment->addAssignment($mappedNodeId, $duplicatedQuestionId); } } }
/** * @param ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList * @param ilQuestionPoolDuplicatedTaxonomiesKeysMap $taxonomiesKeysMap * @param integer $sourcePoolId */ private function applyMappedTaxonomiesKeys(ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList, ilQuestionPoolDuplicatedTaxonomiesKeysMap $taxonomiesKeysMap, $sourcePoolId) { foreach ($sourcePoolDefinitionList as $definition) { /** @var ilTestRandomQuestionSetSourcePoolDefinition $definition */ if ($definition->getPoolId() == $sourcePoolId) { $definition->setMappedFilterTaxId($taxonomiesKeysMap->getMappedTaxonomyId($definition->getOriginalFilterTaxId())); $definition->setMappedFilterTaxNodeId($taxonomiesKeysMap->getMappedTaxNodeId($definition->getOriginalFilterTaxNodeId())); } } }