ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSkillTreeNodeFactory.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
12 public static function getInstance($a_id = 0)
13 {
14 global $DIC;
15
16 $ilDB = $DIC->database();
17
18 $query = "SELECT * FROM skl_tree_node WHERE obj_id = " .
19 $ilDB->quote($a_id, "integer");
20 $obj_set = $ilDB->query($query);
21 $obj_rec = $ilDB->fetchAssoc($obj_set);
22 $obj = null;
23
24 switch ($obj_rec["type"]) {
25 case "skll":
26 $obj = new ilBasicSkill();
27 $obj->setId($obj_rec["obj_id"]);
28 $obj->setDataRecord($obj_rec);
29 $obj->read();
30 break;
31
32 case "scat":
33 $obj = new ilSkillCategory();
34 $obj->setId($obj_rec["obj_id"]);
35 $obj->setDataRecord($obj_rec);
36 $obj->read();
37 break;
38
39 case "sktp":
40 $obj = new ilBasicSkillTemplate();
41 $obj->setId($obj_rec["obj_id"]);
42 $obj->setDataRecord($obj_rec);
43 $obj->read();
44 break;
45
46 case "sctp":
47 $obj = new ilSkillTemplateCategory();
48 $obj->setId($obj_rec["obj_id"]);
49 $obj->setDataRecord($obj_rec);
50 $obj->read();
51 break;
52
53 case "skrt":
54 $obj = new ilSkillRoot();
55 $obj->setId($obj_rec["obj_id"]);
56 $obj->setDataRecord($obj_rec);
57 $obj->read();
58 break;
59
60 case "sktr":
61 $obj = new ilSkillTemplateReference();
62 $obj->setId($obj_rec["obj_id"]);
63 $obj->setDataRecord($obj_rec);
64 $obj->read();
65 break;
66 }
67 return $obj;
68 }
69}
An exception for terminatinating execution or to throw for unit testing.
Skill root node.
Factory for skill tree nodes.
global $DIC
Definition: goto.php:24
$query
global $ilDB