ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSkillRootGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30{
31 protected ilCtrl $ctrl;
33 protected ilTabsGUI $tabs;
35 protected ilLanguage $lng;
36
37 public function __construct(Node\SkillTreeNodeManager $node_manager, int $a_node_id = 0)
38 {
39 global $DIC;
40
41 $this->ctrl = $DIC->ctrl();
42 $this->tpl = $DIC["tpl"];
43 $this->tabs = $DIC->tabs();
44 $this->toolbar = $DIC->toolbar();
45 $this->lng = $DIC->language();
46 $ilCtrl = $DIC->ctrl();
47
48 $ilCtrl->saveParameter($this, "node_id");
49
50 parent::__construct($node_manager, $a_node_id);
51 }
52
53 public function getType(): string
54 {
55 return "skrt";
56 }
57
58 public function executeCommand(): void
59 {
60 $ilCtrl = $this->ctrl;
62 $ilTabs = $this->tabs;
63
64 $next_class = $ilCtrl->getNextClass($this);
65 $cmd = $ilCtrl->getCmd();
66
67 switch ($next_class) {
68 default:
69 $ret = $this->$cmd();
70 break;
71 }
72 }
73
74 public function listTemplates(): void
75 {
77 $ilToolbar = $this->toolbar;
78 $ilCtrl = $this->ctrl;
80 $ilTabs = $this->tabs;
81
82 $skmg_set = new ilSetting("skmg");
83 $enable_skmg = $skmg_set->get("enable_skmg");
84 if (!$enable_skmg) {
85 $this->tpl->setOnScreenMessage('info', $lng->txt("skmg_skill_management_deactivated"));
86 }
87
88 $this->getParentGUI()->showTree(true, $this, "listTemplates");
89 $ilTabs->activateTab("skill_templates");
90
91 if ($this->tree_access_manager->hasManageCompetenceTemplatesPermission()) {
93 }
94
95 $table = new ilSkillCatTableGUI(
96 $this,
97 "listTemplates",
98 $this->requested_node_id,
100 );
101
102 $tpl->setContent($table->getHTML());
103 }
104
105 public function listSkills(): void
106 {
108 $ilToolbar = $this->toolbar;
109 $ilCtrl = $this->ctrl;
111 $ilTabs = $this->tabs;
112
113 $skmg_set = new ilSetting("skmg");
114 $enable_skmg = $skmg_set->get("enable_skmg");
115 if (!$enable_skmg) {
116 $this->tpl->setOnScreenMessage('info', $lng->txt("skmg_skill_management_deactivated"));
117 }
118
119 $this->getParentGUI()->showTree(false, $this, "listSkills");
120 $ilTabs->activateTab("skills");
121
122 if ($this->tree_access_manager->hasManageCompetencesPermission()) {
124 }
125
126 $table = new ilSkillCatTableGUI(
127 $this,
128 "listSkills",
129 $this->requested_node_id,
131 );
132
133 $tpl->setContent($table->getHTML());
134 }
135
136 public function cancelDelete(): void
137 {
138 $ilCtrl = $this->ctrl;
139
140 if ($this->requested_tmpmode) {
141 $ilCtrl->redirect($this, "listTemplates");
142 } else {
143 $ilCtrl->redirect($this, "listSkills");
144 }
145 }
146
147 public function showImportForm(): void
148 {
150 $ilTabs = $this->tabs;
153
154 $ilTabs->setBackTarget(
155 $lng->txt("back"),
156 $ctrl->getLinkTarget($this, "listSkills")
157 );
158
159 $ilTabs->activateTab("skills");
160 $tpl->setContent($this->initInputForm()->getHTML());
161 }
162
164 {
166 $ilCtrl = $this->ctrl;
167
168 $form = new ilPropertyFormGUI();
169
170 $fi = new ilFileInputGUI($lng->txt("skmg_input_file"), "import_file");
171 $fi->setSuffixes(array("zip"));
172 $fi->setRequired(true);
173 $form->addItem($fi);
174
175 // save and cancel commands
176 $form->addCommandButton("importSkills", $lng->txt("import"));
177 $form->addCommandButton("listSkills", $lng->txt("cancel"));
178
179 $form->setTitle($lng->txt("skmg_import_skills"));
180 $form->setFormAction($ilCtrl->getFormAction($this));
181
182 return $form;
183 }
184
185 public function importSkills(): void
186 {
189 $ilCtrl = $this->ctrl;
190 $ilTabs = $this->tabs;
191
192 $form = $this->initInputForm();
193 if ($form->checkInput()) {
194 $imp = new ilImport();
195 $conf = $imp->getConfig("components/ILIAS/Skill");
196 $conf->setSkillTreeId($this->skill_tree_id);
197 $imp->importEntity($_FILES["import_file"]["tmp_name"], $_FILES["import_file"]["name"], "skmg", "components/ILIAS/Skill");
198
199 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
200 $ilCtrl->redirect($this, "listSkills");
201 } else {
202 $ilTabs->activateTab("skills");
205 }
206 }
207}
Class ilCtrl provides processing control methods.
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
This class represents a file property in a property form.
setFormAction(string $a_formaction)
Import class.
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="")
ILIAS Setting Class.
Skill root GUI class.
__construct(Node\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...
setContent(string $a_html)
Sets content for standard template.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26