ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTestSkillLevelThresholdImporter Class Reference
+ Collaboration diagram for ilTestSkillLevelThresholdImporter:

Public Member Functions

 __construct ()
 ilTestSkillLevelThresholdImporter constructor. More...
 
 getTargetTestId ()
 
 setTargetTestId ($targetTestId)
 
 getImportInstallationId ()
 
 setImportInstallationId ($importInstallationId)
 
 getImportMappingRegistry ()
 
 setImportMappingRegistry ($importMappingRegistry)
 
 getImportedQuestionSkillAssignmentList ()
 
 setImportedQuestionSkillAssignmentList ($importedQuestionSkillAssignmentList)
 
 getImportThresholdList ()
 
 setImportThresholdList ($importThresholdList)
 
 getFailedThresholdImportSkillList ()
 
 setFailedThresholdImportSkillList ($failedThresholdImportSkillList)
 
 import ()
 

Protected Member Functions

 getLevelIdMapping ($importLevelId)
 

Protected Attributes

 $targetTestId = null
 
 $importInstallationId = null
 
 $importMappingRegistry = null
 
 $importedQuestionSkillAssignmentList = null
 
 $importThresholdList = null
 
 $failedThresholdImportSkillList = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillLevelThresholdImporter::__construct ( )

Member Function Documentation

◆ getFailedThresholdImportSkillList()

ilTestSkillLevelThresholdImporter::getFailedThresholdImportSkillList ( )
Returns
ilAssQuestionAssignedSkillList

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

References $failedThresholdImportSkillList.

Referenced by import().

+ Here is the caller graph for this function:

◆ getImportedQuestionSkillAssignmentList()

ilTestSkillLevelThresholdImporter::getImportedQuestionSkillAssignmentList ( )

◆ getImportInstallationId()

ilTestSkillLevelThresholdImporter::getImportInstallationId ( )
Returns
int

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

References $importInstallationId.

Referenced by getLevelIdMapping().

+ Here is the caller graph for this function:

◆ getImportMappingRegistry()

ilTestSkillLevelThresholdImporter::getImportMappingRegistry ( )
Returns
ilImportMapping

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

References $importMappingRegistry.

Referenced by import().

+ Here is the caller graph for this function:

◆ getImportThresholdList()

ilTestSkillLevelThresholdImporter::getImportThresholdList ( )
Returns
ilTestSkillLevelThresholdImportList

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

References $importThresholdList.

Referenced by import().

+ Here is the caller graph for this function:

◆ getLevelIdMapping()

ilTestSkillLevelThresholdImporter::getLevelIdMapping (   $importLevelId)
protected
Parameters
$importLevelId
Returns
integer

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

230 {
231 /*
232 $r = ilBasicSkill::getLevelIdForImportId($a_source_inst_id,
233 $a_level_import_id);
234
235 $results[] = array("level_id" => $rec["id"], "creation_date" =>
236 $rec["creation_date"]);
237 */
238
240 $mostNewLevelData = current($result);
241 return $mostNewLevelData['level_id'];
242 }
$result
static getLevelIdForImportId(int $a_source_inst_id, int $a_level_import_id)

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

Referenced by import().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTargetTestId()

ilTestSkillLevelThresholdImporter::getTargetTestId ( )
Returns
int

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

References $targetTestId.

Referenced by import().

+ Here is the caller graph for this function:

◆ import()

ilTestSkillLevelThresholdImporter::import ( )

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

