ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAssQuestionSkillAssignment Class Reference
+ Collaboration diagram for ilAssQuestionSkillAssignment:

Public Member Functions

 __construct (ilDBInterface $db)
 
 loadFromDb ()
 
 loadComparisonExpressions ()
 
 saveToDb ()
 
 saveComparisonExpressions ()
 
 deleteFromDb ()
 
 deleteComparisonExpressions ()
 
 dbRecordExists ()
 
 isSkillUsed ()
 
 setSkillPoints (int $skillPoints)
 
 getSkillPoints ()
 
 setQuestionId (int $questionId)
 
 getQuestionId ()
 
 setSkillBaseId (int $skillBaseId)
 
 getSkillBaseId ()
 
 setSkillTrefId (int $skillTrefId)
 
 getSkillTrefId ()
 
 setParentObjId (int $parentObjId)
 
 getParentObjId ()
 
 loadAdditionalSkillData ()
 
 setSkillTitle ($skillTitle)
 
 getSkillTitle ()
 
 setSkillPath ($skillPath)
 
 getSkillPath ()
 
 getEvalMode ()
 
 setEvalMode (string $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

ilDBInterface $db
 
int $parent_obj_id
 
int $question_id
 
int $skill_base_id
 
int $skill_tref_id
 
int $skill_points
 
string $skill_title = ''
 
string $skill_path = ''
 
string $eval_mode
 
ilAssQuestionSolutionComparisonExpressionList $solution_comparison_expression_list
 
SkillTreeService $skill_tree_service
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignment::__construct ( ilDBInterface  $db)

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

50 {
51 global $DIC;
52
53 $this->db = $db;
54
55 $this->solution_comparison_expression_list = new ilAssQuestionSolutionComparisonExpressionList($this->db);
56 $this->skill_tree_service = $DIC->skills()->tree();
57 }
global $DIC
Definition: shib_login.php:26

References $db, and $DIC.

Member Function Documentation

◆ dbRecordExists()

ilAssQuestionSkillAssignment::dbRecordExists ( )

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

157 : bool
158 {
159 $query = "
160 SELECT COUNT(*) cnt
161 FROM qpl_qst_skl_assigns
162 WHERE obj_fi = %s
163 AND question_fi = %s
164 AND skill_base_fi = %s
165 AND skill_tref_fi = %s
166 ";
167
168 $res = $this->db->queryF(
169 $query,
170 ['integer', 'integer', 'integer', 'integer'],
171 [$this->getParentObjId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId()]
172 );
173
174 $row = $this->db->fetchAssoc($res);
175
176 return $row['cnt'] > 0;
177 }
$res
Definition: ltiservices.php:69

References $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 151 of file class.ilAssQuestionSkillAssignment.php.

151 : void
152 {
154 $this->solution_comparison_expression_list->delete();
155 }

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 132 of file class.ilAssQuestionSkillAssignment.php.

132 : void
133 {
134 $query = "
135 DELETE FROM qpl_qst_skl_assigns
136 WHERE obj_fi = %s
137 AND question_fi = %s
138 AND skill_base_fi = %s
139 AND skill_tref_fi = %s
140 ";
141
142 $this->db->manipulateF(
143 $query,
144 ['integer', 'integer', 'integer', 'integer'],
145 [$this->getParentObjId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId()]
146 );
147
149 }

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

+ Here is the call graph for this function:

◆ getEvalMode()

ilAssQuestionSkillAssignment::getEvalMode ( )

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

301 : string
302 {
303 return $this->eval_mode;
304 }

References $eval_mode.

Referenced by loadFromDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ getMaxSkillPoints()

ilAssQuestionSkillAssignment::getMaxSkillPoints ( )

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

328 : int
329 {
330 if ($this->hasEvalModeBySolution()) {
331 $max_points = 0;
332
333 foreach ($this->solution_comparison_expression_list->get() as $expression) {
334 if ($expression->getPoints() > $max_points) {
335 $max_points = $expression->getPoints();
336 }
337 }
338
339 return $max_points;
340 }
341
342 return $this->getSkillPoints();
343 }

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 ( )

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

References $parent_obj_id.

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

+ Here is the caller graph for this function:

◆ getQuestionId()

ilAssQuestionSkillAssignment::getQuestionId ( )

◆ getSkillBaseId()

◆ getSkillPath()

ilAssQuestionSkillAssignment::getSkillPath ( )

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

296 : ?string
297 {
298 return $this->skill_path;
299 }

References $skill_path.

◆ getSkillPoints()

ilAssQuestionSkillAssignment::getSkillPoints ( )

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

References $skill_points.

Referenced by getMaxSkillPoints(), and saveToDb().

+ Here is the caller graph for this function:

◆ getSkillTitle()

ilAssQuestionSkillAssignment::getSkillTitle ( )

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

286 : ?string
287 {
288 return $this->skill_title;
289 }

References $skill_title.

◆ getSkillTrefId()

◆ getSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::getSolutionComparisonExpressionList ( )

◆ hasEvalModeBySolution()

ilAssQuestionSkillAssignment::hasEvalModeBySolution ( )

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

311 : bool
312 {
313 return $this->eval_mode === self::EVAL_MODE_BY_QUESTION_SOLUTION;
314 }

References EVAL_MODE_BY_QUESTION_SOLUTION.

Referenced by ilAssQuestionSkillAssignmentsTableGUI\getEvalModeLabel(), and getMaxSkillPoints().

+ Here is the caller graph for this function:

◆ initSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::initSolutionComparisonExpressionList ( )

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

316 : void
317 {
318 $this->solution_comparison_expression_list->setQuestionId($this->getQuestionId());
319 $this->solution_comparison_expression_list->setSkillBaseId($this->getSkillBaseId());
320 $this->solution_comparison_expression_list->setSkillTrefId($this->getSkillTrefId());
321 }

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 179 of file class.ilAssQuestionSkillAssignment.php.

179 : bool
180 {
181 $query = "
182 SELECT COUNT(*) cnt
183 FROM qpl_qst_skl_assigns
184 WHERE obj_fi = %s
185 AND skill_base_fi = %s
186 AND skill_tref_fi = %s
187 ";
188
189 $res = $this->db->queryF(
190 $query,
191 ['integer', 'integer', 'integer'],
192 [$this->getParentObjId(), $this->getSkillBaseId(), $this->getSkillTrefId()]
193 );
194
195 $row = $this->db->fetchAssoc($res);
196
197 return $row['cnt'] > 0;
198 }

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

+ Here is the call graph for this function:

◆ isValidSkillPoint()

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

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

348 : bool
349 {
350 return (
351 is_numeric($skillPoints) &&
352 str_replace(['.', ','], '', $skillPoints) == $skillPoints &&
353 $skillPoints > 0
354 );
355 }

◆ loadAdditionalSkillData()

ilAssQuestionSkillAssignment::loadAdditionalSkillData ( )

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

250 : void
251 {
252 $this->setSkillTitle(
254 );
255
256 $path = $this->skill_tree_service->getSkillTreePath(
257 $this->getSkillBaseId(),
258 $this->getSkillTrefId()
259 );
260
261 $nodes = [];
262 foreach ($path as $node) {
263 if ($node['title'] === "Skill Tree Root Node") {
264 continue;
265 }
266
267 if ($node['child'] > 1 && $node['skill_id'] != $this->getSkillBaseId()) {
268 $nodes[] = $node['title'];
269 }
270 }
271
272 $root_node = reset($path);
273 array_unshift(
274 $nodes,
275 $this->skill_tree_service->getObjSkillTreeById($root_node['skl_tree_id'])->getTitleForHTMLOutput()
276 );
277
278 $this->setSkillPath(implode(' > ', $nodes));
279 }
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
$path
Definition: ltiservices.php:30

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

+ Here is the call graph for this function:

◆ loadComparisonExpressions()

ilAssQuestionSkillAssignment::loadComparisonExpressions ( )

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

88 : void
89 {
91 $this->solution_comparison_expression_list->load();
92 }

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 59 of file class.ilAssQuestionSkillAssignment.php.

59 : void
60 {
61 $query = "
62 SELECT obj_fi, question_fi, skill_base_fi, skill_tref_fi, skill_points, eval_mode
63 FROM qpl_qst_skl_assigns
64 WHERE obj_fi = %s
65 AND question_fi = %s
66 AND skill_base_fi = %s
67 AND skill_tref_fi = %s
68 ";
69
70 $res = $this->db->queryF(
71 $query,
72 ['integer', 'integer', 'integer', 'integer'],
73 [$this->parent_obj_id, $this->question_id, $this->skill_base_id, $this->skill_tref_id]
74 );
75
76 $row = $this->db->fetchAssoc($res);
77
78 if (is_array($row)) {
79 $this->setSkillPoints($row['skill_points']);
80 $this->setEvalMode($row['eval_mode']);
81 }
82
83 if ($this->getEvalMode() == self::EVAL_MODE_BY_QUESTION_SOLUTION) {
85 }
86 }

References $res, getEvalMode(), loadComparisonExpressions(), setEvalMode(), and setSkillPoints().

+ Here is the call graph for this function:

◆ saveComparisonExpressions()

ilAssQuestionSkillAssignment::saveComparisonExpressions ( )

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

126 : void
127 {
129 $this->solution_comparison_expression_list->save();
130 }

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 94 of file class.ilAssQuestionSkillAssignment.php.

94 : void
95 {
96 if ($this->dbRecordExists()) {
97 $this->db->update(
98 'qpl_qst_skl_assigns',
99 [
100 'skill_points' => ['integer', $this->getSkillPoints()],
101 'eval_mode' => ['text', $this->getEvalMode()]
102 ],
103 [
104 'obj_fi' => ['integer', $this->getParentObjId()],
105 'question_fi' => ['integer', $this->getQuestionId()],
106 'skill_base_fi' => ['integer', $this->getSkillBaseId()],
107 'skill_tref_fi' => ['integer', $this->getSkillTrefId()]
108 ]
109 );
110 } else {
111 $this->db->insert('qpl_qst_skl_assigns', [
112 'obj_fi' => ['integer', $this->getParentObjId()],
113 'question_fi' => ['integer', $this->getQuestionId()],
114 'skill_base_fi' => ['integer', $this->getSkillBaseId()],
115 'skill_tref_fi' => ['integer', $this->getSkillTrefId()],
116 'skill_points' => ['integer', $this->getSkillPoints()],
117 'eval_mode' => ['text', $this->getEvalMode()]
118 ]);
119 }
120
121 if ($this->getEvalMode() == self::EVAL_MODE_BY_QUESTION_SOLUTION) {
123 }
124 }

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

+ Here is the call graph for this function:

◆ setEvalMode()

ilAssQuestionSkillAssignment::setEvalMode ( string  $evalMode)

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

306 : void
307 {
308 $this->eval_mode = $evalMode;
309 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setParentObjId()

ilAssQuestionSkillAssignment::setParentObjId ( int  $parentObjId)

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

240 : void
241 {
242 $this->parent_obj_id = $parentObjId;
243 }

◆ setQuestionId()

ilAssQuestionSkillAssignment::setQuestionId ( int  $questionId)

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

210 : void
211 {
212 $this->question_id = $questionId;
213 }

◆ setSkillBaseId()

ilAssQuestionSkillAssignment::setSkillBaseId ( int  $skillBaseId)

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

220 : void
221 {
222 $this->skill_base_id = $skillBaseId;
223 }

◆ setSkillPath()

ilAssQuestionSkillAssignment::setSkillPath (   $skillPath)

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

291 : void
292 {
293 $this->skill_path = $skillPath;
294 }

Referenced by loadAdditionalSkillData().

+ Here is the caller graph for this function:

◆ setSkillPoints()

ilAssQuestionSkillAssignment::setSkillPoints ( int  $skillPoints)

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

200 : void
201 {
202 $this->skill_points = $skillPoints;
203 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setSkillTitle()

ilAssQuestionSkillAssignment::setSkillTitle (   $skillTitle)

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

281 : void
282 {
283 $this->skill_title = $skillTitle;
284 }

Referenced by loadAdditionalSkillData().

+ Here is the caller graph for this function:

◆ setSkillTrefId()

ilAssQuestionSkillAssignment::setSkillTrefId ( int  $skillTrefId)

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

230 : void
231 {
232 $this->skill_tref_id = $skillTrefId;
233 }

Field Documentation

◆ $db

ilDBInterface ilAssQuestionSkillAssignment::$db
private

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

Referenced by __construct().

◆ $eval_mode

string ilAssQuestionSkillAssignment::$eval_mode
private

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

Referenced by getEvalMode().

◆ $parent_obj_id

int ilAssQuestionSkillAssignment::$parent_obj_id
private

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

Referenced by getParentObjId().

◆ $question_id

int ilAssQuestionSkillAssignment::$question_id
private

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

Referenced by getQuestionId().

◆ $skill_base_id

int ilAssQuestionSkillAssignment::$skill_base_id
private

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

Referenced by getSkillBaseId().

◆ $skill_path

string ilAssQuestionSkillAssignment::$skill_path = ''
private

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

Referenced by getSkillPath().

◆ $skill_points

int ilAssQuestionSkillAssignment::$skill_points
private

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

Referenced by getSkillPoints().

◆ $skill_title

string ilAssQuestionSkillAssignment::$skill_title = ''
private

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

Referenced by getSkillTitle().

◆ $skill_tree_service

SkillTreeService ilAssQuestionSkillAssignment::$skill_tree_service
private

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

◆ $skill_tref_id

int ilAssQuestionSkillAssignment::$skill_tref_id
private

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

Referenced by getSkillTrefId().

◆ $solution_comparison_expression_list

ilAssQuestionSolutionComparisonExpressionList ilAssQuestionSkillAssignment::$solution_comparison_expression_list
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: