ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAssQuestionSkillAssignmentImporter Class Reference
+ Collaboration diagram for ilAssQuestionSkillAssignmentImporter:

Public Member Functions

 __construct ()
 ilAssQuestionSkillAssignmentImporter constructor. More...
 
 setTargetParentObjId ($targetParentObjId)
 
 getTargetParentObjId ()
 
 getImportInstallationId ()
 
 setImportInstallationId ($importInstallationId)
 
 getImportMappingRegistry ()
 
 setImportMappingRegistry ($importMappingRegistry)
 
 getImportMappingComponent ()
 
 setImportMappingComponent ($importMappingComponent)
 
 getImportAssignmentList ()
 
 setImportAssignmentList ($importAssignmentList)
 
 getFailedImportAssignmentList ()
 
 getSuccessImportAssignmentList ()
 
 setSuccessImportAssignmentList ($successImportAssignmentList)
 
 import ()
 

Protected Member Functions

 buildImportableAssignment (ilAssQuestionSkillAssignmentImport $assignment, $foundSkillId)
 
 buildImportableSolutionComparisonExpression (ilAssQuestionSolutionComparisonExpressionImport $solCompExp)
 
 isValidSkill ($foundSkillData)
 
 getSkillIdMapping ($importSkillBaseId, $importSkillTrefId)
 
 getLocalInstallationId ()
 

Protected Attributes

 $db
 
 $importInstallationId
 
 $importMappingRegistry
 
 $importMappingComponent
 
 $importAssignmentList
 
 $failedImportAssignmentList
 
 $successImportAssignmentList
 

Private Attributes

 $targetParentObjId
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignmentImporter::__construct ( )

ilAssQuestionSkillAssignmentImporter constructor.

Definition at line 54 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $ilDB.

55  {
56  global $ilDB;
57  $this->db = $ilDB;
58 
59  $this->targetParentObjId = null;
60  $this->importInstallationId = null;
61  $this->importMappingRegistry = null;
62  $this->importAssignmentList = null;
63  $this->failedImportAssignmentList = new ilAssQuestionSkillAssignmentImportList();
64  $this->successImportAssignmentList = new ilAssQuestionSkillAssignmentList($this->db);
65  }
global $ilDB

Member Function Documentation

◆ buildImportableAssignment()

ilAssQuestionSkillAssignmentImporter::buildImportableAssignment ( ilAssQuestionSkillAssignmentImport  $assignment,
  $foundSkillId 
)
protected

Definition at line 219 of file class.ilAssQuestionSkillAssignmentImporter.php.

References ilAssQuestionSkillAssignmentImport\getEvalMode(), getImportMappingComponent(), getImportMappingRegistry(), ilAssQuestionSkillAssignmentImport\getImportQuestionId(), ilAssQuestionSkillAssignmentImport\getSkillPoints(), and getTargetParentObjId().

Referenced by import().

