ILIAS  release_8 Revision v8.24
ilAssQuestionSkillAssignment Class Reference
+ Collaboration diagram for ilAssQuestionSkillAssignment:

Public Member Functions

 __construct (ilDBInterface $db)
 
 loadFromDb ()
 
 loadComparisonExpressions ()
 
 saveToDb ()
 
 saveComparisonExpressions ()
 
 deleteFromDb ()
 
 deleteComparisonExpressions ()
 
 dbRecordExists ()
 
 isSkillUsed ()
 
 setSkillPoints ($skillPoints)
 
 getSkillPoints ()
 
 setQuestionId ($questionId)
 
 getQuestionId ()
 
 setSkillBaseId ($skillBaseId)
 
 getSkillBaseId ()
 
 setSkillTrefId ($skillTrefId)
 
 getSkillTrefId ()
 
 setParentObjId ($parentObjId)
 
 getParentObjId ()
 
 loadAdditionalSkillData ()
 
 setSkillTitle ($skillTitle)
 
 getSkillTitle ()
 
 setSkillPath ($skillPath)
 
 getSkillPath ()
 
 getEvalMode ()
 
 setEvalMode ($evalMode)
 
 hasEvalModeBySolution ()
 
 initSolutionComparisonExpressionList ()
 
 getSolutionComparisonExpressionList ()
 
 getMaxSkillPoints ()
 
 isValidSkillPoint ($skillPoints)
 

Data Fields

const DEFAULT_COMPETENCE_POINTS = 1
 
const EVAL_MODE_BY_QUESTION_RESULT = 'result'
 
const EVAL_MODE_BY_QUESTION_SOLUTION = 'solution'
 

Private Attributes

 $db
 
 $parentObjId
 
 $questionId
 
 $skillBaseId
 
 $skillTrefId
 
 $skillPoints
 
 $skillTitle
 
 $skillPath
 
 $evalMode
 
 $solutionComparisonExpressionList
 
SkillTreeService $skill_tree_service
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignment::__construct ( ilDBInterface  $db)

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

88 {
89 global $DIC;
90
91 $this->db = $db;
92
93 $this->solutionComparisonExpressionList = new ilAssQuestionSolutionComparisonExpressionList($this->db);
94 $this->skill_tree_service = $DIC->skills()->tree();
95 }
global $DIC
Definition: feed.php:28

References $db, and $DIC.

Member Function Documentation

◆ dbRecordExists()

ilAssQuestionSkillAssignment::dbRecordExists ( )

Definition at line 195 of file class.ilAssQuestionSkillAssignment.php.

195 : bool
196 {
197 $query = "
198 SELECT COUNT(*) cnt
199 FROM qpl_qst_skl_assigns
200 WHERE obj_fi = %s
201 AND question_fi = %s
202 AND skill_base_fi = %s
203 AND skill_tref_fi = %s
204 ";
205
206 $res = $this->db->queryF(
207 $query,
208 array('integer', 'integer', 'integer', 'integer'),
209 array($this->getParentObjId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())
210 );
211
212 $row = $this->db->fetchAssoc($res);
213
214 return $row['cnt'] > 0;
215 }
$res
Definition: ltiservices.php:69
$query

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

Referenced by saveToDb().

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

◆ deleteComparisonExpressions()

ilAssQuestionSkillAssignment::deleteComparisonExpressions ( )

Definition at line 189 of file class.ilAssQuestionSkillAssignment.php.

189 : void
190 {
192 $this->solutionComparisonExpressionList->delete();
193 }

References initSolutionComparisonExpressionList().

Referenced by deleteFromDb().

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

◆ deleteFromDb()

ilAssQuestionSkillAssignment::deleteFromDb ( )

Definition at line 170 of file class.ilAssQuestionSkillAssignment.php.

170 : void
171 {
172 $query = "
173 DELETE FROM qpl_qst_skl_assigns
174 WHERE obj_fi = %s
175 AND question_fi = %s
176 AND skill_base_fi = %s
177 AND skill_tref_fi = %s
178 ";
179
180 $this->db->manipulateF(
181 $query,
182 array('integer', 'integer', 'integer', 'integer'),
183 array($this->getParentObjId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())
184 );
185
187 }

References $query, deleteComparisonExpressions(), getParentObjId(), getQuestionId(), getSkillBaseId(), and getSkillTrefId().

