ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilSkillTreeNodeFactory.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
28 {
29  public static function getInstance(int $a_id = 0): ilSkillTreeNode
30  {
31  global $DIC;
32 
33  $ilDB = $DIC->database();
34 
35  $query = "SELECT * FROM skl_tree_node WHERE obj_id = " .
36  $ilDB->quote($a_id, "integer");
37  $obj_set = $ilDB->query($query);
38  $obj_rec = $ilDB->fetchAssoc($obj_set);
39  $obj_id = (int) $obj_rec["obj_id"];
40  $obj = null;
41 
42  switch ($obj_rec["type"]) {
43  case "skll":
44  $obj = new ilBasicSkill();
45  $obj->setId($obj_id);
46  $obj->setDataRecord($obj_rec);
47  $obj->read();
48  break;
49 
50  case "scat":
51  $obj = new ilSkillCategory();
52  $obj->setId($obj_id);
53  $obj->setDataRecord($obj_rec);
54  $obj->read();
55  break;
56 
57  case "sktp":
58  $obj = new ilBasicSkillTemplate();
59  $obj->setId($obj_id);
60  $obj->setDataRecord($obj_rec);
61  $obj->read();
62  break;
63 
64  case "sctp":
65  $obj = new ilSkillTemplateCategory();
66  $obj->setId($obj_id);
67  $obj->setDataRecord($obj_rec);
68  $obj->read();
69  break;
70 
71  case "skrt":
72  $obj = new ilSkillRoot();
73  $obj->setId($obj_id);
74  $obj->setDataRecord($obj_rec);
75  $obj->read();
76  break;
77 
78  case "sktr":
79  $obj = new ilSkillTemplateReference();
80  $obj->setId($obj_id);
81  $obj->setDataRecord($obj_rec);
82  $obj->read();
83  break;
84  }
85  return $obj;
86  }
87 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:25
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Basic Skill.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...