ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 223 of file class.ilAssQuestionSkillAssignmentImporter.php.

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

Referenced by import().

224  {
225  $importableAssignment = new ilAssQuestionSkillAssignment($this->db);
226 
227  $importableAssignment->setEvalMode($assignment->getEvalMode());
228  $importableAssignment->setSkillPoints($assignment->getSkillPoints());
229 
230  $importableAssignment->setSkillBaseId($foundSkillId['skill_id']);
231  $importableAssignment->setSkillTrefId($foundSkillId['tref_id']);
232 
233  $importableAssignment->setParentObjId($this->getTargetParentObjId());
234 
235  $importableAssignment->setQuestionId($this->getImportMappingRegistry()->getMapping(
236  $this->getImportMappingComponent(),
237  'quest',
238  $assignment->getImportQuestionId()
239  ));
240 
241  $importableAssignment->initSolutionComparisonExpressionList();
242 
243  return $importableAssignment;
244  }
+ 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 246 of file class.ilAssQuestionSkillAssignmentImporter.php.

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

Referenced by import().

247  {
248  $importableSolCompExp = new ilAssQuestionSolutionComparisonExpression($this->db);
249 
250  $importableSolCompExp->setOrderIndex($solCompExp->getOrderIndex());
251  $importableSolCompExp->setExpression($solCompExp->getExpression());
252  $importableSolCompExp->setPoints($solCompExp->getPoints());
253 
254  return $importableSolCompExp;
255  }
+ 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 281 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $DIC.

Referenced by getSkillIdMapping().

282  {
283  global $DIC; /* @var ILIAS\DI\Container $DIC */
284 
285  return $DIC->settings()->get('inst_id', 0);
286  }
global $DIC
Definition: saml.php:7
+ Here is the caller graph for this function:

◆ getSkillIdMapping()

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

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

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

Referenced by import().

267  {
268  if ($this->getImportInstallationId() == $this->getLocalInstallationId()) {
269  return array( 'skill_id' => $importSkillBaseId, 'tref_id' => $importSkillTrefId );
270  }
271 
273  $this->getImportInstallationId(),
274  $importSkillBaseId,
275  $importSkillTrefId
276  );
277 
278  return current($foundSkillData);
279  }
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  $foundSkillId = $this->getSkillIdMapping(
186  $assignment->getImportSkillBaseId(),
187  $assignment->getImportSkillTrefId()
188  );
189 
190  if (!$this->isValidSkill($foundSkillId)) {
191  $this->getFailedImportAssignmentList()->addAssignment($assignment);
192  continue;
193  }
194 
195  $this->getImportMappingRegistry()->addMapping(
196  'Modules/Test',
197  'skl_base_id_reverse',
198  $foundSkillId['skill_id'],
199  $assignment->getImportSkillBaseId()
200  );
201 
202  $this->getImportMappingRegistry()->addMapping(
203  'Modules/Test',
204  'skl_tref_id_reverse',
205  $foundSkillId['tref_id'],
206  $assignment->getImportSkillTrefId()
207  );
208 
209  $importableAssignment = $this->buildImportableAssignment($assignment, $foundSkillId);
210 
211  foreach ($assignment->getImportSolutionComparisonExpressionList() as $solCompExp) {
212  $importableSolCompExp = $this->buildImportableSolutionComparisonExpression($solCompExp);
213  $importableAssignment->getSolutionComparisonExpressionList()->add($importableSolCompExp);
214  }
215 
216  $importableAssignment->saveToDb();
217  $importableAssignment->saveComparisonExpressions();
218 
219  $this->getSuccessImportAssignmentList()->addAssignment($importableAssignment);
220  }
221  }
buildImportableAssignment(ilAssQuestionSkillAssignmentImport $assignment, $foundSkillId)
buildImportableSolutionComparisonExpression(ilAssQuestionSolutionComparisonExpressionImport $solCompExp)
+ Here is the call graph for this function:

◆ isValidSkill()

ilAssQuestionSkillAssignmentImporter::isValidSkill (   $foundSkillData)
protected

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

Referenced by import().

258  {
259  if (!is_array($foundSkillData) || !isset($foundSkillData['skill_id']) || !$foundSkillData['skill_id']) {
260  return false;
261  }
262 
263  return true;
264  }
+ 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: