19 declare(strict_types=1);
35 protected \ilLanguage
$lng;
51 $this->
ctrl = $DIC->ctrl();
52 $this->error = $DIC[
"ilErr"];
53 $this->
lng = $DIC->language();
57 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
60 $this->requested_ref_id = $this->admin_gui_request->getRefId();
62 $this->tree_access_manager = $DIC->skills()->internal()->manager()->getTreeAccessManager($this->requested_ref_id);
63 $this->management_access_manager = $DIC->skills()->internal()->manager()->getManagementAccessManager($this->requested_ref_id);
66 public function createTree(
string $title,
string $description): void
68 if (!$this->management_access_manager->hasCreateTreePermission()) {
69 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
71 $tree_obj = new \ilObjSkillTree();
72 $tree_obj->setTitle($title);
73 $tree_obj->setDescription($description);
75 $tree_obj->createReference();
76 $tree_obj->putInTree($this->skmg_ref_id);
77 $tree_obj->setPermissions($this->skmg_ref_id);
79 $tree = $this->tree_factory->getTreeById($tree_obj->getId());
80 $root_node = new \ilSkillRoot();
81 $root_node->setTitle(
"Skill Tree Root Node");
83 $tree->addTree($tree_obj->getId(), $root_node->getId());
84 $this->
ctrl->setParameterByClass(
"ilobjskilltreegui",
"ref_id", $tree_obj->getRefId());
85 $this->
ctrl->setParameterByClass(
"ilobjskilltreegui",
"node_id", $tree->readRootId());
90 if (!$this->tree_access_manager->hasEditTreeSettingsPermission()) {
91 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
100 if (!$this->management_access_manager->hasCreateTreePermission()) {
101 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
108 foreach ($this->repository_tree->getChilds($this->skmg_ref_id) as
$c) {
109 if (
$c[
"type"] ==
"skee") {
110 yield new \ilObjSkillTree((
int)
$c[
"child"]);
118 return new \ilObjSkillTree(
$ref_id);
delete()
delete object or referenced object (in the case of a referenced object, object data is only deleted i...
SkillAdminGUIRequest $admin_gui_request
Skill tree object in skill management (repository object class)
createTree(string $title, string $description)
getSkillManagementRefId()
Get ref id of skill management administration node.
Request wrapper for guis in skill administration.
static _getAllReferences(int $id)
get all reference ids for object ID
deleteTree(\ilObjSkillTree $tree_obj)
SkillTreeFactory $tree_factory
__construct(int $skmg_ref_id, \ilTree $repository_tree, SkillTreeFactory $tree_factory)
updateTree(\ilObjSkillTree $tree_obj, string $title, string $description)
SkillTreeAccess $tree_access_manager
SkillManagementAccess $management_access_manager
setDescription(string $description)