ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilSkillCategoryGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/Skill/classes/class.ilSkillTreeNodeGUI.php");
6
17{
21 protected $ctrl;
22
26 protected $tpl;
27
31 protected $tabs;
32
36 protected $lng;
37
41 protected $help;
42
43
47 public function __construct($a_node_id = 0)
48 {
49 global $DIC;
50
51 $this->ctrl = $DIC->ctrl();
52 $this->tpl = $DIC["tpl"];
53 $this->tabs = $DIC->tabs();
54 $this->lng = $DIC->language();
55 $this->help = $DIC["ilHelp"];
56 $ilCtrl = $DIC->ctrl();
57
58 $ilCtrl->saveParameter($this, "obj_id");
59
60 parent::__construct($a_node_id);
61 }
62
66 public function getType()
67 {
68 return "scat";
69 }
70
74 public function executeCommand()
75 {
78 $ilTabs = $this->tabs;
79
80 //$tpl->getStandardTemplate();
81
82 $next_class = $ilCtrl->getNextClass($this);
83 $cmd = $ilCtrl->getCmd();
84
85 switch ($next_class) {
86 default:
87 $ret = $this->$cmd();
88 break;
89 }
90 }
91
95 public function setTabs($a_tab)
96 {
97 $ilTabs = $this->tabs;
101 $ilHelp = $this->help;
102
103 $ilTabs->clearTargets();
104 $ilHelp->setScreenIdComponent("skmg_scat");
105
106 // content
107 $ilTabs->addTab(
108 "content",
109 $lng->txt("content"),
110 $ilCtrl->getLinkTarget($this, 'listItems')
111 );
112
113 // properties
114 $ilTabs->addTab(
115 "properties",
116 $lng->txt("settings"),
117 $ilCtrl->getLinkTarget($this, 'editProperties')
118 );
119
120 // usage
121 $this->addUsageTab($ilTabs);
122
123 // back link
124 $ilCtrl->setParameterByClass(
125 "ilskillrootgui",
126 "obj_id",
127 $this->node_object->skill_tree->getRootId()
128 );
129 $ilTabs->setBackTarget(
130 $lng->txt("obj_skmg"),
131 $ilCtrl->getLinkTargetByClass("ilskillrootgui", "listSkills")
132 );
133 $ilCtrl->setParameterByClass(
134 "ilskillrootgui",
135 "obj_id",
136 $_GET["obj_id"]
137 );
138
139
140 parent::setTitleIcon();
141 $tpl->setTitle(
142 $lng->txt("scat") . ": " . $this->node_object->getTitle()
143 );
145
146 $ilTabs->activateTab($a_tab);
147 }
148
152 public function editProperties()
153 {
155
156 $this->setTabs("properties");
157 parent::editProperties();
158 }
159
163 public function proceedDragDrop()
164 {
166
167 // $this->slm_object->executeDragDrop($_POST["il_hform_source_id"], $_POST["il_hform_target_id"],
168// $_POST["il_hform_fc"], $_POST["il_hform_as_subitem"]);
169// $ilCtrl->redirect($this, "showOrganization");
170 }
171
175 public function edit()
176 {
178
179 $this->initForm();
180 $this->getValues();
181 $tpl->setContent($this->form->getHTML());
182 }
183
189 public function initForm($a_mode = "edit")
190 {
193
194 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
195 $this->form = new ilPropertyFormGUI();
196
197 // title
198 $ti = new ilTextInputGUI($lng->txt("title"), "title");
199 $ti->setMaxLength(200);
200 $ti->setSize(50);
201 $ti->setRequired(true);
202 $this->form->addItem($ti);
203
204 // description
205 $ta = new ilTextAreaInputGUI($lng->txt("description"), "description");
206 $ta->setRows(5);
207 $this->form->addItem($ta);
208
209 // status
210 $this->addStatusInput($this->form);
211
212 // selectable
213 $cb = new ilCheckboxInputGUI($lng->txt("skmg_selectable"), "self_eval");
214 $cb->setInfo($lng->txt("skmg_selectable_info"));
215 $this->form->addItem($cb);
216
217 // save and cancel commands
218 if ($this->checkPermissionBool("write")) {
219 if ($a_mode == "create") {
220 $this->form->addCommandButton("save", $lng->txt("save"));
221 $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
222 $this->form->setTitle($lng->txt("skmg_create_skill_category"));
223 } else {
224 $this->form->addCommandButton("update", $lng->txt("save"));
225 $this->form->setTitle($lng->txt("skmg_edit_scat"));
226 }
227 }
228
229 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
230 $this->form->setFormAction($ilCtrl->getFormAction($this));
231 }
232
236 public function saveItem()
237 {
238 if (!$this->checkPermissionBool("write")) {
239 return;
240 }
241 include_once "Services/Skill/classes/class.ilSkillCategory.php";
242
243 $tree = new ilSkillTree();
244
245 $it = new ilSkillCategory();
246 $it->setTitle($this->form->getInput("title"));
247 $it->setDescription($this->form->getDescription("description"));
248 $it->setOrderNr($tree->getMaxOrderNr((int) $_GET["obj_id"]) + 10);
249 $it->setSelfEvaluation($_POST["self_eval"]);
250 $it->setStatus($_POST["status"]);
251 $it->create();
252 ilSkillTreeNode::putInTree($it, (int) $_GET["obj_id"], IL_LAST_NODE);
253 }
254
258 public function getValues()
259 {
260 $values = array();
261 $values["title"] = $this->node_object->getTitle();
262 $values["description"] = $this->node_object->getDescription();
263 $values["self_eval"] = $this->node_object->getSelfEvaluation();
264 $values["status"] = $this->node_object->getStatus();
265 $this->form->setValuesByArray($values);
266 }
267
271 public function updateItem()
272 {
273 if (!$this->checkPermissionBool("write")) {
274 return;
275 }
276
277 $this->node_object->setTitle($this->form->getInput("title"));
278 $this->node_object->setDescription($this->form->getInput("description"));
279 $this->node_object->setSelfEvaluation($_POST["self_eval"]);
280 $this->node_object->setStatus($_POST["status"]);
281 $this->node_object->update();
282 }
283
287 /* function updateSkillCategory()
288 {
289 global $lng, $ilCtrl, $tpl;
290
291 $this->initForm("edit");
292 if ($this->form->checkInput())
293 {
294 // perform update
295 $this->node_object->setSelfEvaluation($_POST["self_eval"]);
296 $this->node_object->update();
297
298 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
299 $ilCtrl->redirect($this, "edit");
300 }
301
302 $this->form->setValuesByPost();
303 $tpl->setContent($this->form->getHtml());
304 }*/
305
312 public function listItems()
313 {
316
317 if ($this->isInUse()) {
318 ilUtil::sendInfo($lng->txt("skmg_skill_in_use"));
319 }
320
321 if ($this->checkPermissionBool("write")) {
323 }
324 $this->setTabs("content");
325
326 include_once("./Services/Skill/classes/class.ilSkillCatTableGUI.php");
327 $table = new ilSkillCatTableGUI(
328 $this,
329 "listItems",
330 (int) $_GET["obj_id"],
332 );
333
334 $tpl->setContent($table->getHTML());
335 }
336
343 public static function addCreationButtons()
344 {
345 global $DIC;
346
347 $ilCtrl = $DIC->ctrl();
348 $lng = $DIC->language();
349 $ilToolbar = $DIC->toolbar();
350 $ilUser = $DIC->user();
351
352 // skill
353 $ilCtrl->setParameterByClass(
354 "ilbasicskillgui",
355 "obj_id",
356 (int) $_GET["obj_id"]
357 );
358 $ilToolbar->addButton(
359 $lng->txt("skmg_create_skll"),
360 $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "create")
361 );
362
363 // skill category
364 $ilCtrl->setParameterByClass(
365 "ilskillcategorygui",
366 "obj_id",
367 (int) $_GET["obj_id"]
368 );
369 $ilToolbar->addButton(
370 $lng->txt("skmg_create_skill_category"),
371 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "create")
372 );
373
374 // skill template reference
375 $ilCtrl->setParameterByClass(
376 "ilskilltemplatereferencegui",
377 "obj_id",
378 (int) $_GET["obj_id"]
379 );
380 $ilToolbar->addButton(
381 $lng->txt("skmg_create_skill_template_reference"),
382 $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "create")
383 );
384
385 // skills from clipboard
386 $sep = false;
387 if ($ilUser->clipboardHasObjectsOfType("skll")) {
388 $ilToolbar->addSeparator();
389 $sep = true;
390 $ilToolbar->addButton(
391 $lng->txt("skmg_insert_basic_skill_from_clip"),
392 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertBasicSkillClip")
393 );
394 }
395
396 // skills from clipboard
397 if ($ilUser->clipboardHasObjectsOfType("scat")) {
398 if (!$sep) {
399 $ilToolbar->addSeparator();
400 $sep = true;
401 }
402 $ilToolbar->addButton(
403 $lng->txt("skmg_insert_skill_category_from_clip"),
404 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertSkillCategoryClip")
405 );
406 }
407
408 // skills from clipboard
409 if ($ilUser->clipboardHasObjectsOfType("sktr")) {
410 if (!$sep) {
411 $ilToolbar->addSeparator();
412 $sep = true;
413 }
414 $ilToolbar->addButton(
415 $lng->txt("skmg_insert_skill_template_reference_from_clip"),
416 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertTemplateReferenceClip")
417 );
418 }
419
420 // skill template reference
421 $ilToolbar->addButton(
422 $lng->txt("skmg_import_skills"),
423 $ilCtrl->getLinkTargetByClass("ilskillrootgui", "showImportForm")
424 );
425 }
426
433 public function cancel()
434 {
436
437 $ilCtrl->redirectByClass("ilobjskillmanagementgui", "editSkills");
438 }
439
446 public function redirectToParent($a_tmp_mode = false)
447 {
449
450 $t = ilSkillTreeNode::_lookupType((int) $_GET["obj_id"]);
451
452 switch ($t) {
453 case "skrt":
454 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", (int) $_GET["obj_id"]);
455 $ilCtrl->redirectByClass("ilskillrootgui", "listSkills");
456 break;
457 }
458
459 parent::redirectToParent();
460 }
461}
$_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.
help()
Definition: help.php:2
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46