ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilTestSkillQuestionAssignment Class Reference
+ Collaboration diagram for ilTestSkillQuestionAssignment:

Public Member Functions

 __construct (ilDB $db)
 
 loadFromDb ()
 
 saveToDb ()
 
 deleteFromDb ()
 
 dbRecordExists ()
 
 setSkillPoints ($skillPoints)
 
 getSkillPoints ()
 
 setQuestionId ($questionId)
 
 getQuestionId ()
 
 setSkillBaseId ($skillBaseId)
 
 getSkillBaseId ()
 
 setSkillTrefId ($skillTrefId)
 
 getSkillTrefId ()
 
 setTestId ($testId)
 
 getTestId ()
 
 loadAdditionalSkillData ()
 
 setSkillTitle ($skillTitle)
 
 getSkillTitle ()
 
 setSkillPath ($skillPath)
 
 getSkillPath ()
 

Data Fields

const DEFAULT_COMPETENCE_POINTS = 1
 

Private Attributes

 $db
 
 $testId
 
 $questionId
 
 $skillBaseId
 
 $skillTrefId
 
 $skillPoints
 
 $skillTitle
 
 $skillPath
 

Detailed Description

Definition at line 11 of file class.ilTestSkillQuestionAssignment.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillQuestionAssignment::__construct ( ilDB  $db)

Definition at line 56 of file class.ilTestSkillQuestionAssignment.php.

References $db.

Member Function Documentation

◆ dbRecordExists()

ilTestSkillQuestionAssignment::dbRecordExists ( )

Definition at line 128 of file class.ilTestSkillQuestionAssignment.php.

129 {
130 $query = "
131 SELECT COUNT(*) cnt
132 FROM tst_skl_qst_assigns
133 WHERE test_fi = %s
134 AND question_fi = %s
135 AND skill_base_fi = %s
136 AND skill_tref_fi = %s
137 ";
138
139 $res = $this->db->queryF(
140 $query, array('integer', 'integer', 'integer', 'integer'),
141 array($this->getTestId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())
142 );
143
144 $row = $this->db->fetchAssoc($res);
145
146 return $row['cnt'] > 0;
147 }

References $query, $res, $row, getQuestionId(), getSkillBaseId(), getSkillTrefId(), and getTestId().

Referenced by saveToDb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteFromDb()

ilTestSkillQuestionAssignment::deleteFromDb ( )

Definition at line 112 of file class.ilTestSkillQuestionAssignment.php.

113 {
114 $query = "
115 DELETE FROM tst_skl_qst_assigns
116 WHERE test_fi = %s
117 AND question_fi = %s
118 AND skill_base_fi = %s
119 AND skill_tref_fi = %s
120 ";
121
122 $this->db->manipulateF(
123 $query, array('integer', 'integer', 'integer', 'integer'),
124 array($this->getTestId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())
125 );
126 }

References $query, getQuestionId(), getSkillBaseId(), getSkillTrefId(), and getTestId().

+ Here is the call graph for this function:

◆ getQuestionId()

ilTestSkillQuestionAssignment::getQuestionId ( )

◆ getSkillBaseId()

◆ getSkillPath()

ilTestSkillQuestionAssignment::getSkillPath ( )

◆ getSkillPoints()

ilTestSkillQuestionAssignment::getSkillPoints ( )
Returns
int

Definition at line 160 of file class.ilTestSkillQuestionAssignment.php.

References $skillPoints.

Referenced by ilTestSkillQuestionAssignmentList\incrementMaxPointsBySkill(), and saveToDb().

+ Here is the caller graph for this function:

◆ getSkillTitle()

ilTestSkillQuestionAssignment::getSkillTitle ( )

◆ getSkillTrefId()

◆ getTestId()

ilTestSkillQuestionAssignment::getTestId ( )
Returns
int

Definition at line 224 of file class.ilTestSkillQuestionAssignment.php.

References $testId.

Referenced by dbRecordExists(), deleteFromDb(), loadFromDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ loadAdditionalSkillData()

ilTestSkillQuestionAssignment::loadAdditionalSkillData ( )

Definition at line 229 of file class.ilTestSkillQuestionAssignment.php.

230 {
231 require_once 'Services/Skill/classes/class.ilBasicSkill.php';
232 require_once 'Services/Skill/classes/class.ilSkillTree.php';
233
234 $this->setSkillTitle(
236 );
237
238 $tree = new ilSkillTree();
239
240 $path = $tree->getSkillTreePath(
241 $this->getSkillBaseId(), $this->getSkillTrefId()
242 );
243
244 $nodes = array();
245 foreach ($path as $node)
246 {
247 if( $node['child'] > 1 && $node['skill_id'] != $this->getSkillBaseId() )
248 {
249 $nodes[] = $node['title'];
250 }
251 }
252
253 $this->setSkillPath(implode(' > ', $nodes));
254 }
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
$path
Definition: index.php:22

References $path, ilSkillTreeNode\_lookupTitle(), getSkillBaseId(), getSkillTrefId(), setSkillPath(), and setSkillTitle().

+ Here is the call graph for this function:

◆ loadFromDb()

ilTestSkillQuestionAssignment::loadFromDb ( )

Definition at line 61 of file class.ilTestSkillQuestionAssignment.php.

62 {
63 $query = "
64 SELECT test_fi, question_fi, skill_base_fi, skill_tref_fi, skill_points
65 FROM tst_skl_qst_assigns
66 WHERE test_fi = %s
67 AND question_fi = %s
68 AND skill_base_fi = %s
69 AND skill_tref_fi = %s
70 ";
71
72 $res = $this->db->queryF(
73 $query, array('integer', 'integer', 'integer', 'integer'),
74 array($this->getTestId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())
75 );
76
77 $row = $this->db->fetchAssoc($res);
78
79 if( is_array($row) )
80 {
81 $this->setSkillPoints($row['skill_points']);
82 }
83 }

