ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.SkillTreeService.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Skill\Service;
22 
26 
32 {
36 
37  public function __construct(SkillInternalService $internal_service)
38  {
39  $this->tree_repo = $internal_service->repo()->getTreeRepo();
40  $this->tree_factory = $internal_service->factory()->tree();
41  $this->tree_manager = $internal_service->manager()->getTreeManager();
42  }
43 
45  {
46  $tree = $this->tree_factory->getGlobalTree();
47 
48  return $tree;
49  }
50 
51  public function getSkillTreeById(int $tree_id): \ilSkillTree
52  {
53  $tree = $this->tree_factory->getTreeById($tree_id);
54 
55  return $tree;
56  }
57 
58  public function getSkillTreeForNodeId(int $node_id): \ilSkillTree
59  {
60  $tree = $this->tree_repo->getTreeForNodeId($node_id);
61 
62  return $tree;
63  }
64 
66  {
67  $vtree = $this->tree_factory->getGlobalVirtualTree();
68 
69  return $vtree;
70  }
71 
72  public function getVirtualSkillTreeById(int $tree_id): \ilVirtualSkillTree
73  {
74  $vtree = $this->tree_factory->getVirtualTreeById($tree_id);
75 
76  return $vtree;
77  }
78 
79  public function getVirtualSkillTreeForNodeId(int $node_id): \ilVirtualSkillTree
80  {
81  $vtree = $this->tree_repo->getVirtualTreeForNodeId($node_id);
82 
83  return $vtree;
84  }
85 
89  public function getSkillTreePath(int $base_skill_id, int $tref_id = 0): array
90  {
91  $tree = $this->tree_repo->getTreeForNodeId($base_skill_id);
92  $path = $tree->getSkillTreePath($base_skill_id, $tref_id);
93 
94  return $path;
95  }
96 
97  public function getObjSkillTreeById(int $tree_id): \ilObjSkillTree
98  {
99  $obj_tree = $this->tree_manager->getTree($tree_id);
100 
101  return $obj_tree;
102  }
103 
107  public function getObjSkillTrees(): array
108  {
109  $obj_trees = iterator_to_array($this->tree_manager->getTrees());
110 
111  return $obj_trees;
112  }
113 }
Skill tree object in skill management (repository object class)
Skill tree.
$path
Definition: ltiservices.php:29
__construct(SkillInternalService $internal_service)
getSkillTreePath(int $base_skill_id, int $tref_id=0)