19 declare(strict_types=1);
35 protected \ilLanguage
$lng;
49 $this->
ctrl = $DIC->ctrl();
50 $this->error = $DIC[
"ilErr"];
51 $this->
lng = $DIC->language();
54 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
57 $this->requested_ref_id = $this->admin_gui_request->getRefId();
59 $this->tree_access_manager = $DIC->skills()->internal()->manager()->getTreeAccessManager($this->requested_ref_id);
60 $this->management_access_manager = $DIC->skills()->internal()->manager()->getManagementAccessManager($this->requested_ref_id);
63 public function createTree(
string $title,
string $description): void
65 if (!$this->management_access_manager->hasCreateTreePermission()) {
66 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
68 $tree_obj = new \ilObjSkillTree();
69 $tree_obj->setTitle($title);
70 $tree_obj->setDescription($description);
72 $tree_obj->createReference();
76 $tree = $this->tree_factory->getTreeById($tree_obj->getId());
77 $root_node = new \ilSkillRoot();
78 $root_node->setTitle(
"Skill Tree Root Node");
80 $tree->addTree($tree_obj->getId(), $root_node->getId());
81 $this->
ctrl->setParameterByClass(
"ilobjskilltreegui",
"ref_id", $tree_obj->getRefId());
82 $this->
ctrl->setParameterByClass(
"ilobjskilltreegui",
"node_id", $tree->readRootId());
87 if (!$this->tree_access_manager->hasEditTreeSettingsPermission()) {
88 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
97 if (!$this->management_access_manager->hasCreateTreePermission()) {
98 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
105 foreach ($this->repository_tree->getChilds($this->getSkillManagementRefId()) as
$c) {
106 if ($c[
"type"] ==
"skee") {
107 yield new \ilObjSkillTree((
int) $c[
"child"]);
115 return new \ilObjSkillTree(
$ref_id);
123 if (isset($this->skmg_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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
static _getObjectsByType(string $obj_type="", int $owner=null)
SkillTreeFactory $tree_factory
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
updateTree(\ilObjSkillTree $tree_obj, string $title, string $description)
SkillTreeAccess $tree_access_manager
SkillManagementAccess $management_access_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setDescription(string $description)
__construct(\ilTree $repository_tree, SkillTreeFactory $tree_factory)