ILIAS  release_8 Revision v8.24
class.SkillTreeTableGUI.php
Go to the documentation of this file.
1<?php
2
20namespace ILIAS\Skill\Tree;
21
26
33{
38 protected UIServices $ui;
40 protected int $requested_ref_id = 0;
41
42 public function __construct(object $a_parent_obj, string $a_parent_cmd, SkillInternalManagerService $manager)
43 {
44 global $DIC;
45
46 $this->id = "";
47 $this->lng = $DIC->language();
48 $this->ctrl = $DIC->ctrl();
49 $this->ui = $DIC->ui();
50
51 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
52 $this->requested_ref_id = $this->admin_gui_request->getRefId();
53
54 $this->internal_manager = $manager;
55 $this->tree_manager = $this->internal_manager->getTreeManager();
56 $this->management_access_manager = $this->internal_manager->getManagementAccessManager($this->requested_ref_id);
57 $this->tree_factory = $DIC->skills()->internal()->factory()->tree();
58
59 parent::__construct($a_parent_obj, $a_parent_cmd);
60
61 $this->setData($this->getItems());
62 $this->setTitle($this->lng->txt(""));
63
64 if ($this->management_access_manager->hasCreateTreePermission()) {
65 $this->addColumn("", "", "1", true);
66 }
67 $this->addColumn($this->lng->txt("title"), "title");
68 $this->addColumn($this->lng->txt("actions"));
69
70 $this->setFormAction($this->ctrl->getFormActionByClass("ilobjskilltreegui"));
71 $this->setRowTemplate("tpl.skill_tree_row.html", "Services/Skill/Tree");
72
73 if ($this->management_access_manager->hasCreateTreePermission()) {
74 $this->addMultiCommand("delete", $this->lng->txt("delete"));
75 }
76 }
77
81 protected function getItems(): array
82 {
83 return array_filter(array_map(
84 function (\ilObjSkillTree $skillTree): array {
85 $tree_access_manager = $this->internal_manager->getTreeAccessManager($skillTree->getRefId());
86 if ($tree_access_manager->hasVisibleTreePermission()) {
87 return [
88 "title" => $skillTree->getTitle(),
89 "tree" => $skillTree
90 ];
91 }
92 return [];
93 },
94 iterator_to_array($this->tree_manager->getTrees())
95 ));
96 }
97
101 protected function fillRow(array $a_set): void
102 {
106
107 $tree_obj = $a_set["tree"];
108 $tree = $this->tree_factory->getTreeById($tree_obj->getId());
109
110 if ($this->management_access_manager->hasCreateTreePermission()) {
111 $tpl->setCurrentBlock("checkbox");
112 $tpl->setVariable("ID", $tree->readRootId());
113 $tpl->parseCurrentBlock();
114 }
115 $tpl->setVariable("TITLE", $tree_obj->getTitle());
116
117 // action
118 $ctrl->setParameterByClass("ilobjskilltreegui", "ref_id", $tree_obj->getRefId());
119 $tpl->setVariable("TXT_CMD", $lng->txt("edit"));
120 $tpl->setVariable("HREF_CMD", $ctrl->getLinkTargetByClass("ilobjskilltreegui", "editSkills"));
121 }
122}
Provides fluid interface to RBAC services.
Definition: UIServices.php:24
Request wrapper for guis in skill administration.
__construct(object $a_parent_obj, string $a_parent_cmd, SkillInternalManagerService $manager)
SkillInternalManagerService $internal_manager
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
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...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
ilLanguage $lng
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...