152 {
153 global $DIC;
154 $ilDB = $DIC['ilDB'];
155
156 $importedLevelThresholdList = new ilTestSkillLevelThresholdList($ilDB);
157
158 foreach ($this->getImportedQuestionSkillAssignmentList()->getUniqueAssignedSkills() as $skillData) {
159 /* @var ilBasicSkill $skill */
160 $skill = $skillData['skill'];
161
162 $importSkillBaseId = $this->getImportMappingRegistry()->getMapping(
163 'Modules/Test',
164 'skl_base_id_reverse',
165 $skillData['skill_base_id']
166 );
167
168 $importSkillTrefId = $this->getImportMappingRegistry()->getMapping(
169 'Modules/Test',
170 'skl_tref_id_reverse',
171 $skillData['skill_tref_id']
172 );
173
174 $levelThresholds = $this->getImportThresholdList()->getThresholdsByImportSkill(
175 $importSkillBaseId,
176 $importSkillTrefId
177 );
178
179 $existingLevels = $skill->getLevelData();
180
181 if (count($levelThresholds) != count($existingLevels)) {
182 $this->getFailedThresholdImportSkillList()->addSkill(
183 $skillData['skill_base_id'],
184 $skillData['skill_tref_id']
185 );
186
187 continue;
188 }
189
190 for ($i = 0, $max = count($existingLevels); $i < $max; $i++) {
191 $existingLevelData = $existingLevels[$i];
192
193 /* @var ilTestSkillLevelThresholdImport $importLevelThreshold */
194 $importLevelThreshold = $levelThresholds[$i];
195
196 if ($importLevelThreshold->getOrderIndex() != $existingLevelData['nr']) {
197 $this->getFailedThresholdImportSkillList()->addSkill(
198 $skillData['skill_base_id'],
199 $skillData['skill_tref_id']
200 );
201
202 continue(2);
203 }
204
205 if (!is_numeric($importLevelThreshold->getThreshold())) {
206 continue(2);
207 }
208
209 $mappedLevelId = $this->getLevelIdMapping($importLevelThreshold->getImportLevelId());
210
211 $threshold = new ilTestSkillLevelThreshold($ilDB);
212 $threshold->setTestId($this->getTargetTestId());
213 $threshold->setSkillBaseId($skillData['skill_base_id']);
214 $threshold->setSkillTrefId($skillData['skill_tref_id']);
215 $threshold->setSkillLevelId($mappedLevelId);
216 $threshold->setThreshold($importLevelThreshold->getThreshold());
217
218 $importedLevelThresholdList->addThreshold($threshold);
219 }
220 }
221
222 $importedLevelThresholdList->saveToDb();
223 }
global $DIC
Definition: goto.php:24
$i
Definition: metadata.php:24
global $ilDB

References $DIC, $i, $ilDB, getFailedThresholdImportSkillList(), getImportedQuestionSkillAssignmentList(), getImportMappingRegistry(), getImportThresholdList(), getLevelIdMapping(), and getTargetTestId().

+ Here is the call graph for this function:

◆ setFailedThresholdImportSkillList()

ilTestSkillLevelThresholdImporter::setFailedThresholdImportSkillList (   $failedThresholdImportSkillList)
Parameters
ilAssQuestionAssignedSkillList$failedThresholdImportSkillList

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

145 {
146 $this->failedThresholdImportSkillList = $failedThresholdImportSkillList;
147 }

References $failedThresholdImportSkillList.

◆ setImportedQuestionSkillAssignmentList()

ilTestSkillLevelThresholdImporter::setImportedQuestionSkillAssignmentList (   $importedQuestionSkillAssignmentList)
Parameters
ilAssQuestionSkillAssignmentList$importedQuestionSkillAssignmentList

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

113 {
114 $this->importedQuestionSkillAssignmentList = $importedQuestionSkillAssignmentList;
115 }

References $importedQuestionSkillAssignmentList.

◆ setImportInstallationId()

ilTestSkillLevelThresholdImporter::setImportInstallationId (   $importInstallationId)
Parameters
int$importInstallationId

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

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

References $importInstallationId.

◆ setImportMappingRegistry()

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

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

97 {
98 $this->importMappingRegistry = $importMappingRegistry;
99 }

References $importMappingRegistry.

◆ setImportThresholdList()

ilTestSkillLevelThresholdImporter::setImportThresholdList (   $importThresholdList)
Parameters
ilTestSkillLevelThresholdImportList$importThresholdList

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

129 {
130 $this->importThresholdList = $importThresholdList;
131 }

References $importThresholdList.

◆ setTargetTestId()

ilTestSkillLevelThresholdImporter::setTargetTestId (   $targetTestId)
Parameters
int$targetTestId

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

65 {
66 $this->targetTestId = $targetTestId;
67 }

References $targetTestId.

Field Documentation

◆ $failedThresholdImportSkillList

ilTestSkillLevelThresholdImporter::$failedThresholdImportSkillList = null
protected

◆ $importedQuestionSkillAssignmentList

ilTestSkillLevelThresholdImporter::$importedQuestionSkillAssignmentList = null
protected

◆ $importInstallationId

ilTestSkillLevelThresholdImporter::$importInstallationId = null
protected

◆ $importMappingRegistry

ilTestSkillLevelThresholdImporter::$importMappingRegistry = null
protected

◆ $importThresholdList

ilTestSkillLevelThresholdImporter::$importThresholdList = null
protected

◆ $targetTestId

ilTestSkillLevelThresholdImporter::$targetTestId = null
protected

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

Referenced by getTargetTestId(), and setTargetTestId().


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