ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 25 of file class.ilTestSkillLevelThresholdImporter.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillLevelThresholdImporter::__construct ( )

ilTestSkillLevelThresholdImporter constructor.

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

61  {
62  $this->failedThresholdImportSkillList = new ilAssQuestionAssignedSkillList();
63  }

Member Function Documentation

◆ getFailedThresholdImportSkillList()

ilTestSkillLevelThresholdImporter::getFailedThresholdImportSkillList ( )

◆ getImportedQuestionSkillAssignmentList()

ilTestSkillLevelThresholdImporter::getImportedQuestionSkillAssignmentList ( )

◆ getImportInstallationId()

ilTestSkillLevelThresholdImporter::getImportInstallationId ( )
Returns
int

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

References $importMappingRegistry.

Referenced by import().

100  : ?ilImportMapping
101  {
103  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getImportThresholdList()

ilTestSkillLevelThresholdImporter::getImportThresholdList ( )

◆ getLevelIdMapping()

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

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

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

Referenced by import().

241  : int
242  {
243  /*
244  $r = ilBasicSkill::getLevelIdForImportId($a_source_inst_id,
245  $a_level_import_id);
246 
247  $results[] = array("level_id" => $rec["id"], "creation_date" =>
248  $rec["creation_date"]);
249  */
250 
251  $result = ilBasicSkill::getLevelIdForImportId($this->getImportInstallationId(), $importLevelId);
252  $mostNewLevelData = current($result);
253  return $mostNewLevelData['level_id'];
254  }
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 ( )
Returns
int

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

References $targetTestId.

Referenced by import().

+ Here is the caller graph for this function:

◆ import()

ilTestSkillLevelThresholdImporter::import ( )

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

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

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

◆ setFailedThresholdImportSkillList()

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

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

References $failedThresholdImportSkillList.

157  {
158  $this->failedThresholdImportSkillList = $failedThresholdImportSkillList;
159  }

◆ setImportedQuestionSkillAssignmentList()

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

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

References $importedQuestionSkillAssignmentList.

125  {
126  $this->importedQuestionSkillAssignmentList = $importedQuestionSkillAssignmentList;
127  }

◆ setImportInstallationId()

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

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

References $importInstallationId.

93  {
94  $this->importInstallationId = $importInstallationId;
95  }

◆ setImportMappingRegistry()

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

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

References $importMappingRegistry.

109  {
110  $this->importMappingRegistry = $importMappingRegistry;
111  }

◆ setImportThresholdList()

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

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

References $importThresholdList.

141  {
142  $this->importThresholdList = $importThresholdList;
143  }

◆ setTargetTestId()

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

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

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

Referenced by getTargetTestId(), and setTargetTestId().


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