References $query, $res, $row, getQuestionId(), getSkillBaseId(), getSkillTrefId(), getTestId(), and setSkillPoints().

+ Here is the call graph for this function:

◆ saveToDb()

ilTestSkillQuestionAssignment::saveToDb ( )

Definition at line 85 of file class.ilTestSkillQuestionAssignment.php.

86 {
87 if( $this->dbRecordExists() )
88 {
89 $this->db->update('tst_skl_qst_assigns', array(
90 'skill_points' => array('integer', $this->getSkillPoints())
91 ),
92 array(
93 'test_fi' => array('integer', $this->getTestId()),
94 'question_fi' => array('integer', $this->getQuestionId()),
95 'skill_base_fi' => array('integer', $this->getSkillBaseId()),
96 'skill_tref_fi' => array('integer', $this->getSkillTrefId())
97 )
98 );
99 }
100 else
101 {
102 $this->db->insert('tst_skl_qst_assigns', array(
103 'test_fi' => array('integer', $this->getTestId()),
104 'question_fi' => array('integer', $this->getQuestionId()),
105 'skill_base_fi' => array('integer', $this->getSkillBaseId()),
106 'skill_tref_fi' => array('integer', $this->getSkillTrefId()),
107 'skill_points' => array('integer', $this->getSkillPoints())
108 ));
109 }
110 }

References dbRecordExists(), getQuestionId(), getSkillBaseId(), getSkillPoints(), getSkillTrefId(), and getTestId().

+ Here is the call graph for this function:

◆ setQuestionId()

ilTestSkillQuestionAssignment::setQuestionId (   $questionId)
Parameters
int$questionId

Definition at line 168 of file class.ilTestSkillQuestionAssignment.php.

169 {
170 $this->questionId = $questionId;
171 }

References $questionId.

◆ setSkillBaseId()

ilTestSkillQuestionAssignment::setSkillBaseId (   $skillBaseId)
Parameters
int$skillBaseId

Definition at line 184 of file class.ilTestSkillQuestionAssignment.php.

185 {
186 $this->skillBaseId = $skillBaseId;
187 }

References $skillBaseId.

◆ setSkillPath()

ilTestSkillQuestionAssignment::setSkillPath (   $skillPath)

Definition at line 266 of file class.ilTestSkillQuestionAssignment.php.

267 {
268 $this->skillPath = $skillPath;
269 }

References $skillPath.

Referenced by loadAdditionalSkillData().

+ Here is the caller graph for this function:

◆ setSkillPoints()

ilTestSkillQuestionAssignment::setSkillPoints (   $skillPoints)
Parameters
int$skillPoints

Definition at line 152 of file class.ilTestSkillQuestionAssignment.php.

153 {
154 $this->skillPoints = $skillPoints;
155 }

References $skillPoints.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setSkillTitle()

ilTestSkillQuestionAssignment::setSkillTitle (   $skillTitle)

Definition at line 256 of file class.ilTestSkillQuestionAssignment.php.

257 {
258 $this->skillTitle = $skillTitle;
259 }

References $skillTitle.

Referenced by loadAdditionalSkillData().

+ Here is the caller graph for this function:

◆ setSkillTrefId()

ilTestSkillQuestionAssignment::setSkillTrefId (   $skillTrefId)
Parameters
int$skillTrefId

Definition at line 200 of file class.ilTestSkillQuestionAssignment.php.

201 {
202 $this->skillTrefId = $skillTrefId;
203 }

References $skillTrefId.

◆ setTestId()

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

Definition at line 216 of file class.ilTestSkillQuestionAssignment.php.

217 {
218 $this->testId = $testId;
219 }

References $testId.

Field Documentation

◆ $db

ilTestSkillQuestionAssignment::$db
private

Definition at line 18 of file class.ilTestSkillQuestionAssignment.php.

Referenced by __construct().

◆ $questionId

ilTestSkillQuestionAssignment::$questionId
private

Definition at line 28 of file class.ilTestSkillQuestionAssignment.php.

Referenced by getQuestionId(), and setQuestionId().

◆ $skillBaseId

ilTestSkillQuestionAssignment::$skillBaseId
private

Definition at line 33 of file class.ilTestSkillQuestionAssignment.php.

Referenced by getSkillBaseId(), and setSkillBaseId().

◆ $skillPath

ilTestSkillQuestionAssignment::$skillPath
private

Definition at line 53 of file class.ilTestSkillQuestionAssignment.php.

Referenced by getSkillPath(), and setSkillPath().

◆ $skillPoints

ilTestSkillQuestionAssignment::$skillPoints
private

Definition at line 43 of file class.ilTestSkillQuestionAssignment.php.

Referenced by getSkillPoints(), and setSkillPoints().

◆ $skillTitle

ilTestSkillQuestionAssignment::$skillTitle
private

Definition at line 48 of file class.ilTestSkillQuestionAssignment.php.

Referenced by getSkillTitle(), and setSkillTitle().

◆ $skillTrefId

ilTestSkillQuestionAssignment::$skillTrefId
private

Definition at line 38 of file class.ilTestSkillQuestionAssignment.php.

Referenced by getSkillTrefId(), and setSkillTrefId().

◆ $testId

ilTestSkillQuestionAssignment::$testId
private

Definition at line 23 of file class.ilTestSkillQuestionAssignment.php.

Referenced by getTestId(), and setTestId().

◆ DEFAULT_COMPETENCE_POINTS

const ilTestSkillQuestionAssignment::DEFAULT_COMPETENCE_POINTS = 1

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