ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilTestSkillLevelThresholdImporter Class Reference
+ Collaboration diagram for ilTestSkillLevelThresholdImporter:

Public Member Functions

 __construct (private ilDBInterface $db)
 
 getTargetTestId ()
 
 setTargetTestId (int $targetTestId)
 
 getImportInstallationId ()
 
 setImportInstallationId (int $importInstallationId)
 
 getImportMappingRegistry ()
 
 setImportMappingRegistry (ilImportMapping $importMappingRegistry)
 
 getImportedQuestionSkillAssignmentList ()
 
 setImportedQuestionSkillAssignmentList (ilAssQuestionSkillAssignmentList $importedQuestionSkillAssignmentList)
 
 getImportThresholdList ()
 
 setImportThresholdList (?ilTestSkillLevelThresholdImportList $importThresholdList)
 
 getFailedThresholdImportSkillList ()
 
 setFailedThresholdImportSkillList (ilAssQuestionAssignedSkillList $failedThresholdImportSkillList)
 
 import ()
 

Protected Member Functions

 getLevelIdMapping (int $importLevelId)
 

Private Attributes

int $targetTestId = null
 
int $importInstallationId = null
 
ilImportMapping $importMappingRegistry = null
 
ilAssQuestionSkillAssignmentList $importedQuestionSkillAssignmentList = null
 
ilTestSkillLevelThresholdImportList $importThresholdList = null
 
ilAssQuestionAssignedSkillList $failedThresholdImportSkillList
 

Detailed Description

Definition at line 27 of file class.ilTestSkillLevelThresholdImporter.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillLevelThresholdImporter::__construct ( private ilDBInterface  $db)

Definition at line 37 of file class.ilTestSkillLevelThresholdImporter.php.

39  {
40  $this->failedThresholdImportSkillList = new ilAssQuestionAssignedSkillList();
41  }

Member Function Documentation

◆ getFailedThresholdImportSkillList()

ilTestSkillLevelThresholdImporter::getFailedThresholdImportSkillList ( )

Definition at line 93 of file class.ilTestSkillLevelThresholdImporter.php.

References $failedThresholdImportSkillList.

Referenced by import().

+ Here is the caller graph for this function:

◆ getImportedQuestionSkillAssignmentList()

ilTestSkillLevelThresholdImporter::getImportedQuestionSkillAssignmentList ( )

◆ getImportInstallationId()

ilTestSkillLevelThresholdImporter::getImportInstallationId ( )

Definition at line 53 of file class.ilTestSkillLevelThresholdImporter.php.

References $importInstallationId.

Referenced by getLevelIdMapping().

+ Here is the caller graph for this function:

◆ getImportMappingRegistry()

ilTestSkillLevelThresholdImporter::getImportMappingRegistry ( )

Definition at line 63 of file class.ilTestSkillLevelThresholdImporter.php.

References $importMappingRegistry.

Referenced by import().

+ Here is the caller graph for this function:

◆ getImportThresholdList()

ilTestSkillLevelThresholdImporter::getImportThresholdList ( )

Definition at line 83 of file class.ilTestSkillLevelThresholdImporter.php.

References $importThresholdList.

Referenced by import().

+ Here is the caller graph for this function:

◆ getLevelIdMapping()

ilTestSkillLevelThresholdImporter::getLevelIdMapping ( int  $importLevelId)
protected

Definition at line 174 of file class.ilTestSkillLevelThresholdImporter.php.

References getImportInstallationId(), and ilBasicSkill\getLevelIdForImportId().

Referenced by import().

