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

Public Member Functions

 __construct ()
 setSourceObjId ($sourceObjId)
 getSourceObjId ()
 getSourceObjType ()
 setSourceObjType ($sourceObjType)
 getTargetObjId ()
 setTargetObjId ($targetObjId)
 getTargetObjType ()
 setTargetObjType ($targetObjType)
 setQuestionIdMapping ($questionIdMapping)
 getQuestionIdMapping ()
 duplicate ()
 getDuplicatedTaxonomiesKeysMap ()

Private Member Functions

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

Private Attributes

 $sourceObjId = null
 $sourceObjType = null
 $targetObjId = null
 $targetObjType = null
 $questionIdMapping = null
 $duplicatedTaxonomiesKeysMap = null

Detailed Description

Definition at line 15 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

Constructor & Destructor Documentation

ilQuestionPoolTaxonomiesDuplicator::__construct ( )

Definition at line 35 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

{
$this->duplicatedTaxonomiesKeysMap = new ilQuestionPoolDuplicatedTaxonomiesKeysMap();
}

Member Function Documentation

ilQuestionPoolTaxonomiesDuplicator::duplicate ( )

Definition at line 90 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

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

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

+ Here is the call graph for this function:

ilQuestionPoolTaxonomiesDuplicator::duplicateTaxonomyFromPoolToTest (   $poolTaxonomyId)
private

Definition at line 104 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References getTargetObjId(), and 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->getTargetObjId() );
$this->duplicatedTaxonomiesKeysMap->addDuplicatedTaxonomy($poolTaxonomy, $testTaxonomy);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilQuestionPoolTaxonomiesDuplicator::getDuplicatedTaxonomiesKeysMap ( )
ilQuestionPoolTaxonomiesDuplicator::getQuestionIdMapping ( )

Definition at line 85 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References $questionIdMapping.

Referenced by transferAssignmentsFromOriginalToDuplicatedTaxonomy().

+ Here is the caller graph for this function:

ilQuestionPoolTaxonomiesDuplicator::getSourceObjId ( )

Definition at line 45 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References $sourceObjId.

Referenced by duplicate(), and transferAssignmentsFromOriginalToDuplicatedTaxonomy().

{
}

+ Here is the caller graph for this function:

ilQuestionPoolTaxonomiesDuplicator::getSourceObjType ( )

Definition at line 50 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References $sourceObjType.

Referenced by transferAssignmentsFromOriginalToDuplicatedTaxonomy().

{
}

+ Here is the caller graph for this function:

ilQuestionPoolTaxonomiesDuplicator::getTargetObjId ( )

Definition at line 60 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References $targetObjId.

Referenced by duplicateTaxonomyFromPoolToTest(), and transferAssignmentsFromOriginalToDuplicatedTaxonomy().

{
}

+ Here is the caller graph for this function:

ilQuestionPoolTaxonomiesDuplicator::getTargetObjType ( )

Definition at line 70 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References $targetObjType.

Referenced by transferAssignmentsFromOriginalToDuplicatedTaxonomy().

{
}

+ Here is the caller graph for this function:

ilQuestionPoolTaxonomiesDuplicator::setQuestionIdMapping (   $questionIdMapping)

Definition at line 80 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References $questionIdMapping.

{
$this->questionIdMapping = $questionIdMapping;
}
ilQuestionPoolTaxonomiesDuplicator::setSourceObjId (   $sourceObjId)

Definition at line 40 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References $sourceObjId.

{
$this->sourceObjId = $sourceObjId;
}
ilQuestionPoolTaxonomiesDuplicator::setSourceObjType (   $sourceObjType)

Definition at line 55 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References $sourceObjType.

{
$this->sourceObjType = $sourceObjType;
}
ilQuestionPoolTaxonomiesDuplicator::setTargetObjId (   $targetObjId)

Definition at line 65 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References $targetObjId.

{
$this->targetObjId = $targetObjId;
}
ilQuestionPoolTaxonomiesDuplicator::setTargetObjType (   $targetObjType)

Definition at line 75 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References $targetObjType.

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

Definition at line 122 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

References getQuestionIdMapping(), getSourceObjId(), getSourceObjType(), getTargetObjId(), and getTargetObjType().

Referenced by duplicate().

{
$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);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilQuestionPoolTaxonomiesDuplicator::$duplicatedTaxonomiesKeysMap = null
private
ilQuestionPoolTaxonomiesDuplicator::$questionIdMapping = null
private
ilQuestionPoolTaxonomiesDuplicator::$sourceObjId = null
private

Definition at line 17 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

Referenced by getSourceObjId(), and setSourceObjId().

ilQuestionPoolTaxonomiesDuplicator::$sourceObjType = null
private
ilQuestionPoolTaxonomiesDuplicator::$targetObjId = null
private

Definition at line 21 of file class.ilQuestionPoolTaxonomiesDuplicator.php.

Referenced by getTargetObjId(), and setTargetObjId().

ilQuestionPoolTaxonomiesDuplicator::$targetObjType = null
private

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