220  {
221  $importableAssignment = new ilAssQuestionSkillAssignment($this->db);
222 
223  $importableAssignment->setEvalMode($assignment->getEvalMode());
224  $importableAssignment->setSkillPoints($assignment->getSkillPoints());
225 
226  $importableAssignment->setSkillBaseId($foundSkillId['skill_id']);
227  $importableAssignment->setSkillTrefId($foundSkillId['tref_id']);
228 
229  $importableAssignment->setParentObjId($this->getTargetParentObjId());
230 
231  $importableAssignment->setQuestionId($this->getImportMappingRegistry()->getMapping(
232  $this->getImportMappingComponent(), 'quest', $assignment->getImportQuestionId()
233  ));
234 
235  $importableAssignment->initSolutionComparisonExpressionList();
236 
237  return $importableAssignment;
238  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildImportableSolutionComparisonExpression()

ilAssQuestionSkillAssignmentImporter::buildImportableSolutionComparisonExpression ( ilAssQuestionSolutionComparisonExpressionImport  $solCompExp)
protected

Definition at line 240 of file class.ilAssQuestionSkillAssignmentImporter.php.

References ilAssQuestionSolutionComparisonExpressionImport\getExpression(), ilAssQuestionSolutionComparisonExpressionImport\getOrderIndex(), and ilAssQuestionSolutionComparisonExpressionImport\getPoints().

Referenced by import().

241  {
242  $importableSolCompExp = new ilAssQuestionSolutionComparisonExpression($this->db);
243 
244  $importableSolCompExp->setOrderIndex($solCompExp->getOrderIndex());
245  $importableSolCompExp->setExpression($solCompExp->getExpression());
246  $importableSolCompExp->setPoints($solCompExp->getPoints());
247 
248  return $importableSolCompExp;
249  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFailedImportAssignmentList()

ilAssQuestionSkillAssignmentImporter::getFailedImportAssignmentList ( )
Returns
ilAssQuestionSkillAssignmentImportList

Definition at line 150 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $failedImportAssignmentList.

Referenced by import().

+ Here is the caller graph for this function:

◆ getImportAssignmentList()

ilAssQuestionSkillAssignmentImporter::getImportAssignmentList ( )
Returns
ilAssQuestionSkillAssignmentImportList

Definition at line 134 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $importAssignmentList.

Referenced by import().

+ Here is the caller graph for this function:

◆ getImportInstallationId()

ilAssQuestionSkillAssignmentImporter::getImportInstallationId ( )
Returns
int

Definition at line 86 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $importInstallationId.

Referenced by getSkillIdMapping().

+ Here is the caller graph for this function:

◆ getImportMappingComponent()

ilAssQuestionSkillAssignmentImporter::getImportMappingComponent ( )
Returns
string

Definition at line 118 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $importMappingComponent.

Referenced by buildImportableAssignment().

+ Here is the caller graph for this function:

◆ getImportMappingRegistry()

ilAssQuestionSkillAssignmentImporter::getImportMappingRegistry ( )
Returns
ilImportMapping

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

References $importMappingRegistry.

Referenced by buildImportableAssignment(), and import().

+ Here is the caller graph for this function:

◆ getLocalInstallationId()

ilAssQuestionSkillAssignmentImporter::getLocalInstallationId ( )
protected

Definition at line 275 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $DIC.

Referenced by getSkillIdMapping().

276  {
277  global $DIC; /* @var ILIAS\DI\Container $DIC */
278 
279  return $DIC->settings()->get('inst_id', 0);
280  }
global $DIC
+ Here is the caller graph for this function:

◆ getSkillIdMapping()

ilAssQuestionSkillAssignmentImporter::getSkillIdMapping (   $importSkillBaseId,
  $importSkillTrefId 
)
protected

Definition at line 261 of file class.ilAssQuestionSkillAssignmentImporter.php.

References array, ilBasicSkill\getCommonSkillIdForImportId(), getImportInstallationId(), and getLocalInstallationId().

Referenced by import().

262  {
263  if( $this->getImportInstallationId() == $this->getLocalInstallationId() )
264  {
265  return array( 'skill_id' => $importSkillBaseId, 'tref_id' => $importSkillTrefId );
266  }
267 
269  $this->getImportInstallationId(), $importSkillBaseId, $importSkillTrefId
270  );
271 
272  return current($foundSkillData);
273  }
Create styles array
The data for the language used.
static getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id=0)
Get common skill ids for import IDs (newest first)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuccessImportAssignmentList()

ilAssQuestionSkillAssignmentImporter::getSuccessImportAssignmentList ( )
Returns
ilAssQuestionSkillAssignmentList

Definition at line 158 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $successImportAssignmentList.

Referenced by import().

+ Here is the caller graph for this function:

◆ getTargetParentObjId()

ilAssQuestionSkillAssignmentImporter::getTargetParentObjId ( )
Returns
int

Definition at line 78 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $targetParentObjId.

Referenced by buildImportableAssignment().

+ Here is the caller graph for this function:

◆ import()

ilAssQuestionSkillAssignmentImporter::import ( )
Returns
bool

Definition at line 182 of file class.ilAssQuestionSkillAssignmentImporter.php.

References buildImportableAssignment(), buildImportableSolutionComparisonExpression(), getFailedImportAssignmentList(), getImportAssignmentList(), getImportMappingRegistry(), getSkillIdMapping(), getSuccessImportAssignmentList(), and isValidSkill().

