ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilTestSkillLevelThresholdList Class Reference
+ Collaboration diagram for ilTestSkillLevelThresholdList:

Public Member Functions

 __construct (ilDB $db)
 
 setTestId ($testId)
 
 getTestId ()
 
 resetThresholds ()
 
 loadFromDb ()
 
 getThreshold ($skillBaseId, $skillTrefId, $skillLevelId)
 
 cloneListForTest ($testId)
 

Private Member Functions

 addThreshold ($skillKey, $skillLevelId, $threshold)
 
 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 ( ilDB  $db)

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

References $db.

Member Function Documentation

◆ addThreshold()

ilTestSkillLevelThresholdList::addThreshold (   $skillKey,
  $skillLevelId,
  $threshold 
)
private

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

78 {
79 $this->thresholds[$skillKey][$skillLevelId] = $threshold;
80 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ buildSkillLevelThresholdByArray()

ilTestSkillLevelThresholdList::buildSkillLevelThresholdByArray (   $data)
private

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

83 {
84 $threshold = new ilTestSkillLevelThreshold($this->db);
85
86 $threshold->setTestId($data['test_fi']);
87 $threshold->setSkillBaseId($data['skill_base_fi']);
88 $threshold->setSkillTrefId($data['skill_tref_fi']);
89 $threshold->setSkillLevelId($data['skill_level_fi']);
90 $threshold->setThreshold($data['threshold']);
91
92 return $threshold;
93 }
$data

References $data.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ cloneListForTest()

ilTestSkillLevelThresholdList::cloneListForTest (   $testId)

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

108 {
109 foreach($this->thresholds as $skillKey => $data)
110 {
111 foreach($data as $levelId => $threshold)
112 {
113 /* @var ilTestSkillLevelThreshold $threshold */
114
115 $threshold->setTestId($testId);
116 $threshold->saveToDb();
117
118 $threshold->setTestId($this->getTestId());
119 }
120 }
121 }

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(), and loadFromDb().

+ Here is the caller graph for this function:

◆ getThreshold()

ilTestSkillLevelThresholdList::getThreshold (   $skillBaseId,
  $skillTrefId,
  $skillLevelId 
)

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

96 {
97 $skillKey = $skillBaseId . ':' . $skillTrefId;
98
99 if( !isset($this->thresholds[$skillKey]) || !isset($this->thresholds[$skillKey][$skillLevelId]) )
100 {
101 return null;
102 }
103
104 return $this->thresholds[$skillKey][$skillLevelId];
105 }

◆ 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 {
69 $threshold = $this->buildSkillLevelThresholdByArray($row);
70
71 $skillKey = $threshold->getSkillBaseId() . ':' . $threshold->getSkillTrefId();
72
73 $this->addThreshold($skillKey, $threshold->getSkillLevelId(), $threshold);
74 }
75 }
addThreshold($skillKey, $skillLevelId, $threshold)

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:

◆ 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: