ILIAS  release_8 Revision v8.24
class.ilGlobalSkillTree.php
Go to the documentation of this file.
1<?php
2
22
28{
32
33 public function __construct()
34 {
35 global $DIC;
36
38 $this->skill_tree_manager = $DIC->skills()->internal()->manager()->getTreeManager();
39 $this->skill_tree_factory = $DIC->skills()->internal()->factory()->tree();
40 $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
41 }
42
46 public function getNodeData(int $a_node_id, ?int $a_tree_pk = null): array
47 {
48 if ($a_node_id == 0) {
49 return $this->getRootNode();
50 }
51 return parent::getNodeData($a_node_id, $a_tree_pk);
52 }
53
57 public function getRootNode(): array
58 {
59 $root_node = [];
60
61 $root_node["parent"] = 0;
62 $root_node["depth"] = 0;
63 $root_node["obj_id"] = 0;
64 $root_node["child"] = 0;
65
66 return $root_node;
67 }
68
69 public function readRootId(): int
70 {
71 return 0;
72 }
73
77 public function getChilds(int $a_node_id, string $a_order = "", string $a_direction = "ASC"): array
78 {
79 if ($a_node_id == 0) {
80 $childs = [];
81 $trees = $this->skill_tree_manager->getTrees();
82 foreach ($trees as $obj_tree) {
83 $tree = $this->skill_tree_factory->getTreeById($obj_tree->getId());
84 $data = $tree->getNodeData($tree->readRootId());
85 $data["id"] = $data["child"];
86 $childs[] = $data;
87 }
88 return $childs;
89 } else {
90 return parent::getChilds($a_node_id, $a_order, $a_direction);
91 }
92 }
93}
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
Interface ilSkillTreeRepository.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc