ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSkillRootGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
16 protected $ctrl;
17
21 protected $tpl;
22
26 protected $tabs;
27
31 protected $toolbar;
32
36 protected $lng;
37
38
42 public function __construct($a_node_id = 0)
43 {
44 global $DIC;
45
46 $this->ctrl = $DIC->ctrl();
47 $this->tpl = $DIC["tpl"];
48 $this->tabs = $DIC->tabs();
49 $this->toolbar = $DIC->toolbar();
50 $this->lng = $DIC->language();
51 $ilCtrl = $DIC->ctrl();
52
53 $ilCtrl->saveParameter($this, "obj_id");
54
55 parent::__construct($a_node_id);
56 }
57
61 public function getType()
62 {
63 return "skrt";
64 }
65
69 public function executeCommand()
70 {
71 $ilCtrl = $this->ctrl;
73 $ilTabs = $this->tabs;
74
75 $next_class = $ilCtrl->getNextClass($this);
76 $cmd = $ilCtrl->getCmd();
77
78 switch ($next_class) {
79 default:
80 $ret = $this->$cmd();
81 break;
82 }
83 }
84
88 public function listTemplates()
89 {
91 $ilToolbar = $this->toolbar;
92 $ilCtrl = $this->ctrl;
94 $ilTabs = $this->tabs;
95
96 $skmg_set = new ilSetting("skmg");
97 $enable_skmg = $skmg_set->get("enable_skmg");
98 if (!$enable_skmg) {
99 ilUtil::sendInfo($lng->txt("skmg_skill_management_deactivated"));
100 }
101
102 $this->getParentGUI()->showTree(true, $this, "listTemplates");
103 $ilTabs->activateTab("skill_templates");
104
105 if ($this->checkPermissionBool("write")) {
107 }
108
109 $table = new ilSkillCatTableGUI(
110 $this,
111 "listTemplates",
112 (int) $_GET["obj_id"],
114 );
115
116 $tpl->setContent($table->getHTML());
117 }
118
122 public function listSkills()
123 {
125 $ilToolbar = $this->toolbar;
126 $ilCtrl = $this->ctrl;
128 $ilTabs = $this->tabs;
129
130 $skmg_set = new ilSetting("skmg");
131 $enable_skmg = $skmg_set->get("enable_skmg");
132 if (!$enable_skmg) {
133 ilUtil::sendInfo($lng->txt("skmg_skill_management_deactivated"));
134 }
135
136 $this->getParentGUI()->showTree(false, $this, "listSkills");
137 $ilTabs->activateTab("skills");
138
139 if ($this->checkPermissionBool("write")) {
141 }
142
143 $table = new ilSkillCatTableGUI(
144 $this,
145 "listSkills",
146 (int) $_GET["obj_id"],
148 );
149
150 $tpl->setContent($table->getHTML());
151 }
152
156 public function cancelDelete()
157 {
158 $ilCtrl = $this->ctrl;
159
160 if ($_GET["tmpmode"]) {
161 $ilCtrl->redirect($this, "listTemplates");
162 } else {
163 $ilCtrl->redirect($this, "listSkills");
164 }
165 }
166
170 public function showImportForm()
171 {
173 $ilTabs = $this->tabs;
174
175 $ilTabs->activateTab("skills");
176 $tpl->setContent($this->initInputForm()->getHTML());
177 }
178
182 public function initInputForm()
183 {
185 $ilCtrl = $this->ctrl;
186
187 $form = new ilPropertyFormGUI();
188
189 $fi = new ilFileInputGUI($lng->txt("skmg_input_file"), "import_file");
190 $fi->setSuffixes(array("zip"));
191 $fi->setRequired(true);
192 $form->addItem($fi);
193
194 // save and cancel commands
195 $form->addCommandButton("importSkills", $lng->txt("import"));
196 $form->addCommandButton("listSkills", $lng->txt("cancel"));
197
198 $form->setTitle($lng->txt("skmg_import_skills"));
199 $form->setFormAction($ilCtrl->getFormAction($this));
200
201 return $form;
202 }
203
207 public function importSkills()
208 {
211 $ilCtrl = $this->ctrl;
212 $ilTabs = $this->tabs;
213
214 $form = $this->initInputForm();
215 if ($form->checkInput()) {
216 $imp = new ilImport();
217 $imp->importEntity($_FILES["import_file"]["tmp_name"], $_FILES["import_file"]["name"], "skmg", "Services/Skill");
218
219 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
220 $ilCtrl->redirect($this, "listSkills");
221 } else {
222 $ilTabs->activateTab("skills");
223 $form->setValuesByPost();
224 $tpl->setContent($form->getHtml());
225 }
226 }
227}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a file property in a property form.
Import class.
This class represents a property form user interface.
ILIAS Setting Class.
static addCreationButtons()
Add creation buttons.
Skill root GUI class.
cancelDelete()
cancel delete
showImportForm()
Show import form.
getType()
Get Node Type.
listSkills()
List skills.
importSkills()
Import skills.
__construct($a_node_id=0)
Constructor.
initInputForm()
Init input form.
listTemplates()
List templates.
executeCommand()
Execute command.
static addCreationButtons()
Add creation buttons.
Basic GUI class for skill tree nodes.
getParentGUI()
Get Parent GUI class (ilObjSCORM2004LearningModuleGUI).
checkPermissionBool($a_perm)
Check permission pool.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6