ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 14 of file class.ilTestSkillLevelThresholdImporter.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillLevelThresholdImporter::__construct ( )

ilTestSkillLevelThresholdImporter constructor.

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

50  {
51  $this->failedThresholdImportSkillList = new ilAssQuestionAssignedSkillList();
52  }

Member Function Documentation

◆ getFailedThresholdImportSkillList()

ilTestSkillLevelThresholdImporter::getFailedThresholdImportSkillList ( )
Returns
ilAssQuestionAssignedSkillList

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

References $failedThresholdImportSkillList.

Referenced by import().

+ Here is the caller graph for this function:

◆ getImportedQuestionSkillAssignmentList()

ilTestSkillLevelThresholdImporter::getImportedQuestionSkillAssignmentList ( )
Returns
ilAssQuestionSkillAssignmentList

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

References $importedQuestionSkillAssignmentList.

Referenced by import().

+ Here is the caller graph for this function:

◆ getImportInstallationId()

ilTestSkillLevelThresholdImporter::getImportInstallationId ( )
Returns
int

Definition at line 73 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 89 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 121 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 230 of file class.ilTestSkillLevelThresholdImporter.php.

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

Referenced by import().

231  {
232  /*
233  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
234  $r = ilBasicSkill::getLevelIdForImportId($a_source_inst_id,
235  $a_level_import_id);
236 
237  $results[] = array("level_id" => $rec["id"], "creation_date" =>
238  $rec["creation_date"]);
239  */
240 
242  $mostNewLevelData = current($result);
243  return $mostNewLevelData['level_id'];
244  }
$result
static getLevelIdForImportId($a_source_inst_id, $a_level_import_id)
Get level ids for import IDs (newest first)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTargetTestId()

ilTestSkillLevelThresholdImporter::getTargetTestId ( )
Returns
int

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

References $targetTestId.

Referenced by import().

+ Here is the caller graph for this function:

◆ import()

ilTestSkillLevelThresholdImporter::import ( )

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

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

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

◆ setFailedThresholdImportSkillList()

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

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

References $failedThresholdImportSkillList.

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

◆ setImportedQuestionSkillAssignmentList()

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

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

References $importedQuestionSkillAssignmentList.

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

◆ setImportInstallationId()

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

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

References $importInstallationId.

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

◆ setImportMappingRegistry()

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

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

References $importMappingRegistry.

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

◆ setImportThresholdList()

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

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

References $importThresholdList.

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

◆ setTargetTestId()

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

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

Referenced by getTargetTestId(), and setTargetTestId().


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