28 $this->db = $DIC->database();
62 $this->user_id = $a_val;
72 return $this->user_id;
82 $this->top_skill_id = $a_val;
92 return $this->top_skill_id;
102 $this->created = $a_val;
112 return $this->created;
122 $this->last_update = $a_val;
132 return $this->last_update;
140 public function setLevels($a_val, $a_keep_existing =
false)
142 if (!$a_keep_existing) {
143 $this->levels = $a_val;
145 if (is_array($a_val)) {
146 foreach ($a_val as $k => $v) {
147 $this->levels[$k] = $v;
160 return $this->levels;
174 "SELECT * FROM skl_self_eval WHERE " .
175 " id = " .
$ilDB->quote($this->getId(),
"integer")
177 if ($rec =
$ilDB->fetchAssoc($set)) {
186 "SELECT * FROM skl_self_eval_level WHERE " .
187 " self_eval_id = " .
$ilDB->quote($this->getId(),
"integer")
190 while ($rec =
$ilDB->fetchAssoc($set)) {
191 $levels[$rec[
"skill_id"]] = $rec[
"level_id"];
205 $ilDB->manipulate(
"INSERT INTO skl_self_eval " .
206 "(id, user_id, top_skill_id, created, last_update) VALUES (" .
207 $ilDB->quote($this->getId(),
"integer") .
"," .
208 $ilDB->quote($this->getUserId(),
"integer") .
"," .
209 $ilDB->quote($this->getTopSkillId(),
"integer") .
"," .
215 if (is_array($levels)) {
216 foreach ($levels as $skill_id => $level_id) {
217 $ilDB->manipulate(
"INSERT INTO skl_self_eval_level " .
218 "(self_eval_id, skill_id, level_id) VALUES (" .
219 $ilDB->quote($this->getId(),
"integer") .
"," .
220 $ilDB->quote($skill_id,
"integer") .
"," .
221 $ilDB->quote($level_id,
"integer") .
235 "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")
243 "DELETE FROM skl_self_eval_level WHERE " 244 .
" self_eval_id = " .
$ilDB->quote($this->getId(),
"integer")
248 if (is_array($levels)) {
249 foreach ($levels as $skill_id => $level_id) {
250 $ilDB->manipulate(
"INSERT INTO skl_self_eval_level " .
251 "(self_eval_id, skill_id, level_id) VALUES (" .
252 $ilDB->quote($this->getId(),
"integer") .
"," .
253 $ilDB->quote($skill_id,
"integer") .
"," .
254 $ilDB->quote($level_id,
"integer") .
263 public function delete()
268 "DELETE FROM skl_self_eval WHERE " 269 .
" id = " .
$ilDB->quote($this->getId(),
"integer")
273 "DELETE FROM skl_self_eval_level WHERE " 274 .
" self_eval_id = " .
$ilDB->quote($this->getId(),
"integer")
285 $ilDB = $DIC->database();
288 "SELECT * FROM skl_self_eval WHERE user_id = " .
289 $ilDB->quote($a_user,
"integer") .
" " .
290 "ORDER BY last_update DESC" 293 $self_evaluation = array();
295 $top_skills = array();
296 while ($rec =
$ilDB->fetchAssoc($set)) {
297 if (!$a_one_per_top_skill || !in_array($rec[
"top_skill_id"], $top_skills)) {
298 $self_evaluation[] = $rec;
299 $top_skills[] = $rec[
"top_skill_id"];
303 return $self_evaluation;
316 $ilDB = $DIC->database();
319 "SELECT $a_prop FROM skl_self_eval WHERE " .
320 " id = " .
$ilDB->quote($a_id,
"integer")
322 $rec =
$ilDB->fetchAssoc($set);
323 return $rec[$a_prop];
336 $lng = $DIC->language();
338 $lng->loadLanguageModule(
"skmg");
340 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
341 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
345 if ($stree->isInTree($a_top_skill_id)) {
347 $levels = $se->getLevels();
349 $cnode = $stree->getNodeData($a_top_skill_id);
350 $childs = $stree->getSubTree($cnode);
352 foreach ($childs as $child) {
353 if ($child[
"type"] ==
"skll") {
355 $ls = $sk->getLevelData();
357 foreach ($ls as $k =>
$l) {
358 $ord[
$l[
"id"]] = $k + 1;
361 foreach ($ls as
$ld) {
362 if ($ld[
"id"] == $levels[$child[
"child"]]) {
363 $sum += $ord[$ld[
"id"]];
371 $avg = round($sum / $cnt);
373 return (array(
"skill_title" => $cnode[
"title"],
374 "ord" => $avg,
"avg_title" => $ls[$avg - 1][
"title"]));
376 return (array(
"skill_title" => $cnode[
"title"],
377 "ord" => $avg,
"avg_title" =>
$lng->txt(
"skmg_no_skills")));
393 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
394 include_once(
"./Services/Skill/classes/class.ilSkillSelfEvalSkillTableGUI.php");
397 if ($stree->isInTree($a_sn_id)) {
398 $cnode = $stree->getNodeData($a_sn_id);
399 $childs = $stree->getSubTree($cnode);
400 foreach ($childs as $child) {
401 if ($child[
"type"] ==
"skll") {
402 $steps[] = $child[
"child"];
static determineSteps($a_sn_id)
Determine steps.
setUserId($a_val)
Set user id.
static getAverageLevel($a_se_id, $a_user_id, $a_top_skill_id)
Get average level of user self evaluation.
static getAllSelfEvaluationsOfUser($a_user, $a_one_per_top_skill=false)
Get all self evaluations.
__construct($a_id=0)
Constructor.
if(!array_key_exists('StateId', $_REQUEST)) $id
getCreated()
Get created at.
getLastUpdate()
Get last update.
setLevels($a_val, $a_keep_existing=false)
Set level.
setTopSkillId($a_val)
Set top skill id.
Self evaluation application class.
create()
Create self evaluation.
static lookupProperty($a_id, $a_prop)
Lookup property.
getTopSkillId()
Get top skill id.
update()
Update self evaluation.
setLastUpdate($a_val)
Set last update.
setCreated($a_val)
Set created at.