ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSkillCategoryGUI.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
13{
17 protected $ctrl;
18
22 protected $tpl;
23
27 protected $tabs;
28
32 protected $lng;
33
37 protected $help;
38
39
43 public function __construct($a_node_id = 0)
44 {
45 global $DIC;
46
47 $this->ctrl = $DIC->ctrl();
48 $this->tpl = $DIC["tpl"];
49 $this->tabs = $DIC->tabs();
50 $this->lng = $DIC->language();
51 $this->help = $DIC["ilHelp"];
52 $ilCtrl = $DIC->ctrl();
53
54 $ilCtrl->saveParameter($this, "obj_id");
55
56 parent::__construct($a_node_id);
57 }
58
62 public function getType()
63 {
64 return "scat";
65 }
66
70 public function executeCommand()
71 {
72 $ilCtrl = $this->ctrl;
74 $ilTabs = $this->tabs;
75
76 //$tpl->getStandardTemplate();
77
78 $next_class = $ilCtrl->getNextClass($this);
79 $cmd = $ilCtrl->getCmd();
80
81 switch ($next_class) {
82 default:
83 $ret = $this->$cmd();
84 break;
85 }
86 }
87
91 public function setTabs($a_tab)
92 {
93 $ilTabs = $this->tabs;
94 $ilCtrl = $this->ctrl;
97 $ilHelp = $this->help;
98
99 $ilTabs->clearTargets();
100 $ilHelp->setScreenIdComponent("skmg_scat");
101
102 // content
103 $ilTabs->addTab(
104 "content",
105 $lng->txt("content"),
106 $ilCtrl->getLinkTarget($this, 'listItems')
107 );
108
109 // properties
110 $ilTabs->addTab(
111 "properties",
112 $lng->txt("settings"),
113 $ilCtrl->getLinkTarget($this, 'editProperties')
114 );
115
116 // usage
117 $this->addUsageTab($ilTabs);
118
119 // back link
120 $ilCtrl->setParameterByClass(
121 "ilskillrootgui",
122 "obj_id",
123 $this->node_object->skill_tree->getRootId()
124 );
125 $ilTabs->setBackTarget(
126 $lng->txt("obj_skmg"),
127 $ilCtrl->getLinkTargetByClass("ilskillrootgui", "listSkills")
128 );
129 $ilCtrl->setParameterByClass(
130 "ilskillrootgui",
131 "obj_id",
132 $_GET["obj_id"]
133 );
134
135
136 parent::setTitleIcon();
137 $tpl->setTitle(
138 $lng->txt("scat") . ": " . $this->node_object->getTitle()
139 );
141
142 $ilTabs->activateTab($a_tab);
143 }
144
148 public function editProperties()
149 {
151
152 $this->setTabs("properties");
153 parent::editProperties();
154 }
155
159 public function proceedDragDrop()
160 {
161 $ilCtrl = $this->ctrl;
162
163 // $this->slm_object->executeDragDrop($_POST["il_hform_source_id"], $_POST["il_hform_target_id"],
164// $_POST["il_hform_fc"], $_POST["il_hform_as_subitem"]);
165// $ilCtrl->redirect($this, "showOrganization");
166 }
167
171 public function edit()
172 {
174
175 $this->initForm();
176 $this->getValues();
177 $tpl->setContent($this->form->getHTML());
178 }
179
185 public function initForm($a_mode = "edit")
186 {
188 $ilCtrl = $this->ctrl;
189
190 $this->form = new ilPropertyFormGUI();
191
192 // title
193 $ti = new ilTextInputGUI($lng->txt("title"), "title");
194 $ti->setMaxLength(200);
195 $ti->setSize(50);
196 $ti->setRequired(true);
197 $this->form->addItem($ti);
198
199 // description
200 $ta = new ilTextAreaInputGUI($lng->txt("description"), "description");
201 $ta->setRows(5);
202 $this->form->addItem($ta);
203
204 // status
205 $this->addStatusInput($this->form);
206
207 // selectable
208 $cb = new ilCheckboxInputGUI($lng->txt("skmg_selectable"), "self_eval");
209 $cb->setInfo($lng->txt("skmg_selectable_info"));
210 $this->form->addItem($cb);
211
212 // save and cancel commands
213 if ($this->checkPermissionBool("write")) {
214 if ($a_mode == "create") {
215 $this->form->addCommandButton("save", $lng->txt("save"));
216 $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
217 $this->form->setTitle($lng->txt("skmg_create_skill_category"));
218 } else {
219 $this->form->addCommandButton("update", $lng->txt("save"));
220 $this->form->setTitle($lng->txt("skmg_edit_scat"));
221 }
222 }
223
224 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
225 $this->form->setFormAction($ilCtrl->getFormAction($this));
226 }
227
231 public function saveItem()
232 {
233 if (!$this->checkPermissionBool("write")) {
234 return;
235 }
236
237 $tree = new ilSkillTree();
238
239 $it = new ilSkillCategory();
240 $it->setTitle($this->form->getInput("title"));
241 $it->setDescription($this->form->getDescription("description"));
242 $it->setOrderNr($tree->getMaxOrderNr((int) $_GET["obj_id"]) + 10);
243 $it->setSelfEvaluation($_POST["self_eval"]);
244 $it->setStatus($_POST["status"]);
245 $it->create();
246 ilSkillTreeNode::putInTree($it, (int) $_GET["obj_id"], IL_LAST_NODE);
247 }
248
252 public function getValues()
253 {
254 $values = array();
255 $values["title"] = $this->node_object->getTitle();
256 $values["description"] = $this->node_object->getDescription();
257 $values["self_eval"] = $this->node_object->getSelfEvaluation();
258 $values["status"] = $this->node_object->getStatus();
259 $this->form->setValuesByArray($values);
260 }
261
265 public function updateItem()
266 {
267 if (!$this->checkPermissionBool("write")) {
268 return;
269 }
270
271 $this->node_object->setTitle($this->form->getInput("title"));
272 $this->node_object->setDescription($this->form->getInput("description"));
273 $this->node_object->setSelfEvaluation($_POST["self_eval"]);
274 $this->node_object->setStatus($_POST["status"]);
275 $this->node_object->update();
276 }
277
281 /* function updateSkillCategory()
282 {
283 global $lng, $ilCtrl, $tpl;
284
285 $this->initForm("edit");
286 if ($this->form->checkInput())
287 {
288 // perform update
289 $this->node_object->setSelfEvaluation($_POST["self_eval"]);
290 $this->node_object->update();
291
292 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
293 $ilCtrl->redirect($this, "edit");
294 }
295
296 $this->form->setValuesByPost();
297 $tpl->setContent($this->form->getHtml());
298 }*/
299
306 public function listItems()
307 {
310
311 if ($this->isInUse()) {
312 ilUtil::sendInfo($lng->txt("skmg_skill_in_use"));
313 }
314
315 if ($this->checkPermissionBool("write")) {
317 }
318 $this->setTabs("content");
319
320 $table = new ilSkillCatTableGUI(
321 $this,
322 "listItems",
323 (int) $_GET["obj_id"],
325 );
326
327 $tpl->setContent($table->getHTML());
328 }
329
336 public static function addCreationButtons()
337 {
338 global $DIC;
339
340 $ilCtrl = $DIC->ctrl();
341 $lng = $DIC->language();
342 $ilToolbar = $DIC->toolbar();
343 $ilUser = $DIC->user();
344
345 // skill
346 $ilCtrl->setParameterByClass(
347 "ilbasicskillgui",
348 "obj_id",
349 (int) $_GET["obj_id"]
350 );
351 $ilToolbar->addButton(
352 $lng->txt("skmg_create_skll"),
353 $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "create")
354 );
355
356 // skill category
357 $ilCtrl->setParameterByClass(
358 "ilskillcategorygui",
359 "obj_id",
360 (int) $_GET["obj_id"]
361 );
362 $ilToolbar->addButton(
363 $lng->txt("skmg_create_skill_category"),
364 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "create")
365 );
366
367 // skill template reference
368 $ilCtrl->setParameterByClass(
369 "ilskilltemplatereferencegui",
370 "obj_id",
371 (int) $_GET["obj_id"]
372 );
373 $ilToolbar->addButton(
374 $lng->txt("skmg_create_skill_template_reference"),
375 $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "create")
376 );
377
378 // skills from clipboard
379 $sep = false;
380 if ($ilUser->clipboardHasObjectsOfType("skll")) {
381 $ilToolbar->addSeparator();
382 $sep = true;
383 $ilToolbar->addButton(
384 $lng->txt("skmg_insert_basic_skill_from_clip"),
385 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertBasicSkillClip")
386 );
387 }
388
389 // skills from clipboard
390 if ($ilUser->clipboardHasObjectsOfType("scat")) {
391 if (!$sep) {
392 $ilToolbar->addSeparator();
393 $sep = true;
394 }
395 $ilToolbar->addButton(
396 $lng->txt("skmg_insert_skill_category_from_clip"),
397 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertSkillCategoryClip")
398 );
399 }
400
401 // skills from clipboard
402 if ($ilUser->clipboardHasObjectsOfType("sktr")) {
403 if (!$sep) {
404 $ilToolbar->addSeparator();
405 $sep = true;
406 }
407 $ilToolbar->addButton(
408 $lng->txt("skmg_insert_skill_template_reference_from_clip"),
409 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertTemplateReferenceClip")
410 );
411 }
412
413 // skill template reference
414 $ilToolbar->addButton(
415 $lng->txt("skmg_import_skills"),
416 $ilCtrl->getLinkTargetByClass("ilskillrootgui", "showImportForm")
417 );
418 }
419
426 public function cancel()
427 {
428 $ilCtrl = $this->ctrl;
429
430 $ilCtrl->redirectByClass("ilobjskillmanagementgui", "editSkills");
431 }
432
439 public function redirectToParent($a_tmp_mode = false)
440 {
441 $ilCtrl = $this->ctrl;
442
443 $t = ilSkillTreeNode::_lookupType((int) $_GET["obj_id"]);
444
445 switch ($t) {
446 case "skrt":
447 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", (int) $_GET["obj_id"]);
448 $ilCtrl->redirectByClass("ilskillrootgui", "listSkills");
449 break;
450 }
451
452 parent::redirectToParent();
453 }
454}
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_LAST_NODE
Definition: class.ilTree.php:4
This class represents a checkbox property in a property form.
This class represents a property form user interface.
Skill category GUI class.
initForm($a_mode="edit")
Init form.
editProperties()
Edit properties.
static addCreationButtons()
Add creation buttons.
proceedDragDrop()
Perform drag and drop action.
getValues()
Get current values for from.
executeCommand()
Execute command.
__construct($a_node_id=0)
Constructor.
setTabs($a_tab)
output tabs
redirectToParent($a_tmp_mode=false)
Redirect to parent (identified by current obj_id)
Basic GUI class for skill tree nodes.
setSkillNodeDescription()
Set skill node description.
addUsageTab($a_tabs)
Add usage tab.
addStatusInput(ilPropertyFormGUI $a_form)
Add status input.
checkPermissionBool($a_perm)
Check permission pool.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.
static _lookupType($a_obj_id)
Lookup Type.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $DIC
Definition: goto.php:24
help()
Definition: help.php:2
$ilUser
Definition: imgupload.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6