ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilTestSkillLevelThresholdList Class Reference
+ Collaboration diagram for ilTestSkillLevelThresholdList:

Public Member Functions

 __construct (ilDBInterface $db)
 
 setTestId ($testId)
 
 getTestId ()
 
 resetThresholds ()
 
 loadFromDb ()
 
 saveToDb ()
 
 addThreshold ($threshold)
 
 getThreshold ( $skill_base_id, $skill_tref_id, $skill_level_id, $force_object=false)
 
 getThesholdsOfBaseAndTrefId (int $skill_base_id, int $skill_tref_id)
 
 cloneListForTest ($testId)
 

Private Member Functions

 buildSkillLevelThresholdByArray ($data)
 

Private Attributes

 $db
 
 $testId
 
 $thresholds = []
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillLevelThresholdList::__construct ( ilDBInterface  $db)

Definition at line 41 of file class.ilTestSkillLevelThresholdList.php.

References $db.

Member Function Documentation

◆ addThreshold()

ilTestSkillLevelThresholdList::addThreshold (   $threshold)
Parameters
ilTestSkillLevelThreshold$threshold

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

101 {
102 $skillKey = $threshold->getSkillBaseId() . ':' . $threshold->getSkillTrefId();
103 $this->thresholds[$skillKey][$threshold->getSkillLevelId()] = $threshold;
104 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ buildSkillLevelThresholdByArray()

ilTestSkillLevelThresholdList::buildSkillLevelThresholdByArray (   $data)
private
Parameters
array$data
Returns
ilTestSkillLevelThreshold

Definition at line 110 of file class.ilTestSkillLevelThresholdList.php.

111 {
112 $threshold = new ilTestSkillLevelThreshold($this->db);
113
114 $threshold->setTestId($data['test_fi']);
115 $threshold->setSkillBaseId($data['skill_base_fi']);
116 $threshold->setSkillTrefId($data['skill_tref_fi']);
117 $threshold->setSkillLevelId($data['skill_level_fi']);
118 $threshold->setThreshold($data['threshold']);
119
120 return $threshold;
121 }
$data
Definition: storeScorm.php:45

References $data.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ cloneListForTest()

ilTestSkillLevelThresholdList::cloneListForTest (   $testId)

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

157 {
158 foreach ($this->thresholds as $data) {
159 foreach ($data as $threshold) {
160 /* @var ilTestSkillLevelThreshold $threshold */
161
162 $threshold->setTestId($testId);
163 $threshold->saveToDb();
164
165 $threshold->setTestId($this->getTestId());
166 }
167 }
168 }

References $data.

◆ getTestId()

ilTestSkillLevelThresholdList::getTestId ( )
Returns
int

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

57 : int
58 {
59 return $this->testId;
60 }

References $testId.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ getThesholdsOfBaseAndTrefId()

ilTestSkillLevelThresholdList::getThesholdsOfBaseAndTrefId ( int  $skill_base_id,
int  $skill_tref_id 
)

Definition at line 149 of file class.ilTestSkillLevelThresholdList.php.

152 : array {
153 return $this->thresholds["{$skill_base_id}:{$skill_tref_id}"] ?? [];
154 }

◆ getThreshold()

ilTestSkillLevelThresholdList::getThreshold (   $skill_base_id,
  $skill_tref_id,
  $skill_level_id,
  $force_object = false 
)

Definition at line 123 of file class.ilTestSkillLevelThresholdList.php.

129 $skillKey = $skill_base_id . ':' . $skill_tref_id;
130
131 if (isset($this->thresholds[$skillKey]) && isset($this->thresholds[$skillKey][$skill_level_id])) {
132 return $this->thresholds[$skillKey][$skill_level_id];
133 }
134
135 if ($force_object) {
136 $threshold = new ilTestSkillLevelThreshold($this->db);
137
138 $threshold->setTestId($this->getTestId());
139 $threshold->setSkillBaseId($skill_base_id);
140 $threshold->setSkillTrefId($skill_tref_id);
141 $threshold->setSkillLevelId($skill_level_id);
142
143 return $threshold;
144 }
145
146 return null;
147 }

◆ loadFromDb()

ilTestSkillLevelThresholdList::loadFromDb ( )

Definition at line 67 of file class.ilTestSkillLevelThresholdList.php.

68 {
69 $this->resetThresholds();
70
71 $query = "
72 SELECT test_fi, skill_base_fi, skill_tref_fi, skill_level_fi, threshold
73 FROM tst_skl_thresholds
74 WHERE test_fi = %s
75 ";
76
77 $res = $this->db->queryF($query, ['integer'], [$this->getTestId()]);
78
79 while ($row = $this->db->fetchAssoc($res)) {
80 $threshold = $this->buildSkillLevelThresholdByArray($row);
81 $this->addThreshold($threshold);
82 }
83 }
foreach($_POST as $key=> $value) $res

References $res, addThreshold(), buildSkillLevelThresholdByArray(), getTestId(), and resetThresholds().

+ Here is the call graph for this function:

◆ resetThresholds()

ilTestSkillLevelThresholdList::resetThresholds ( )

Definition at line 62 of file class.ilTestSkillLevelThresholdList.php.

63 {
64 $this->thresholds = [];
65 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ saveToDb()

ilTestSkillLevelThresholdList::saveToDb ( )

Definition at line 87 of file class.ilTestSkillLevelThresholdList.php.

88 {
89 foreach ($this->thresholds as $skillKey => $skillLevels) {
90 foreach ($skillLevels as $levelThreshold) {
91 /* @var ilTestSkillLevelThreshold $levelThreshold */
92 $levelThreshold->saveToDb();
93 }
94 }
95 }

◆ setTestId()

ilTestSkillLevelThresholdList::setTestId (   $testId)
Parameters
int$testId

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

50 {
51 $this->testId = $testId;
52 }

References $testId.

Field Documentation

◆ $db

ilTestSkillLevelThresholdList::$db
private

Definition at line 29 of file class.ilTestSkillLevelThresholdList.php.

Referenced by __construct().

◆ $testId

ilTestSkillLevelThresholdList::$testId
private

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

Referenced by getTestId(), and setTestId().

◆ $thresholds

ilTestSkillLevelThresholdList::$thresholds = []
private

Definition at line 39 of file class.ilTestSkillLevelThresholdList.php.


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