+ Here is the call graph for this function:

◆ getEvalMode()

ilAssQuestionSkillAssignment::getEvalMode ( )

Definition at line 359 of file class.ilAssQuestionSkillAssignment.php.

References $evalMode.

Referenced by hasEvalModeBySolution(), loadFromDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ getMaxSkillPoints()

ilAssQuestionSkillAssignment::getMaxSkillPoints ( )

Definition at line 386 of file class.ilAssQuestionSkillAssignment.php.

386 : int
387 {
388 if ($this->hasEvalModeBySolution()) {
389 $maxPoints = 0;
390
391 foreach ($this->solutionComparisonExpressionList->get() as $expression) {
392 if ($expression->getPoints() > $maxPoints) {
393 $maxPoints = $expression->getPoints();
394 }
395 }
396
397 return $maxPoints;
398 }
399
400 return $this->getSkillPoints();
401 }

References getSkillPoints(), and hasEvalModeBySolution().

Referenced by ilAssQuestionSkillAssignmentList\incrementMaxPointsBySkill().

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

◆ getParentObjId()

ilAssQuestionSkillAssignment::getParentObjId ( )
Returns
int

Definition at line 313 of file class.ilAssQuestionSkillAssignment.php.

References $parentObjId.

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

+ Here is the caller graph for this function:

◆ getQuestionId()

ilAssQuestionSkillAssignment::getQuestionId ( )

◆ getSkillBaseId()

◆ getSkillPath()

ilAssQuestionSkillAssignment::getSkillPath ( )

Definition at line 354 of file class.ilAssQuestionSkillAssignment.php.

References $skillPath.

◆ getSkillPoints()

ilAssQuestionSkillAssignment::getSkillPoints ( )
Returns
int

Definition at line 249 of file class.ilAssQuestionSkillAssignment.php.

References $skillPoints.

Referenced by ilAssQuestionSkillAssignmentsTableGUI\buildSkillPointsInput(), getMaxSkillPoints(), and saveToDb().

+ Here is the caller graph for this function:

◆ getSkillTitle()

ilAssQuestionSkillAssignment::getSkillTitle ( )

Definition at line 344 of file class.ilAssQuestionSkillAssignment.php.

References $skillTitle.

◆ getSkillTrefId()

◆ getSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::getSolutionComparisonExpressionList ( )

◆ hasEvalModeBySolution()

ilAssQuestionSkillAssignment::hasEvalModeBySolution ( )

◆ initSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::initSolutionComparisonExpressionList ( )

Definition at line 374 of file class.ilAssQuestionSkillAssignment.php.

374 : void
375 {
376 $this->solutionComparisonExpressionList->setQuestionId($this->getQuestionId());
377 $this->solutionComparisonExpressionList->setSkillBaseId($this->getSkillBaseId());
378 $this->solutionComparisonExpressionList->setSkillTrefId($this->getSkillTrefId());
379 }

References getQuestionId(), getSkillBaseId(), and getSkillTrefId().

Referenced by deleteComparisonExpressions(), loadComparisonExpressions(), and saveComparisonExpressions().

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

◆ isSkillUsed()

ilAssQuestionSkillAssignment::isSkillUsed ( )

Definition at line 217 of file class.ilAssQuestionSkillAssignment.php.

217 : bool
218 {
219 $query = "
220 SELECT COUNT(*) cnt
221 FROM qpl_qst_skl_assigns
222 WHERE obj_fi = %s
223 AND skill_base_fi = %s
224 AND skill_tref_fi = %s
225 ";
226
227 $res = $this->db->queryF(
228 $query,
229 array('integer', 'integer', 'integer'),
230 array($this->getParentObjId(), $this->getSkillBaseId(), $this->getSkillTrefId())
231 );
232
233 $row = $this->db->fetchAssoc($res);
234
235 return $row['cnt'] > 0;
236 }

References $query, $res, getParentObjId(), getSkillBaseId(), and getSkillTrefId().

+ Here is the call graph for this function:

◆ isValidSkillPoint()

ilAssQuestionSkillAssignment::isValidSkillPoint (   $skillPoints)
Parameters
mixed$skillPoints
Returns
bool

Definition at line 407 of file class.ilAssQuestionSkillAssignment.php.

