ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator Class Reference
+ Collaboration diagram for ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator:

Public Member Functions

 __construct (ilObjTest $testOBJ, $sourcePoolId, $questionIdMapping)
 setSourcePoolId ($sourcePoolId)
 getSourcePoolId ()
 setQuestionIdMapping ($questionIdMapping)
 getQuestionIdMapping ()
 duplicate ()
 getDuplicatedTaxonomiesKeysMap ()

Data Fields

 $testOBJ = null

Private Member Functions

 duplicateTaxonomyFromPoolToTest ($poolTaxonomyId)
 transferAssignmentsFromOriginalToDuplicatedTaxonomy ($originalTaxonomyId, $mappedTaxonomyId)

Private Attributes

 $sourcePoolId = null
 $questionIdMapping = null
 $duplicatedTaxonomiesKeysMap = null

Detailed Description

Constructor & Destructor Documentation

ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::__construct ( ilObjTest  $testOBJ,
  $sourcePoolId,
  $questionIdMapping 
)

Definition at line 33 of file class.ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator.php.

References $questionIdMapping, $sourcePoolId, and $testOBJ.

{
$this->testOBJ = $testOBJ;
$this->sourcePoolId = $sourcePoolId;
$this->questionIdMapping = $questionIdMapping;
$this->duplicatedTaxonomiesKeysMap = new ilTestRandomQuestionSetDuplicatedTaxonomiesKeysMap();
}

Member Function Documentation

ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::duplicate ( )

Definition at line 62 of file class.ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator.php.

References duplicateTaxonomyFromPoolToTest(), getSourcePoolId(), ilObjTaxonomy\getUsageOfObject(), and transferAssignmentsFromOriginalToDuplicatedTaxonomy().

{
$poolTaxonomyIds = ilObjTaxonomy::getUsageOfObject($this->getSourcePoolId());
foreach($poolTaxonomyIds as $poolTaxId)
{
$this->duplicateTaxonomyFromPoolToTest($poolTaxId);
$poolTaxId, $this->duplicatedTaxonomiesKeysMap->getMappedTaxonomyId($poolTaxId)
);
}
}

+ Here is the call graph for this function:

ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::duplicateTaxonomyFromPoolToTest (   $poolTaxonomyId)
private

Definition at line 76 of file class.ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator.php.

References ilObjTaxonomy\saveUsage().

Referenced by duplicate().

{
$testTaxonomy = new ilObjTaxonomy();
$testTaxonomy->create();
$poolTaxonomy = new ilObjTaxonomy($poolTaxonomyId);
$poolTaxonomy->doCloneObject($testTaxonomy, null, null);
$poolTaxonomy->getTree()->readRootId();
$testTaxonomy->getTree()->readRootId();
$testTaxonomy->update();
ilObjTaxonomy::saveUsage( $testTaxonomy->getId(), $this->testOBJ->getId() );
$this->duplicatedTaxonomiesKeysMap->addDuplicatedTaxonomy($poolTaxonomy, $testTaxonomy);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::getDuplicatedTaxonomiesKeysMap ( )
ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::getQuestionIdMapping ( )

Definition at line 57 of file class.ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator.php.

References $questionIdMapping.

Referenced by transferAssignmentsFromOriginalToDuplicatedTaxonomy().

+ Here is the caller graph for this function:

ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::getSourcePoolId ( )

Definition at line 47 of file class.ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator.php.

References $sourcePoolId.

Referenced by duplicate(), and transferAssignmentsFromOriginalToDuplicatedTaxonomy().

{
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::setQuestionIdMapping (   $questionIdMapping)

Definition at line 52 of file class.ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator.php.

References $questionIdMapping.

{
$this->questionIdMapping = $questionIdMapping;
}
ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::setSourcePoolId (   $sourcePoolId)

Definition at line 42 of file class.ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator.php.

References $sourcePoolId.

{
$this->sourcePoolId = $sourcePoolId;
}
ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::transferAssignmentsFromOriginalToDuplicatedTaxonomy (   $originalTaxonomyId,
  $mappedTaxonomyId 
)
private

Definition at line 94 of file class.ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator.php.

References ilTaxNodeAssignment\getAssignmentsOfItem(), getQuestionIdMapping(), and getSourcePoolId().

Referenced by duplicate().

{
$originalTaxAssignment = new ilTaxNodeAssignment('qpl', $this->getSourcePoolId(), 'quest', $originalTaxonomyId);
$duplicatedTaxAssignment = new ilTaxNodeAssignment('tst', $this->testOBJ->getId(), '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);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::$duplicatedTaxonomiesKeysMap = null
private
ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::$questionIdMapping = null
private
ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::$sourcePoolId = null
private
ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator::$testOBJ = null

The documentation for this class was generated from the following file: