4 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
5 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionAssignedSkillList.php';
151 public function import()
154 $ilDB = $DIC[
'ilDB'];
160 $skill = $skillData[
'skill'];
164 'skl_base_id_reverse',
165 $skillData[
'skill_base_id']
170 'skl_tref_id_reverse',
171 $skillData[
'skill_tref_id']
179 $existingLevels = $skill->getLevelData();
181 if (count($levelThresholds) != count($existingLevels)) {
183 $skillData[
'skill_base_id'],
184 $skillData[
'skill_tref_id']
190 for (
$i = 0, $max = count($existingLevels);
$i < $max;
$i++) {
191 $existingLevelData = $existingLevels[
$i];
194 $importLevelThreshold = $levelThresholds[
$i];
196 if ($importLevelThreshold->getOrderIndex() != $existingLevelData[
'nr']) {
198 $skillData[
'skill_base_id'],
199 $skillData[
'skill_tref_id']
205 if (!is_numeric($importLevelThreshold->getThreshold())) {
209 $mappedLevelId = $this->
getLevelIdMapping($importLevelThreshold->getImportLevelId());
213 $threshold->setSkillBaseId($skillData[
'skill_base_id']);
214 $threshold->setSkillTrefId($skillData[
'skill_tref_id']);
215 $threshold->setSkillLevelId($mappedLevelId);
216 $threshold->setThreshold($importLevelThreshold->getThreshold());
218 $importedLevelThresholdList->addThreshold($threshold);
222 $importedLevelThresholdList->saveToDb();
240 $mostNewLevelData = current(
$result);
241 return $mostNewLevelData[
'level_id'];
$failedThresholdImportSkillList
setImportInstallationId($importInstallationId)
$importedQuestionSkillAssignmentList
getImportedQuestionSkillAssignmentList()
__construct()
ilTestSkillLevelThresholdImporter constructor.
getLevelIdMapping($importLevelId)
setFailedThresholdImportSkillList($failedThresholdImportSkillList)
setImportThresholdList($importThresholdList)
getFailedThresholdImportSkillList()
setImportedQuestionSkillAssignmentList($importedQuestionSkillAssignmentList)
setTargetTestId($targetTestId)
getImportMappingRegistry()
setImportMappingRegistry($importMappingRegistry)
static getLevelIdForImportId(int $a_source_inst_id, int $a_level_import_id)
getImportInstallationId()