ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSkillTreeNodeFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 public static function getInstance(int $a_id = 0): ilSkillTreeNode
29 {
30 global $DIC;
31
32 $ilDB = $DIC->database();
33
34 $query = "SELECT * FROM skl_tree_node WHERE obj_id = " .
35 $ilDB->quote($a_id, "integer");
36 $obj_set = $ilDB->query($query);
37 $obj_rec = $ilDB->fetchAssoc($obj_set);
38 $obj_id = (int) $obj_rec["obj_id"];
39 $obj = null;
40
41 switch ($obj_rec["type"]) {
42 case "skll":
43 $obj = new ilBasicSkill();
44 $obj->setId($obj_id);
45 $obj->setDataRecord($obj_rec);
46 $obj->read();
47 break;
48
49 case "scat":
50 $obj = new ilSkillCategory();
51 $obj->setId($obj_id);
52 $obj->setDataRecord($obj_rec);
53 $obj->read();
54 break;
55
56 case "sktp":
57 $obj = new ilBasicSkillTemplate();
58 $obj->setId($obj_id);
59 $obj->setDataRecord($obj_rec);
60 $obj->read();
61 break;
62
63 case "sctp":
64 $obj = new ilSkillTemplateCategory();
65 $obj->setId($obj_id);
66 $obj->setDataRecord($obj_rec);
67 $obj->read();
68 break;
69
70 case "skrt":
71 $obj = new ilSkillRoot();
72 $obj->setId($obj_id);
73 $obj->setDataRecord($obj_rec);
74 $obj->read();
75 break;
76
77 case "sktr":
78 $obj = new ilSkillTemplateReference();
79 $obj->setId($obj_id);
80 $obj->setDataRecord($obj_rec);
81 $obj->read();
82 break;
83 }
84 return $obj;
85 }
86}
Skill root node.
Factory for skill tree nodes.
A node in the skill tree.
global $DIC
Definition: shib_login.php:26