ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestSkillLevelThresholdList Class Reference
+ Collaboration diagram for ilTestSkillLevelThresholdList:

Public Member Functions

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

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.

Referenced by loadFromDb().

78  {
79  $this->thresholds[$skillKey][$skillLevelId] = $threshold;
80  }
+ Here is the caller graph for this function:

◆ buildSkillLevelThresholdByArray()

ilTestSkillLevelThresholdList::buildSkillLevelThresholdByArray (   $data)
private

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

References $data.

Referenced by loadFromDb().

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  }
+ Here is the caller graph for this function:

◆ getTestId()

ilTestSkillLevelThresholdList::getTestId ( )
Returns
int

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

References $testId.

Referenced by 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.

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

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)
+ Here is the call graph for this function:

◆ resetThresholds()

ilTestSkillLevelThresholdList::resetThresholds ( )

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

Referenced by loadFromDb().

51  {
52  $this->thresholds = array();
53  }
+ Here is the caller graph for this function:

◆ setTestId()

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

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

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