ILIAS  release_8 Revision v8.24
class.ilSkillRootGUI.php
Go to the documentation of this file.
1<?php
2
21
29{
30 protected ilCtrl $ctrl;
32 protected ilTabsGUI $tabs;
34 protected ilLanguage $lng;
35
36 public function __construct(Tree\SkillTreeNodeManager $node_manager, int $a_node_id = 0)
37 {
38 global $DIC;
39
40 $this->ctrl = $DIC->ctrl();
41 $this->tpl = $DIC["tpl"];
42 $this->tabs = $DIC->tabs();
43 $this->toolbar = $DIC->toolbar();
44 $this->lng = $DIC->language();
45 $ilCtrl = $DIC->ctrl();
46
47 $ilCtrl->saveParameter($this, "node_id");
48
49 parent::__construct($node_manager, $a_node_id);
50 }
51
52 public function getType(): string
53 {
54 return "skrt";
55 }
56
57 public function executeCommand(): void
58 {
59 $ilCtrl = $this->ctrl;
61 $ilTabs = $this->tabs;
62
63 $next_class = $ilCtrl->getNextClass($this);
64 $cmd = $ilCtrl->getCmd();
65
66 switch ($next_class) {
67 default:
68 $ret = $this->$cmd();
69 break;
70 }
71 }
72
73 public function listTemplates(): void
74 {
76 $ilToolbar = $this->toolbar;
77 $ilCtrl = $this->ctrl;
79 $ilTabs = $this->tabs;
80
81 $skmg_set = new ilSetting("skmg");
82 $enable_skmg = $skmg_set->get("enable_skmg");
83 if (!$enable_skmg) {
84 $this->tpl->setOnScreenMessage('info', $lng->txt("skmg_skill_management_deactivated"));
85 }
86
87 $this->getParentGUI()->showTree(true, $this, "listTemplates");
88 $ilTabs->activateTab("skill_templates");
89
90 if ($this->tree_access_manager->hasManageCompetenceTemplatesPermission()) {
92 }
93
94 $table = new ilSkillCatTableGUI(
95 $this,
96 "listTemplates",
97 $this->requested_node_id,
99 );
100
101 $tpl->setContent($table->getHTML());
102 }
103
104 public function listSkills(): void
105 {
107 $ilToolbar = $this->toolbar;
108 $ilCtrl = $this->ctrl;
110 $ilTabs = $this->tabs;
111
112 $skmg_set = new ilSetting("skmg");
113 $enable_skmg = $skmg_set->get("enable_skmg");
114 if (!$enable_skmg) {
115 $this->tpl->setOnScreenMessage('info', $lng->txt("skmg_skill_management_deactivated"));
116 }
117
118 $this->getParentGUI()->showTree(false, $this, "listSkills");
119 $ilTabs->activateTab("skills");
120
121 if ($this->tree_access_manager->hasManageCompetencesPermission()) {
123 }
124
125 $table = new ilSkillCatTableGUI(
126 $this,
127 "listSkills",
128 $this->requested_node_id,
130 );
131
132 $tpl->setContent($table->getHTML());
133 }
134
135 public function cancelDelete(): void
136 {
137 $ilCtrl = $this->ctrl;
138
139 if ($this->requested_tmpmode) {
140 $ilCtrl->redirect($this, "listTemplates");
141 } else {
142 $ilCtrl->redirect($this, "listSkills");
143 }
144 }
145
146 public function showImportForm(): void
147 {
149 $ilTabs = $this->tabs;
152
153 $ilTabs->setBackTarget(
154 $lng->txt("back"),
155 $ctrl->getLinkTarget($this, "listSkills")
156 );
157
158 $ilTabs->activateTab("skills");
159 $tpl->setContent($this->initInputForm()->getHTML());
160 }
161
163 {
165 $ilCtrl = $this->ctrl;
166
167 $form = new ilPropertyFormGUI();
168
169 $fi = new ilFileInputGUI($lng->txt("skmg_input_file"), "import_file");
170 $fi->setSuffixes(array("zip"));
171 $fi->setRequired(true);
172 $form->addItem($fi);
173
174 // save and cancel commands
175 $form->addCommandButton("importSkills", $lng->txt("import"));
176 $form->addCommandButton("listSkills", $lng->txt("cancel"));
177
178 $form->setTitle($lng->txt("skmg_import_skills"));
179 $form->setFormAction($ilCtrl->getFormAction($this));
180
181 return $form;
182 }
183
184 public function importSkills(): void
185 {
188 $ilCtrl = $this->ctrl;
189 $ilTabs = $this->tabs;
190
191 $form = $this->initInputForm();
192 if ($form->checkInput()) {
193 $imp = new ilImport();
194 $conf = $imp->getConfig("Services/Skill");
195 $conf->setSkillTreeId($this->skill_tree_id);
196 $imp->importEntity($_FILES["import_file"]["tmp_name"], $_FILES["import_file"]["name"], "skmg", "Services/Skill");
197
198 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
199 $ilCtrl->redirect($this, "listSkills");
200 } else {
201 $ilTabs->activateTab("skills");
204 }
205 }
206}
Class ilCtrl provides processing control methods.
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
This class represents a file property in a property form.
setFormAction(string $a_formaction)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
language handling
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 class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Skill root GUI class.
__construct(Tree\SkillTreeNodeManager $node_manager, int $a_node_id=0)
ilGlobalTemplateInterface $tpl
Basic GUI class for skill tree nodes.
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...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...