174  : int
175  {
176  $result = ilBasicSkill::getLevelIdForImportId($this->getImportInstallationId(), $importLevelId);
177  $mostNewLevelData = current($result);
178  return $mostNewLevelData['level_id'];
179  }
static getLevelIdForImportId(int $a_source_inst_id, int $a_level_import_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTargetTestId()

ilTestSkillLevelThresholdImporter::getTargetTestId ( )

Definition at line 43 of file class.ilTestSkillLevelThresholdImporter.php.

References $targetTestId.

Referenced by import().

+ Here is the caller graph for this function:

◆ import()

ilTestSkillLevelThresholdImporter::import ( )

Definition at line 103 of file class.ilTestSkillLevelThresholdImporter.php.

References getFailedThresholdImportSkillList(), getImportedQuestionSkillAssignmentList(), getImportMappingRegistry(), getImportThresholdList(), getLevelIdMapping(), and getTargetTestId().

103  : void
104  {
105  $importedLevelThresholdList = new ilTestSkillLevelThresholdList($this->db);
106 
107  foreach ($this->getImportedQuestionSkillAssignmentList()->getUniqueAssignedSkills() as $skillData) {
108  /* @var ilBasicSkill $skill */
109  $skill = $skillData['skill'];
110 
111  $importSkillBaseId = $this->getImportMappingRegistry()->getMapping(
112  'components/ILIAS/Test',
113  'skl_base_id_reverse',
114  (string) $skillData['skill_base_id']
115  );
116 
117  $importSkillTrefId = $this->getImportMappingRegistry()->getMapping(
118  'components/ILIAS/Test',
119  'skl_tref_id_reverse',
120  (string) $skillData['skill_tref_id']
121  );
122 
123  $levelThresholds = $this->getImportThresholdList()->getThresholdsByImportSkill(
124  $importSkillBaseId,
125  $importSkillTrefId
126  );
127 
128  $existingLevels = $skill->getLevelData();
129 
130  if (count($levelThresholds) != count($existingLevels)) {
131  $this->getFailedThresholdImportSkillList()->addSkill(
132  (int) $skillData['skill_base_id'],
133  (int) $skillData['skill_tref_id']
134  );
135 
136  continue;
137  }
138 
139  for ($i = 0, $max = count($existingLevels); $i < $max; $i++) {
140  $existingLevelData = $existingLevels[$i];
141 
142  /* @var ilTestSkillLevelThresholdImport $importLevelThreshold */
143  $importLevelThreshold = $levelThresholds[$i];
144 
145  if ($importLevelThreshold->getOrderIndex() != $existingLevelData['nr']) {
146  $this->getFailedThresholdImportSkillList()->addSkill(
147  (int) $skillData['skill_base_id'],
148  (int) $skillData['skill_tref_id']
149  );
150 
151  continue(2);
152  }
153 
154  if (!is_numeric($importLevelThreshold->getThreshold())) {
155  continue(2);
156  }
157 
158  $mappedLevelId = $this->getLevelIdMapping($importLevelThreshold->getImportLevelId());
159 
160  $threshold = new ilTestSkillLevelThreshold($this->db);
161  $threshold->setTestId($this->getTargetTestId());
162  $threshold->setSkillBaseId($skillData['skill_base_id']);
163  $threshold->setSkillTrefId($skillData['skill_tref_id']);
164  $threshold->setSkillLevelId($mappedLevelId);
165  $threshold->setThreshold($importLevelThreshold->getThreshold());
166 
167  $importedLevelThresholdList->addThreshold($threshold);
168  }
169  }
170 
171  $importedLevelThresholdList->saveToDb();
172  }
+ Here is the call graph for this function:

◆ setFailedThresholdImportSkillList()

ilTestSkillLevelThresholdImporter::setFailedThresholdImportSkillList ( ilAssQuestionAssignedSkillList  $failedThresholdImportSkillList)

Definition at line 98 of file class.ilTestSkillLevelThresholdImporter.php.

References $failedThresholdImportSkillList.

98  : void
99  {
100  $this->failedThresholdImportSkillList = $failedThresholdImportSkillList;
101  }
ilAssQuestionAssignedSkillList $failedThresholdImportSkillList

◆ setImportedQuestionSkillAssignmentList()

ilTestSkillLevelThresholdImporter::setImportedQuestionSkillAssignmentList ( ilAssQuestionSkillAssignmentList  $importedQuestionSkillAssignmentList)

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

References $importedQuestionSkillAssignmentList.

78  : void
79  {
80  $this->importedQuestionSkillAssignmentList = $importedQuestionSkillAssignmentList;
81  }
ilAssQuestionSkillAssignmentList $importedQuestionSkillAssignmentList

◆ setImportInstallationId()

ilTestSkillLevelThresholdImporter::setImportInstallationId ( int  $importInstallationId)

Definition at line 58 of file class.ilTestSkillLevelThresholdImporter.php.

References $importInstallationId.

58  : void
59  {
60  $this->importInstallationId = $importInstallationId;
61  }

◆ setImportMappingRegistry()

ilTestSkillLevelThresholdImporter::setImportMappingRegistry ( ilImportMapping  $importMappingRegistry)

Definition at line 68 of file class.ilTestSkillLevelThresholdImporter.php.

References $importMappingRegistry.

68  : void
69  {
70  $this->importMappingRegistry = $importMappingRegistry;
71  }

◆ setImportThresholdList()

ilTestSkillLevelThresholdImporter::setImportThresholdList ( ?ilTestSkillLevelThresholdImportList  $importThresholdList)

Definition at line 88 of file class.ilTestSkillLevelThresholdImporter.php.

References $importThresholdList.

88  : void
89  {
90  $this->importThresholdList = $importThresholdList;
91  }
ilTestSkillLevelThresholdImportList $importThresholdList

◆ setTargetTestId()

ilTestSkillLevelThresholdImporter::setTargetTestId ( int  $targetTestId)

Definition at line 48 of file class.ilTestSkillLevelThresholdImporter.php.

References $targetTestId.

48  : void
49  {
50  $this->targetTestId = $targetTestId;
51  }

Field Documentation

◆ $failedThresholdImportSkillList

ilAssQuestionAssignedSkillList ilTestSkillLevelThresholdImporter::$failedThresholdImportSkillList
private

◆ $importedQuestionSkillAssignmentList

ilAssQuestionSkillAssignmentList ilTestSkillLevelThresholdImporter::$importedQuestionSkillAssignmentList = null
private

◆ $importInstallationId

int ilTestSkillLevelThresholdImporter::$importInstallationId = null
private

◆ $importMappingRegistry

ilImportMapping ilTestSkillLevelThresholdImporter::$importMappingRegistry = null
private

◆ $importThresholdList

ilTestSkillLevelThresholdImportList ilTestSkillLevelThresholdImporter::$importThresholdList = null
private

◆ $targetTestId

int ilTestSkillLevelThresholdImporter::$targetTestId = null
private

Definition at line 29 of file class.ilTestSkillLevelThresholdImporter.php.

Referenced by getTargetTestId(), and setTargetTestId().


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