ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 $DIC, and $ilDB.

55  {
56  global $DIC;
57  $ilDB = $DIC['ilDB'];
58  $this->db = $ilDB;
59 
60  $this->targetParentObjId = null;
61  $this->importInstallationId = null;
62  $this->importMappingRegistry = null;
63  $this->importAssignmentList = null;
64  $this->failedImportAssignmentList = new ilAssQuestionSkillAssignmentImportList();
65  $this->successImportAssignmentList = new ilAssQuestionSkillAssignmentList($this->db);
66  }
global $DIC
Definition: saml.php:7
global $ilDB

Member Function Documentation

◆ buildImportableAssignment()

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

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

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

Referenced by import().

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

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

Referenced by import().

248  {
249  $importableSolCompExp = new ilAssQuestionSolutionComparisonExpression($this->db);
250 
251  $importableSolCompExp->setOrderIndex($solCompExp->getOrderIndex());
252  $importableSolCompExp->setExpression($solCompExp->getExpression());
253  $importableSolCompExp->setPoints($solCompExp->getPoints());
254 
255  return $importableSolCompExp;
256  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFailedImportAssignmentList()

ilAssQuestionSkillAssignmentImporter::getFailedImportAssignmentList ( )
Returns
ilAssQuestionSkillAssignmentImportList

Definition at line 151 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 135 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 87 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 119 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 103 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 282 of file class.ilAssQuestionSkillAssignmentImporter.php.

References $DIC.

Referenced by getSkillIdMapping().

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

◆ getSkillIdMapping()

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

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

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

Referenced by import().

268  {
269  if ($this->getImportInstallationId() == $this->getLocalInstallationId()) {
270  return array( 'skill_id' => $importSkillBaseId, 'tref_id' => $importSkillTrefId );
271  }
272 
274  $this->getImportInstallationId(),
275  $importSkillBaseId,
276  $importSkillTrefId
277  );
278 
279  return current($foundSkillData);
280  }
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 159 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 79 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 183 of file class.ilAssQuestionSkillAssignmentImporter.php.

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

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

◆ isValidSkill()

ilAssQuestionSkillAssignmentImporter::isValidSkill (   $foundSkillData)
protected

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

Referenced by import().

259  {
260  if (!is_array($foundSkillData) || !isset($foundSkillData['skill_id']) || !$foundSkillData['skill_id']) {
261  return false;
262  }
263 
264  return true;
265  }
+ Here is the caller graph for this function:

◆ setImportAssignmentList()

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

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

References $importAssignmentList.

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

◆ setImportInstallationId()

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

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

References $importInstallationId.

◆ setImportMappingComponent()

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

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

References $importMappingComponent.

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

◆ setImportMappingRegistry()

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

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

References $importMappingRegistry.

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

◆ setSuccessImportAssignmentList()

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

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

References $successImportAssignmentList.

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

◆ setTargetParentObjId()

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

Definition at line 71 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: