ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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 int DEFAULT_COMPETENCE_POINTS = 1
 
const string EVAL_MODE_BY_QUESTION_RESULT = 'result'
 
const string EVAL_MODE_BY_QUESTION_SOLUTION = 'solution'
 

Private Member Functions

 retrieveNodeTitlesArrayFromPath ()
 

Private Attributes

ilDBInterface $db
 
int $parent_obj_id
 
int $question_id
 
int $skill_base_id
 
int $skill_tref_id
 
int $skill_points = self::DEFAULT_COMPETENCE_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 304 of file class.ilAssQuestionSkillAssignment.php.

304 : string
305 {
306 return $this->eval_mode;
307 }

References $eval_mode.

Referenced by loadFromDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ getMaxSkillPoints()

ilAssQuestionSkillAssignment::getMaxSkillPoints ( )

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

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

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

299 : ?string
300 {
301 return $this->skill_path;
302 }

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

289 : ?string
290 {
291 return $this->skill_title;
292 }

References $skill_title.

◆ getSkillTrefId()

◆ getSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::getSolutionComparisonExpressionList ( )

◆ hasEvalModeBySolution()

ilAssQuestionSkillAssignment::hasEvalModeBySolution ( )

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

314 : bool
315 {
316 return $this->eval_mode === self::EVAL_MODE_BY_QUESTION_SOLUTION;
317 }

References EVAL_MODE_BY_QUESTION_SOLUTION.

Referenced by getMaxSkillPoints().

+ Here is the caller graph for this function:

◆ initSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::initSolutionComparisonExpressionList ( )

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

319 : void
320 {
321 $this->solution_comparison_expression_list->setQuestionId($this->getQuestionId());
322 $this->solution_comparison_expression_list->setSkillBaseId($this->getSkillBaseId());
323 $this->solution_comparison_expression_list->setSkillTrefId($this->getSkillTrefId());
324 }

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

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

◆ loadAdditionalSkillData()

ilAssQuestionSkillAssignment::loadAdditionalSkillData ( )

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

◆ retrieveNodeTitlesArrayFromPath()

ilAssQuestionSkillAssignment::retrieveNodeTitlesArrayFromPath ( )
private

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

256 : array
257 {
258 $path = $this->skill_tree_service->getSkillTreePath($this->getSkillBaseId(), $this->getSkillTrefId());
259 if ($path === []) {
260 return [];
261
262 }
263
264 $nodes = [];
265 foreach ($path as $node) {
266 if ($node['title'] === 'Skill Tree Root Node') {
267 continue;
268 }
269
270 if ($node['child'] > 1 && $node['skill_id'] != $this->getSkillBaseId()) {
271 $nodes[] = $node['title'];
272 }
273 }
274
275 $root_node_skl_tree_id = reset($path)['skl_tree_id'];
276 array_unshift(
277 $nodes,
278 htmlspecialchars($this->skill_tree_service->getObjSkillTreeById($root_node_skl_tree_id)->getTitle())
279 );
280
281 return $nodes;
282 }
$path
Definition: ltiservices.php:30

References $path, getSkillBaseId(), and getSkillTrefId().

Referenced by loadAdditionalSkillData().

+ Here is the call graph for this function:
+ Here is the caller 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 309 of file class.ilAssQuestionSkillAssignment.php.

309 : void
310 {
311 $this->eval_mode = $evalMode;
312 }

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

294 : void
295 {
296 $this->skill_path = $skillPath;
297 }

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

284 : void
285 {
286 $this->skill_title = $skillTitle;
287 }

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 = self::DEFAULT_COMPETENCE_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 int 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: