ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilGlobalSkillTree.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
29{
33
34 public function __construct()
35 {
36 global $DIC;
37
39 $this->skill_tree_manager = $DIC->skills()->internal()->manager()->getTreeManager();
40 $this->skill_tree_factory = $DIC->skills()->internal()->factory()->tree();
41 $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
42 }
43
47 public function getNodeData(int $a_node_id, ?int $a_tree_pk = null): array
48 {
49 if ($a_node_id == 0) {
50 return $this->getRootNode();
51 }
52 return parent::getNodeData($a_node_id, $a_tree_pk);
53 }
54
58 public function getRootNode(): array
59 {
60 $root_node = [];
61
62 $root_node["parent"] = 0;
63 $root_node["depth"] = 0;
64 $root_node["obj_id"] = 0;
65 $root_node["child"] = 0;
66
67 return $root_node;
68 }
69
70 public function readRootId(): int
71 {
72 return 0;
73 }
74
78 public function getChilds(int $a_node_id, string $a_order = "", string $a_direction = "ASC"): array
79 {
80 if ($a_node_id == 0) {
81 $childs = [];
82 $trees = $this->skill_tree_manager->getTrees();
83 foreach ($trees as $obj_tree) {
84 $tree = $this->skill_tree_factory->getTreeById($obj_tree->getId());
85 $data = $tree->getNodeData($tree->readRootId());
86 $data["id"] = $data["child"];
87 $childs[] = $data;
88 }
89 return $childs;
90 } else {
91 return parent::getChilds($a_node_id, $a_order, $a_direction);
92 }
93 }
94}
SkillTreeManager $skill_tree_manager
SkillTreeFactory $skill_tree_factory
ilSkillTreeRepository $tree_repo
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
Interface ilSkillTreeRepository.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26