4 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestionList.php';
5 require_once
'Modules/TestQuestionPool/classes/class.ilQuestionPoolFactory.php';
6 require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php';
114 $questionList->setTestObjId($this->testOBJ->getId());
115 $questionList->setTestId($this->testOBJ->getTestId());
116 $questionList->setPoolId($nonAvailablePool->
getId());
118 $questionList->loadQuestions();
120 $questions =
array();
122 foreach ($questionList as $questionId) {
133 if (strlen($nonAvailablePool->
getTitle())) {
134 $pool->setTitle($nonAvailablePool->
getTitle());
143 $poolQidByTestQidMap =
array();
145 foreach ($questions as $questionOBJ) {
148 $testQuestionId = $questionOBJ->getId();
149 $poolQuestionId = $questionOBJ->duplicate(
false,
'',
'', $this->
getOwnerId(), $pool->
getId());
151 $poolQidByTestQidMap[$testQuestionId] = $poolQuestionId;
154 return $poolQidByTestQidMap;
159 foreach ($poolQidByTestQidMap as $testQid => $poolQid) {
167 require_once
'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
169 $filteredTaxIds =
array();
171 foreach ($taxonomyIds as $taxonomyId) {
173 $this->testOBJ->getType(),
174 $this->testOBJ->getId(),
179 foreach ($relatedQuestionIds as $questionId) {
182 if (count($assignedTaxNodes)) {
183 $filteredTaxIds[] = $taxonomyId;
189 return $filteredTaxIds;
194 require_once
'Modules/TestQuestionPool/classes/class.ilQuestionPoolTaxonomiesDuplicator.php';
196 $taxDuplicator->setSourceObjId($this->testOBJ->getId());
197 $taxDuplicator->setSourceObjType($this->testOBJ->getType());
198 $taxDuplicator->setTargetObjId($pool->
getId());
199 $taxDuplicator->setTargetObjType($pool->
getType());
200 $taxDuplicator->setQuestionIdMapping($poolQidByTestQidMap);
203 $taxDuplicator->getAllTaxonomiesForSourceObject(),
204 array_keys($poolQidByTestQidMap)
207 return $taxDuplicator->getDuplicatedTaxonomiesKeysMap();
212 $originalTaxonomyFilter =
array();
214 foreach ($mappedTaxonomyFilter as $testTaxonomyId => $testTaxNodes) {
216 $originalTaxonomyFilter[$poolTaxonomyId] =
array();
218 foreach ($testTaxNodes as $testTaxNode) {
220 $originalTaxonomyFilter[$poolTaxonomyId][] = $poolTaxNode;
224 return $originalTaxonomyFilter;
230 if ($definition->getPoolId() != $nonAvailablePoolId) {
234 $definition->setPoolId($derivedPoolId);
238 $definition->getMappedTaxonomyFilter()
241 $definition->saveToDb();
static resetOriginalId($questionId)
updateTestQuestionStage($poolQidByTestQidMap)
getAssignmentsOfItem($a_item_id)
Get assignments for item.
Taxonomy node <-> item assignment.
copyQuestionsToPool(ilObjQuestionPool $pool, $questions)
getSourcePoolDefinitionList()
getMappedTaxonomyId($originalTaxonomyId)
derive(ilTestRandomQuestionSetNonAvailablePool $nonAvailablePool)
Administration class for plugins.
getId()
get object id public
$sourcePoolDefinitionList
duplicateTaxonomies($poolQidByTestQidMap, ilObjQuestionPool $pool)
setTargetContainerRef($targetContainerRef)
__construct(ilDBInterface $ilDB, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ)
getMappedTaxNodeId($originalTaxNodeId)
getQuestionsForPool(ilTestRandomQuestionSetNonAvailablePool $nonAvailablePool)
static saveOriginalId($questionId, $originalId)
getType()
get object type public
Create styles array
The data for the language used.
static _instantiateQuestion($question_id)
updateRelatedSourcePoolDefinitions(ilQuestionPoolDuplicatedTaxonomiesKeysMap $taxKeysMap, $derivedPoolId, $nonAvailablePoolId)
buildOriginalTaxonomyFilterForDerivedPool(ilQuestionPoolDuplicatedTaxonomiesKeysMap $taxKeysMap, $mappedTaxonomyFilter)
createNewPool(ilTestRandomQuestionSetNonAvailablePool $nonAvailablePool)
setSourcePoolDefinitionList($sourcePoolDefinitionList)
filterForQuestionRelatedTaxonomies($taxonomyIds, $relatedQuestionIds)