ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTestSkillLevelThresholdList Class Reference
+ Collaboration diagram for ilTestSkillLevelThresholdList:

Public Member Functions

 __construct (ilDBInterface $db)
 
 setTestId ($testId)
 
 getTestId ()
 
 resetThresholds ()
 
 loadFromDb ()
 
 saveToDb ()
 
 addThreshold ($threshold)
 
 getThreshold ($skillBaseId, $skillTrefId, $skillLevelId, $forceObject=false)
 
 cloneListForTest ($testId)
 

Private Member Functions

 buildSkillLevelThresholdByArray ($data)
 

Private Attributes

 $db
 
 $testId
 
 $thresholds = array()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillLevelThresholdList::__construct ( ilDBInterface  $db)

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

References $db.

Member Function Documentation

◆ addThreshold()

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

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

89 {
90 $skillKey = $threshold->getSkillBaseId() . ':' . $threshold->getSkillTrefId();
91 $this->thresholds[$skillKey][$threshold->getSkillLevelId()] = $threshold;
92 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ buildSkillLevelThresholdByArray()

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

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

99 {
100 $threshold = new ilTestSkillLevelThreshold($this->db);
101
102 $threshold->setTestId($data['test_fi']);
103 $threshold->setSkillBaseId($data['skill_base_fi']);
104 $threshold->setSkillTrefId($data['skill_tref_fi']);
105 $threshold->setSkillLevelId($data['skill_level_fi']);
106 $threshold->setThreshold($data['threshold']);
107
108 return $threshold;
109 }

References $data.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ cloneListForTest()

ilTestSkillLevelThresholdList::cloneListForTest (   $testId)

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

140 {
141 foreach ($this->thresholds as $skillKey => $data) {
142 foreach ($data as $levelId => $threshold) {
143 /* @var ilTestSkillLevelThreshold $threshold */
144
145 $threshold->setTestId($testId);
146 $threshold->saveToDb();
147
148 $threshold->setTestId($this->getTestId());
149 }
150 }
151 }

References $data, $testId, and getTestId().

+ Here is the call graph for this function:

◆ getTestId()

ilTestSkillLevelThresholdList::getTestId ( )
Returns
int

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

46 {
47 return $this->testId;
48 }

References $testId.

Referenced by cloneListForTest(), getThreshold(), and loadFromDb().

+ Here is the caller graph for this function:

◆ getThreshold()

ilTestSkillLevelThresholdList::getThreshold (   $skillBaseId,
  $skillTrefId,
  $skillLevelId,
  $forceObject = false 
)
Parameters
$skillBaseId
$skillTrefId
$skillLevelId
Returns
ilTestSkillLevelThreshold

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

118 {
119 $skillKey = $skillBaseId . ':' . $skillTrefId;
120
121 if (isset($this->thresholds[$skillKey]) && isset($this->thresholds[$skillKey][$skillLevelId])) {
122 return $this->thresholds[$skillKey][$skillLevelId];
123 }
124
125 if ($forceObject) {
126 $threshold = new ilTestSkillLevelThreshold($this->db);
127
128 $threshold->setTestId($this->getTestId());
129 $threshold->setSkillBaseId($skillBaseId);
130 $threshold->setSkillTrefId($skillTrefId);
131 $threshold->setSkillLevelId($skillLevelId);
132
133 return $threshold;
134 }
135
136 return null;
137 }

References getTestId().

+ Here is the call graph for this function:

◆ loadFromDb()

ilTestSkillLevelThresholdList::loadFromDb ( )

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

56 {
57 $this->resetThresholds();
58
59 $query = "
60 SELECT test_fi, skill_base_fi, skill_tref_fi, skill_level_fi, threshold
61 FROM tst_skl_thresholds
62 WHERE test_fi = %s
63 ";
64
65 $res = $this->db->queryF($query, array('integer'), array($this->getTestId()));
66
67 while ($row = $this->db->fetchAssoc($res)) {
68 $threshold = $this->buildSkillLevelThresholdByArray($row);
69 $this->addThreshold($threshold);
70 }
71 }
$query
foreach($_POST as $key=> $value) $res

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

+ Here is the call graph for this function:

◆ resetThresholds()

ilTestSkillLevelThresholdList::resetThresholds ( )

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

51 {
52 $this->thresholds = array();
53 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ saveToDb()

ilTestSkillLevelThresholdList::saveToDb ( )

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

76 {
77 foreach ($this->thresholds as $skillKey => $skillLevels) {
78 foreach ($skillLevels as $levelThreshold) {
79 /* @var ilTestSkillLevelThreshold $levelThreshold */
80 $levelThreshold->saveToDb();
81 }
82 }
83 }

◆ setTestId()

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

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

38 {
39 $this->testId = $testId;
40 }

References $testId.

Field Documentation

◆ $db

ilTestSkillLevelThresholdList::$db
private

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

Referenced by __construct().

◆ $testId

ilTestSkillLevelThresholdList::$testId
private

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

Referenced by cloneListForTest(), getTestId(), and setTestId().

◆ $thresholds

ilTestSkillLevelThresholdList::$thresholds = array()
private

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


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