183  {
184  foreach($this->getImportAssignmentList() as $assignment)
185  {
186  $foundSkillId = $this->getSkillIdMapping(
187  $assignment->getImportSkillBaseId(), $assignment->getImportSkillTrefId()
188  );
189 
190  if( !$this->isValidSkill($foundSkillId) )
191  {
192  $this->getFailedImportAssignmentList()->addAssignment($assignment);
193  continue;
194  }
195 
196  $this->getImportMappingRegistry()->addMapping(
197  'Modules/Test', 'skl_base_id_reverse', $foundSkillId['skill_id'], $assignment->getImportSkillBaseId()
198  );
199 
200  $this->getImportMappingRegistry()->addMapping(
201  'Modules/Test', 'skl_tref_id_reverse', $foundSkillId['tref_id'], $assignment->getImportSkillTrefId()
202  );
203 
204  $importableAssignment = $this->buildImportableAssignment($assignment, $foundSkillId);
205 
206  foreach($assignment->getImportSolutionComparisonExpressionList() as $solCompExp)
207  {
208  $importableSolCompExp = $this->buildImportableSolutionComparisonExpression($solCompExp);
209  $importableAssignment->getSolutionComparisonExpressionList()->add($importableSolCompExp);
210  }
211 
212  $importableAssignment->saveToDb();
213  $importableAssignment->saveComparisonExpressions();
214 
215  $this->getSuccessImportAssignmentList()->addAssignment($importableAssignment);
216  }
217  }
buildImportableAssignment(ilAssQuestionSkillAssignmentImport $assignment, $foundSkillId)
buildImportableSolutionComparisonExpression(ilAssQuestionSolutionComparisonExpressionImport $solCompExp)
+ Here is the call graph for this function:

◆ isValidSkill()

ilAssQuestionSkillAssignmentImporter::isValidSkill (   $foundSkillData)
protected

Definition at line 251 of file class.ilAssQuestionSkillAssignmentImporter.php.

Referenced by import().

252  {
253  if( !is_array($foundSkillData) || !isset($foundSkillData['skill_id']) || !$foundSkillData['skill_id'] )
254  {
255  return false;
256  }
257 
258  return true;
259  }
+ Here is the caller graph for this function:

◆ setImportAssignmentList()

ilAssQuestionSkillAssignmentImporter::setImportAssignmentList (   $importAssignmentList)
Parameters
ilAssQuestionSkillAssignmentImportList$importAssignmentList

Definition at line 142 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $importAssignmentList.

143  {
144  $this->importAssignmentList = $importAssignmentList;
145  }

◆ setImportInstallationId()

ilAssQuestionSkillAssignmentImporter::setImportInstallationId (   $importInstallationId)
Parameters
int$installationId

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

References $importInstallationId.

◆ setImportMappingComponent()

ilAssQuestionSkillAssignmentImporter::setImportMappingComponent (   $importMappingComponent)
Parameters
string$importMappingComponent

Definition at line 126 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $importMappingComponent.

127  {
128  $this->importMappingComponent = $importMappingComponent;
129  }

◆ setImportMappingRegistry()

ilAssQuestionSkillAssignmentImporter::setImportMappingRegistry (   $importMappingRegistry)
Parameters
ilImportMapping$importMappingRegistry

Definition at line 110 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $importMappingRegistry.

111  {
112  $this->importMappingRegistry = $importMappingRegistry;
113  }

◆ setSuccessImportAssignmentList()

ilAssQuestionSkillAssignmentImporter::setSuccessImportAssignmentList (   $successImportAssignmentList)
Parameters
ilAssQuestionSkillAssignmentList$successImportAssignmentList

Definition at line 166 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $successImportAssignmentList.

167  {
168  $this->successImportAssignmentList = $successImportAssignmentList;
169  }

◆ setTargetParentObjId()

ilAssQuestionSkillAssignmentImporter::setTargetParentObjId (   $targetParentObjId)
Parameters
int$targetParentObjId

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

References $targetParentObjId.

Field Documentation

◆ $db

ilAssQuestionSkillAssignmentImporter::$db
protected

◆ $failedImportAssignmentList

ilAssQuestionSkillAssignmentImporter::$failedImportAssignmentList
protected

◆ $importAssignmentList

ilAssQuestionSkillAssignmentImporter::$importAssignmentList
protected

◆ $importInstallationId

ilAssQuestionSkillAssignmentImporter::$importInstallationId
protected

◆ $importMappingComponent

ilAssQuestionSkillAssignmentImporter::$importMappingComponent
protected

◆ $importMappingRegistry

ilAssQuestionSkillAssignmentImporter::$importMappingRegistry
protected

◆ $successImportAssignmentList

ilAssQuestionSkillAssignmentImporter::$successImportAssignmentList
protected

◆ $targetParentObjId

ilAssQuestionSkillAssignmentImporter::$targetParentObjId
private

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