ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTestSkillLevelThresholdImportList.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27class ilTestSkillLevelThresholdImportList implements Iterator
28{
29 protected $originalSkillTitles = [];
30 protected $originalSkillPaths = [];
32
33 public function addOriginalSkillTitle($skillBaseId, $skillTrefId, $originalSkillTitle)
34 {
35 $this->originalSkillTitles["{$skillBaseId}:{$skillTrefId}"] = $originalSkillTitle;
36 }
37
38 public function addOriginalSkillPath($skillBaseId, $skillTrefId, $originalSkillPath)
39 {
40 $this->originalSkillPaths["{$skillBaseId}:{$skillTrefId}"] = $originalSkillPath;
41 }
42
43 public function addSkillLevelThreshold(ilTestSkillLevelThresholdImport $importedSkillLevelThreshold)
44 {
45 $this->importedSkillLevelThresholds[] = $importedSkillLevelThreshold;
46 }
47
48 public function getThresholdsByImportSkill($importSkillBaseId, $importSkillTrefId): array
49 {
50 $thresholds = [];
51
52 foreach ($this as $skillLevelThreshold) {
53 if ($skillLevelThreshold->getImportSkillBaseId() != $importSkillBaseId) {
54 continue;
55 }
56
57 if ($skillLevelThreshold->getImportSkillTrefId() != $importSkillTrefId) {
58 continue;
59 }
60
61 $thresholds[] = $skillLevelThreshold;
62 }
63
64 return $thresholds;
65 }
66
68 {
69 $current = current($this->importedSkillLevelThresholds);
70 return $current !== false ? $current : null;
71 }
72
73 public function next(): void
74 {
75 next($this->importedSkillLevelThresholds);
76 }
77
78 public function key(): ?int
79 {
80 return key($this->importedSkillLevelThresholds);
81 }
82
83 public function valid(): bool
84 {
85 return key($this->importedSkillLevelThresholds) !== null;
86 }
87
88 public function rewind(): void
89 {
90 reset($this->importedSkillLevelThresholds);
91 }
92}
addOriginalSkillPath($skillBaseId, $skillTrefId, $originalSkillPath)
addSkillLevelThreshold(ilTestSkillLevelThresholdImport $importedSkillLevelThreshold)
addOriginalSkillTitle($skillBaseId, $skillTrefId, $originalSkillTitle)
getThresholdsByImportSkill($importSkillBaseId, $importSkillTrefId)