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