ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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

Deprecated:
12: Use ILIAS\Test\ExportImport\Import\SkillLevelThresholdImporter instead

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

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillLevelThresholdImporter::__construct ( private ilDBInterface  $db)

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

36 {
37 $this->failedThresholdImportSkillList = new ilAssQuestionAssignedSkillList();
38 }

Member Function Documentation

◆ getFailedThresholdImportSkillList()

ilTestSkillLevelThresholdImporter::getFailedThresholdImportSkillList ( )

Definition at line 90 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 50 of file class.ilTestSkillLevelThresholdImporter.php.

References $importInstallationId.

Referenced by getLevelIdMapping().

+ Here is the caller graph for this function:

◆ getImportMappingRegistry()

ilTestSkillLevelThresholdImporter::getImportMappingRegistry ( )

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

References $importMappingRegistry.

Referenced by import().

+ Here is the caller graph for this function:

◆ getImportThresholdList()

ilTestSkillLevelThresholdImporter::getImportThresholdList ( )

Definition at line 80 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 175 of file class.ilTestSkillLevelThresholdImporter.php.

175 : ?int
176 {
177 $result = ilBasicSkill::getLevelIdForImportId($this->getImportInstallationId(), $importLevelId);
178 $mostNewLevelData = current($result);
179 if (!is_array($mostNewLevelData)) {
180 return null;
181 }
182 return $mostNewLevelData['level_id'];
183 }
static getLevelIdForImportId(int $a_source_inst_id, int $a_level_import_id)

References 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 ( )

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

References $targetTestId.

Referenced by import().

+ Here is the caller graph for this function:

◆ import()

ilTestSkillLevelThresholdImporter::import ( )

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

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

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

+ Here is the call graph for this function:

◆ setFailedThresholdImportSkillList()

ilTestSkillLevelThresholdImporter::setFailedThresholdImportSkillList ( ilAssQuestionAssignedSkillList  $failedThresholdImportSkillList)

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

95 : void
96 {
97 $this->failedThresholdImportSkillList = $failedThresholdImportSkillList;
98 }

References $failedThresholdImportSkillList.

◆ setImportedQuestionSkillAssignmentList()

ilTestSkillLevelThresholdImporter::setImportedQuestionSkillAssignmentList ( ilAssQuestionSkillAssignmentList  $importedQuestionSkillAssignmentList)

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

75 : void
76 {
77 $this->importedQuestionSkillAssignmentList = $importedQuestionSkillAssignmentList;
78 }

References $importedQuestionSkillAssignmentList.

◆ setImportInstallationId()

ilTestSkillLevelThresholdImporter::setImportInstallationId ( int  $importInstallationId)

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

55 : void
56 {
57 $this->importInstallationId = $importInstallationId;
58 }

References $importInstallationId.

◆ setImportMappingRegistry()

ilTestSkillLevelThresholdImporter::setImportMappingRegistry ( ilImportMapping  $importMappingRegistry)

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

65 : void
66 {
67 $this->importMappingRegistry = $importMappingRegistry;
68 }

References $importMappingRegistry.

◆ setImportThresholdList()

ilTestSkillLevelThresholdImporter::setImportThresholdList ( ?ilTestSkillLevelThresholdImportList  $importThresholdList)

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

85 : void
86 {
87 $this->importThresholdList = $importThresholdList;
88 }

References $importThresholdList.

◆ setTargetTestId()

ilTestSkillLevelThresholdImporter::setTargetTestId ( int  $targetTestId)

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

45 : void
46 {
47 $this->targetTestId = $targetTestId;
48 }

References $targetTestId.

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 26 of file class.ilTestSkillLevelThresholdImporter.php.

Referenced by getTargetTestId(), and setTargetTestId().


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