55 $this->user_id = $a_val;
65 return $this->user_id;
75 $this->top_skill_id = $a_val;
85 return $this->top_skill_id;
95 $this->created = $a_val;
105 return $this->created;
115 $this->last_update = $a_val;
125 return $this->last_update;
135 if (!$a_keep_existing)
137 $this->levels = $a_val;
141 if (is_array($a_val))
143 foreach ($a_val as $k => $v)
145 $this->levels[$k] = $v;
158 return $this->levels;
171 $set = $ilDB->query(
"SELECT * FROM skl_self_eval WHERE ".
172 " id = ".$ilDB->quote($this->getId(),
"integer")
174 if ($rec = $ilDB->fetchAssoc($set))
183 $set = $ilDB->query(
"SELECT * FROM skl_self_eval_level WHERE ".
184 " self_eval_id = ".$ilDB->quote($this->getId(),
"integer")
187 while ($rec = $ilDB->fetchAssoc($set))
189 $levels[$rec[
"skill_id"]] = $rec[
"level_id"];
202 $this->
setId($ilDB->nextId(
"skl_self_eval"));
204 $ilDB->manipulate(
"INSERT INTO skl_self_eval ".
205 "(id, user_id, top_skill_id, created, last_update) VALUES (".
206 $ilDB->quote($this->getId(),
"integer").
",".
207 $ilDB->quote($this->getUserId(),
"integer").
",".
208 $ilDB->quote($this->getTopSkillId(),
"integer").
",".
214 if (is_array($levels))
216 foreach ($levels as $skill_id => $level_id)
218 $ilDB->manipulate(
"INSERT INTO skl_self_eval_level ".
219 "(self_eval_id, skill_id, level_id) VALUES (".
220 $ilDB->quote($this->getId(),
"integer").
",".
221 $ilDB->quote($skill_id,
"integer").
",".
222 $ilDB->quote($level_id,
"integer").
235 $ilDB->manipulate(
"UPDATE skl_self_eval SET ".
236 " user_id = ".$ilDB->quote($this->getUserId(),
"integer").
237 ", top_skill_id = ".$ilDB->quote($this->getTopSkillId(),
"integer").
238 ", last_update = ".$ilDB->now().
239 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer")
242 $ilDB->manipulate(
"DELETE FROM skl_self_eval_level WHERE "
243 .
" self_eval_id = ".$ilDB->quote($this->getId(),
"integer")
247 if (is_array($levels))
249 foreach ($levels as $skill_id => $level_id)
251 $ilDB->manipulate(
"INSERT INTO skl_self_eval_level ".
252 "(self_eval_id, skill_id, level_id) VALUES (".
253 $ilDB->quote($this->getId(),
"integer").
",".
254 $ilDB->quote($skill_id,
"integer").
",".
255 $ilDB->quote($level_id,
"integer").
268 $ilDB->manipulate(
"DELETE FROM skl_self_eval WHERE "
269 .
" id = ".$ilDB->quote($this->getId(),
"integer")
272 $ilDB->manipulate(
"DELETE FROM skl_self_eval_level WHERE "
273 .
" self_eval_id = ".$ilDB->quote($this->getId(),
"integer")
284 $set = $ilDB->query(
"SELECT * FROM skl_self_eval WHERE user_id = ".
285 $ilDB->quote($a_user,
"integer").
" ".
286 "ORDER BY last_update DESC"
289 $self_evaluation = array();
291 $top_skills = array();
292 while ($rec = $ilDB->fetchAssoc($set))
294 if (!$a_one_per_top_skill || !in_array($rec[
"top_skill_id"], $top_skills))
296 $self_evaluation[] = $rec;
297 $top_skills[] = $rec[
"top_skill_id"];
301 return $self_evaluation;
314 $set = $ilDB->query(
"SELECT $a_prop FROM skl_self_eval WHERE ".
315 " id = ".$ilDB->quote($a_id,
"integer")
317 $rec = $ilDB->fetchAssoc($set);
318 return $rec[$a_prop];
331 $lng->loadLanguageModule(
"skmg");
333 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
334 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
338 if ($stree->isInTree($a_top_skill_id))
341 $levels = $se->getLevels();
343 $cnode = $stree->getNodeData($a_top_skill_id);
344 $childs = $stree->getSubTree($cnode);
346 foreach ($childs as $child)
348 if ($child[
"type"] ==
"skll")
351 $ls = $sk->getLevelData();
353 foreach ($ls as $k => $l)
355 $ord[$l[
"id"]] = $k + 1;
360 if ($ld[
"id"] == $levels[$child[
"child"]])
362 $sum+= $ord[$ld[
"id"]];
371 $avg = round($sum/$cnt);
374 return (array(
"skill_title" => $cnode[
"title"],
375 "ord" => $avg,
"avg_title" => $ls[$avg - 1][
"title"]));
379 return (array(
"skill_title" => $cnode[
"title"],
380 "ord" => $avg,
"avg_title" => $lng->txt(
"skmg_no_skills")));
397 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
398 include_once(
"./Services/Skill/classes/class.ilSkillSelfEvalSkillTableGUI.php");
401 if ($stree->isInTree($a_sn_id))
403 $cnode = $stree->getNodeData($a_sn_id);
404 $childs = $stree->getSubTree($cnode);
405 foreach ($childs as $child)
407 if ($child[
"type"] ==
"skll")
409 $steps[] = $child[
"child"];