ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
5 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
6 include_once("./Services/Skill/classes/class.ilSkillCategory.php");
7 include_once("./Services/Skill/classes/class.ilSkillRoot.php");
8 include_once("./Services/Skill/classes/class.ilBasicSkillTemplate.php");
9 include_once("./Services/Skill/classes/class.ilSkillTemplateCategory.php");
10 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
11 
21 {
22  static function getInstance($a_id = 0)
23  {
24  global $ilias, $ilDB;
25 
26  $query = "SELECT * FROM skl_tree_node WHERE obj_id = ".
27  $ilDB->quote($a_id, "integer");
28  $obj_set = $ilDB->query($query);
29  $obj_rec = $ilDB->fetchAssoc($obj_set);
30  $obj = null;
31 
32  switch($obj_rec["type"])
33  {
34  case "skll":
35  $obj = new ilBasicSkill();
36  $obj->setId($obj_rec["obj_id"]);
37  $obj->setDataRecord($obj_rec);
38  $obj->read();
39  break;
40 
41  case "scat":
42  $obj = new ilSkillCategory();
43  $obj->setId($obj_rec["obj_id"]);
44  $obj->setDataRecord($obj_rec);
45  $obj->read();
46  break;
47 
48  case "sktp":
49  $obj = new ilBasicSkillTemplate();
50  $obj->setId($obj_rec["obj_id"]);
51  $obj->setDataRecord($obj_rec);
52  $obj->read();
53  break;
54 
55  case "sctp":
56  $obj = new ilSkillTemplateCategory();
57  $obj->setId($obj_rec["obj_id"]);
58  $obj->setDataRecord($obj_rec);
59  $obj->read();
60  break;
61 
62  case "skrt":
63  $obj = new ilSkillRoot();
64  $obj->setId($obj_rec["obj_id"]);
65  $obj->setDataRecord($obj_rec);
66  $obj->read();
67  break;
68 
69  case "sktr":
70  $obj = new ilSkillTemplateReference();
71  $obj->setId($obj_rec["obj_id"]);
72  $obj->setDataRecord($obj_rec);
73  $obj->read();
74  break;
75  }
76  return $obj;
77  }
78 
79 }
80 ?>