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