407 : bool
408 {
409 return (
410 is_numeric($skillPoints) &&
411 str_replace(array('.', ','), '', $skillPoints) == $skillPoints &&
412 $skillPoints > 0
413 );
414 }

References $skillPoints.

◆ loadAdditionalSkillData()

ilAssQuestionSkillAssignment::loadAdditionalSkillData ( )

Definition at line 318 of file class.ilAssQuestionSkillAssignment.php.

318 : void
319 {
320 $this->setSkillTitle(
322 );
323
324 $path = $this->skill_tree_service->getSkillTreePath(
325 $this->getSkillBaseId(),
326 $this->getSkillTrefId()
327 );
328
329 $nodes = array();
330 foreach ($path as $node) {
331 if ($node['child'] > 1 && $node['skill_id'] != $this->getSkillBaseId()) {
332 $nodes[] = $node['title'];
333 }
334 }
335
336 $this->setSkillPath(implode(' > ', $nodes));
337 }
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
$path
Definition: ltiservices.php:32

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

+ Here is the call graph for this function:

◆ loadComparisonExpressions()

ilAssQuestionSkillAssignment::loadComparisonExpressions ( )

Definition at line 126 of file class.ilAssQuestionSkillAssignment.php.

126 : void
127 {
129 $this->solutionComparisonExpressionList->load();
130 }

References initSolutionComparisonExpressionList().

Referenced by loadFromDb().

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

◆ loadFromDb()

ilAssQuestionSkillAssignment::loadFromDb ( )

Definition at line 97 of file class.ilAssQuestionSkillAssignment.php.

97 : void
98 {
99 $query = "
100 SELECT obj_fi, question_fi, skill_base_fi, skill_tref_fi, skill_points, eval_mode
101 FROM qpl_qst_skl_assigns
102 WHERE obj_fi = %s
103 AND question_fi = %s
104 AND skill_base_fi = %s
105 AND skill_tref_fi = %s
106 ";
107
108 $res = $this->db->queryF(
109 $query,
110 array('integer', 'integer', 'integer', 'integer'),
111 array($this->getParentObjId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())
112 );
113
114 $row = $this->db->fetchAssoc($res);
115
116 if (is_array($row)) {
117 $this->setSkillPoints($row['skill_points']);
118 $this->setEvalMode($row['eval_mode']);
119 }
120
121 if ($this->getEvalMode() == self::EVAL_MODE_BY_QUESTION_SOLUTION) {
123 }
124 }

References $query, $res, getEvalMode(), getParentObjId(), getQuestionId(), getSkillBaseId(), getSkillTrefId(), loadComparisonExpressions(), setEvalMode(), and setSkillPoints().

+ Here is the call graph for this function:

◆ saveComparisonExpressions()

ilAssQuestionSkillAssignment::saveComparisonExpressions ( )

Definition at line 164 of file class.ilAssQuestionSkillAssignment.php.

164 : void
165 {
167 $this->solutionComparisonExpressionList->save();
168 }

References initSolutionComparisonExpressionList().

Referenced by saveToDb().

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

◆ saveToDb()

ilAssQuestionSkillAssignment::saveToDb ( )

Definition at line 132 of file class.ilAssQuestionSkillAssignment.php.

132 : void
133 {
134 if ($this->dbRecordExists()) {
135 $this->db->update(
136 'qpl_qst_skl_assigns',
137 array(
138 'skill_points' => array('integer', $this->getSkillPoints()),
139 'eval_mode' => array('text', $this->getEvalMode())
140 ),
141 array(
142 'obj_fi' => array('integer', $this->getParentObjId()),
143 'question_fi' => array('integer', $this->getQuestionId()),
144 'skill_base_fi' => array('integer', $this->getSkillBaseId()),
145 'skill_tref_fi' => array('integer', $this->getSkillTrefId())
146 )
147 );
148 } else {
149 $this->db->insert('qpl_qst_skl_assigns', array(
150 'obj_fi' => array('integer', $this->getParentObjId()),
151 'question_fi' => array('integer', $this->getQuestionId()),
152 'skill_base_fi' => array('integer', $this->getSkillBaseId()),
153 'skill_tref_fi' => array('integer', $this->getSkillTrefId()),
154 'skill_points' => array('integer', $this->getSkillPoints()),
155 'eval_mode' => array('text', $this->getEvalMode())
156 ));
157 }
158
159 if ($this->getEvalMode() == self::EVAL_MODE_BY_QUESTION_SOLUTION) {
161 }
162 }

