ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ($poolTaxonomyIds)
 
 getDuplicatedTaxonomiesKeysMap ()
 
 getAllTaxonomiesForSourceObject ()
 

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

◆ __construct()

ilQuestionPoolTaxonomiesDuplicator::__construct ( )

Member Function Documentation

◆ duplicate()

ilQuestionPoolTaxonomiesDuplicator::duplicate (   $poolTaxonomyIds)

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

References duplicateTaxonomyFromPoolToTest(), and transferAssignmentsFromOriginalToDuplicatedTaxonomy().

91  {
92  foreach($poolTaxonomyIds as $poolTaxId)
93  {
94  $this->duplicateTaxonomyFromPoolToTest($poolTaxId);
95 
97  $poolTaxId, $this->duplicatedTaxonomiesKeysMap->getMappedTaxonomyId($poolTaxId)
98  );
99  }
100  }
transferAssignmentsFromOriginalToDuplicatedTaxonomy($originalTaxonomyId, $mappedTaxonomyId)
+ Here is the call graph for this function:

◆ duplicateTaxonomyFromPoolToTest()

ilQuestionPoolTaxonomiesDuplicator::duplicateTaxonomyFromPoolToTest (   $poolTaxonomyId)
private

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

References getTargetObjId(), and ilObjTaxonomy\saveUsage().

Referenced by duplicate().

103  {
104  $testTaxonomy = new ilObjTaxonomy();
105  $testTaxonomy->create();
106 
107  $poolTaxonomy = new ilObjTaxonomy($poolTaxonomyId);
108  $poolTaxonomy->doCloneObject($testTaxonomy, null, null);
109 
110  $poolTaxonomy->getTree()->readRootId();
111  $testTaxonomy->getTree()->readRootId();
112 
113  $testTaxonomy->update();
114 
115  ilObjTaxonomy::saveUsage( $testTaxonomy->getId(), $this->getTargetObjId() );
116 
117  $this->duplicatedTaxonomiesKeysMap->addDuplicatedTaxonomy($poolTaxonomy, $testTaxonomy);
118  }
static saveUsage($a_tax_id, $a_obj_id)
Save Usage.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllTaxonomiesForSourceObject()

ilQuestionPoolTaxonomiesDuplicator::getAllTaxonomiesForSourceObject ( )

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

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

148  {
150  }
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
+ Here is the call graph for this function:

◆ getDuplicatedTaxonomiesKeysMap()

ilQuestionPoolTaxonomiesDuplicator::getDuplicatedTaxonomiesKeysMap ( )

◆ getQuestionIdMapping()

ilQuestionPoolTaxonomiesDuplicator::getQuestionIdMapping ( )

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

References $questionIdMapping.

Referenced by transferAssignmentsFromOriginalToDuplicatedTaxonomy().

+ Here is the caller graph for this function:

◆ getSourceObjId()

ilQuestionPoolTaxonomiesDuplicator::getSourceObjId ( )

◆ getSourceObjType()

ilQuestionPoolTaxonomiesDuplicator::getSourceObjType ( )

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

References $sourceObjType.

Referenced by transferAssignmentsFromOriginalToDuplicatedTaxonomy().

+ Here is the caller graph for this function:

◆ getTargetObjId()

ilQuestionPoolTaxonomiesDuplicator::getTargetObjId ( )

◆ getTargetObjType()

ilQuestionPoolTaxonomiesDuplicator::getTargetObjType ( )

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

References $targetObjType.

Referenced by transferAssignmentsFromOriginalToDuplicatedTaxonomy().

+ Here is the caller graph for this function:

◆ setQuestionIdMapping()

ilQuestionPoolTaxonomiesDuplicator::setQuestionIdMapping (   $questionIdMapping)

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

References $questionIdMapping.

81  {
82  $this->questionIdMapping = $questionIdMapping;
83  }

◆ setSourceObjId()

ilQuestionPoolTaxonomiesDuplicator::setSourceObjId (   $sourceObjId)

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

References $sourceObjId.

◆ setSourceObjType()

ilQuestionPoolTaxonomiesDuplicator::setSourceObjType (   $sourceObjType)

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

References $sourceObjType.

◆ setTargetObjId()

ilQuestionPoolTaxonomiesDuplicator::setTargetObjId (   $targetObjId)

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

References $targetObjId.

◆ setTargetObjType()

ilQuestionPoolTaxonomiesDuplicator::setTargetObjType (   $targetObjType)

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

References $targetObjType.

◆ transferAssignmentsFromOriginalToDuplicatedTaxonomy()

ilQuestionPoolTaxonomiesDuplicator::transferAssignmentsFromOriginalToDuplicatedTaxonomy (   $originalTaxonomyId,
  $mappedTaxonomyId 
)
private

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

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

Referenced by duplicate().

121  {
122  $originalTaxAssignment = new ilTaxNodeAssignment($this->getSourceObjType(), $this->getSourceObjId(), 'quest', $originalTaxonomyId);
123 
124  $duplicatedTaxAssignment = new ilTaxNodeAssignment($this->getTargetObjType(), $this->getTargetObjId(), 'quest', $mappedTaxonomyId);
125 
126  foreach($this->getQuestionIdMapping() as $originalQuestionId => $duplicatedQuestionId)
127  {
128  $assignments = $originalTaxAssignment->getAssignmentsOfItem($originalQuestionId);
129 
130  foreach($assignments as $assData)
131  {
132  $mappedNodeId = $this->duplicatedTaxonomiesKeysMap->getMappedTaxNodeId($assData['node_id']);
133 
134  $duplicatedTaxAssignment->addAssignment($mappedNodeId, $duplicatedQuestionId);
135  }
136  }
137  }
Taxonomy node <-> item assignment.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $duplicatedTaxonomiesKeysMap

ilQuestionPoolTaxonomiesDuplicator::$duplicatedTaxonomiesKeysMap = null
private

◆ $questionIdMapping

ilQuestionPoolTaxonomiesDuplicator::$questionIdMapping = null
private

◆ $sourceObjId

ilQuestionPoolTaxonomiesDuplicator::$sourceObjId = null
private

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

Referenced by getSourceObjId(), and setSourceObjId().

◆ $sourceObjType

ilQuestionPoolTaxonomiesDuplicator::$sourceObjType = null
private

◆ $targetObjId

ilQuestionPoolTaxonomiesDuplicator::$targetObjId = null
private

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

Referenced by getTargetObjId(), and setTargetObjId().

◆ $targetObjType

ilQuestionPoolTaxonomiesDuplicator::$targetObjType = null
private

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