ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 178 of file class.ilTestSkillLevelThresholdImporter.php.

178 : ?int
179 {
180 $result = ilBasicSkill::getLevelIdForImportId($this->getImportInstallationId(), $importLevelId);
181 $mostNewLevelData = current($result);
182 if (!is_array($mostNewLevelData)) {
183 return null;
184 }
185 return $mostNewLevelData['level_id'];
186 }
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 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.

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 if ($mappedLevelId === null) {
161 continue(2);
162 }
163
164 $threshold = new ilTestSkillLevelThreshold($this->db);
165 $threshold->setTestId($this->getTargetTestId());
166 $threshold->setSkillBaseId($skillData['skill_base_id']);
167 $threshold->setSkillTrefId($skillData['skill_tref_id']);
168 $threshold->setSkillLevelId($mappedLevelId);
169 $threshold->setThreshold($importLevelThreshold->getThreshold());
170
171 $importedLevelThresholdList->addThreshold($threshold);
172 }
173 }
174
175 $importedLevelThresholdList->saveToDb();
176 }

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

+ Here is the call graph for this function:

◆ setFailedThresholdImportSkillList()

ilTestSkillLevelThresholdImporter::setFailedThresholdImportSkillList ( ilAssQuestionAssignedSkillList  $failedThresholdImportSkillList)

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

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

References $failedThresholdImportSkillList.

◆ setImportedQuestionSkillAssignmentList()

ilTestSkillLevelThresholdImporter::setImportedQuestionSkillAssignmentList ( ilAssQuestionSkillAssignmentList  $importedQuestionSkillAssignmentList)

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

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

References $importedQuestionSkillAssignmentList.

◆ setImportInstallationId()

ilTestSkillLevelThresholdImporter::setImportInstallationId ( int  $importInstallationId)

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

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

References $importInstallationId.

◆ setImportMappingRegistry()

ilTestSkillLevelThresholdImporter::setImportMappingRegistry ( ilImportMapping  $importMappingRegistry)

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

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

References $importMappingRegistry.

◆ setImportThresholdList()

ilTestSkillLevelThresholdImporter::setImportThresholdList ( ?ilTestSkillLevelThresholdImportList  $importThresholdList)

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

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

References $importThresholdList.

◆ setTargetTestId()

ilTestSkillLevelThresholdImporter::setTargetTestId ( int  $targetTestId)

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

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

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

Referenced by getTargetTestId(), and setTargetTestId().


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