References dbRecordExists(), getEvalMode(), getParentObjId(), getQuestionId(), getSkillBaseId(), getSkillPoints(), getSkillTrefId(), and saveComparisonExpressions().

+ Here is the call graph for this function:

◆ setEvalMode()

ilAssQuestionSkillAssignment::setEvalMode (   $evalMode)

Definition at line 364 of file class.ilAssQuestionSkillAssignment.php.

364 : void
365 {
366 $this->evalMode = $evalMode;
367 }

References $evalMode.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setParentObjId()

ilAssQuestionSkillAssignment::setParentObjId (   $parentObjId)
Parameters
int$parentObjId

Definition at line 305 of file class.ilAssQuestionSkillAssignment.php.

305 : void
306 {
307 $this->parentObjId = $parentObjId;
308 }

References $parentObjId.

◆ setQuestionId()

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

Definition at line 257 of file class.ilAssQuestionSkillAssignment.php.

257 : void
258 {
259 $this->questionId = $questionId;
260 }

References $questionId.

◆ setSkillBaseId()

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

Definition at line 273 of file class.ilAssQuestionSkillAssignment.php.

273 : void
274 {
275 $this->skillBaseId = $skillBaseId;
276 }

References $skillBaseId.

◆ setSkillPath()

ilAssQuestionSkillAssignment::setSkillPath (   $skillPath)

Definition at line 349 of file class.ilAssQuestionSkillAssignment.php.

349 : void
350 {
351 $this->skillPath = $skillPath;
352 }

References $skillPath.

Referenced by loadAdditionalSkillData().

+ Here is the caller graph for this function:

◆ setSkillPoints()

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

Definition at line 241 of file class.ilAssQuestionSkillAssignment.php.

241 : void
242 {
243 $this->skillPoints = $skillPoints;
244 }

References $skillPoints.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setSkillTitle()

ilAssQuestionSkillAssignment::setSkillTitle (   $skillTitle)

Definition at line 339 of file class.ilAssQuestionSkillAssignment.php.

339 : void
340 {
341 $this->skillTitle = $skillTitle;
342 }

References $skillTitle.

Referenced by loadAdditionalSkillData().

+ Here is the caller graph for this function:

◆ setSkillTrefId()

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

Definition at line 289 of file class.ilAssQuestionSkillAssignment.php.

289 : void
290 {
291 $this->skillTrefId = $skillTrefId;
292 }

References $skillTrefId.

Field Documentation

◆ $db

ilAssQuestionSkillAssignment::$db
private

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

Referenced by __construct().

◆ $evalMode

ilAssQuestionSkillAssignment::$evalMode
private

Definition at line 78 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getEvalMode(), and setEvalMode().

◆ $parentObjId

ilAssQuestionSkillAssignment::$parentObjId
private

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

Referenced by getParentObjId(), and setParentObjId().

◆ $questionId

ilAssQuestionSkillAssignment::$questionId
private

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

Referenced by getQuestionId(), and setQuestionId().

◆ $skill_tree_service

SkillTreeService ilAssQuestionSkillAssignment::$skill_tree_service
private

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

◆ $skillBaseId

ilAssQuestionSkillAssignment::$skillBaseId
private

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

Referenced by getSkillBaseId(), and setSkillBaseId().

◆ $skillPath

ilAssQuestionSkillAssignment::$skillPath
private

Definition at line 73 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getSkillPath(), and setSkillPath().

◆ $skillPoints

ilAssQuestionSkillAssignment::$skillPoints
private

◆ $skillTitle

ilAssQuestionSkillAssignment::$skillTitle
private

Definition at line 68 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getSkillTitle(), and setSkillTitle().

◆ $skillTrefId

ilAssQuestionSkillAssignment::$skillTrefId
private

Definition at line 58 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getSkillTrefId(), and setSkillTrefId().

◆ $solutionComparisonExpressionList

ilAssQuestionSkillAssignment::$solutionComparisonExpressionList
private

◆ DEFAULT_COMPETENCE_POINTS

const ilAssQuestionSkillAssignment::DEFAULT_COMPETENCE_POINTS = 1

◆ EVAL_MODE_BY_QUESTION_RESULT

◆ EVAL_MODE_BY_QUESTION_SOLUTION


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