ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 // order nr
205 $ni = new ilNumberInputGUI($lng->txt("skmg_order_nr"), "order_nr");
206 $ni->setInfo($lng->txt("skmg_order_nr_info"));
207 $ni->setMaxLength(6);
208 $ni->setSize(6);
209 $ni->setRequired(true);
210 if ($a_mode == "create") {
211 include_once("./Services/Skill/classes/class.ilSkillTree.php");
212 $tree = new ilSkillTree();
213 $max = $tree->getMaxOrderNr((int) $_GET["obj_id"]);
214 $ni->setValue($max + 10);
215 }
216 $this->form->addItem($ni);
217
218 // status
219 $this->addStatusInput($this->form);
220
221 // selectable
222 $cb = new ilCheckboxInputGUI($lng->txt("skmg_selectable"), "self_eval");
223 $cb->setInfo($lng->txt("skmg_selectable_info"));
224 $this->form->addItem($cb);
225
226 // save and cancel commands
227 if ($this->checkPermissionBool("write")) {
228 if ($a_mode == "create") {
229 $this->form->addCommandButton("save", $lng->txt("save"));
230 $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
231 $this->form->setTitle($lng->txt("skmg_create_skill_category"));
232 } else {
233 $this->form->addCommandButton("update", $lng->txt("save"));
234 $this->form->setTitle($lng->txt("skmg_edit_scat"));
235 }
236 }
237
238 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
239 $this->form->setFormAction($ilCtrl->getFormAction($this));
240 }
241
245 public function saveItem()
246 {
247 if (!$this->checkPermissionBool("write")) {
248 return;
249 }
250 include_once "Services/Skill/classes/class.ilSkillCategory.php";
251 $it = new ilSkillCategory();
252 $it->setTitle($this->form->getInput("title"));
253 $it->setOrderNr($this->form->getInput("order_nr"));
254 $it->setSelfEvaluation($_POST["self_eval"]);
255 $it->setStatus($_POST["status"]);
256 $it->create();
257 ilSkillTreeNode::putInTree($it, (int) $_GET["obj_id"], IL_LAST_NODE);
258 }
259
263 public function getValues()
264 {
265 $values = array();
266 $values["title"] = $this->node_object->getTitle();
267 $values["order_nr"] = $this->node_object->getOrderNr();
268 $values["self_eval"] = $this->node_object->getSelfEvaluation();
269 $values["status"] = $this->node_object->getStatus();
270 $this->form->setValuesByArray($values);
271 }
272
276 public function updateItem()
277 {
278 if (!$this->checkPermissionBool("write")) {
279 return;
280 }
281
282 $this->node_object->setTitle($this->form->getInput("title"));
283 $this->node_object->setOrderNr($this->form->getInput("order_nr"));
284 $this->node_object->setSelfEvaluation($_POST["self_eval"]);
285 $this->node_object->setStatus($_POST["status"]);
286 $this->node_object->update();
287 }
288
292 /* function updateSkillCategory()
293 {
294 global $lng, $ilCtrl, $tpl;
295
296 $this->initForm("edit");
297 if ($this->form->checkInput())
298 {
299 // perform update
300 $this->node_object->setSelfEvaluation($_POST["self_eval"]);
301 $this->node_object->update();
302
303 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
304 $ilCtrl->redirect($this, "edit");
305 }
306
307 $this->form->setValuesByPost();
308 $tpl->setContent($this->form->getHtml());
309 }*/
310
317 public function listItems()
318 {
321
322 if ($this->isInUse()) {
323 ilUtil::sendInfo($lng->txt("skmg_skill_in_use"));
324 }
325
326 if ($this->checkPermissionBool("write")) {
328 }
329 $this->setTabs("content");
330
331 include_once("./Services/Skill/classes/class.ilSkillCatTableGUI.php");
333 $this,
334 "listItems",
335 (int) $_GET["obj_id"],
337 );
338
339 $tpl->setContent($table->getHTML());
340 }
341
348 public static function addCreationButtons()
349 {
350 global $DIC;
351
352 $ilCtrl = $DIC->ctrl();
353 $lng = $DIC->language();
354 $ilToolbar = $DIC->toolbar();
355 $ilUser = $DIC->user();
356
357 // skill
358 $ilCtrl->setParameterByClass(
359 "ilbasicskillgui",
360 "obj_id",
361 (int) $_GET["obj_id"]
362 );
363 $ilToolbar->addButton(
364 $lng->txt("skmg_create_skll"),
365 $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "create")
366 );
367
368 // skill category
369 $ilCtrl->setParameterByClass(
370 "ilskillcategorygui",
371 "obj_id",
372 (int) $_GET["obj_id"]
373 );
374 $ilToolbar->addButton(
375 $lng->txt("skmg_create_skill_category"),
376 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "create")
377 );
378
379 // skill template reference
380 $ilCtrl->setParameterByClass(
381 "ilskilltemplatereferencegui",
382 "obj_id",
383 (int) $_GET["obj_id"]
384 );
385 $ilToolbar->addButton(
386 $lng->txt("skmg_create_skill_template_reference"),
387 $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "create")
388 );
389
390 // skills from clipboard
391 $sep = false;
392 if ($ilUser->clipboardHasObjectsOfType("skll")) {
393 $ilToolbar->addSeparator();
394 $sep = true;
395 $ilToolbar->addButton(
396 $lng->txt("skmg_insert_basic_skill_from_clip"),
397 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertBasicSkillClip")
398 );
399 }
400
401 // skills from clipboard
402 if ($ilUser->clipboardHasObjectsOfType("scat")) {
403 if (!$sep) {
404 $ilToolbar->addSeparator();
405 $sep = true;
406 }
407 $ilToolbar->addButton(
408 $lng->txt("skmg_insert_skill_category_from_clip"),
409 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertSkillCategoryClip")
410 );
411 }
412
413 // skills from clipboard
414 if ($ilUser->clipboardHasObjectsOfType("sktr")) {
415 if (!$sep) {
416 $ilToolbar->addSeparator();
417 $sep = true;
418 }
419 $ilToolbar->addButton(
420 $lng->txt("skmg_insert_skill_template_reference_from_clip"),
421 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertTemplateReferenceClip")
422 );
423 }
424
425 // skill template reference
426 $ilToolbar->addButton(
427 $lng->txt("skmg_import_skills"),
428 $ilCtrl->getLinkTargetByClass("ilskillrootgui", "showImportForm")
429 );
430 }
431
438 public function cancel()
439 {
441
442 $ilCtrl->redirectByClass("ilobjskillmanagementgui", "editSkills");
443 }
444
451 public function redirectToParent($a_tmp_mode = false)
452 {
454
455 $t = ilSkillTreeNode::_lookupType((int) $_GET["obj_id"]);
456
457 switch ($t) {
458 case "skrt":
459 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", (int) $_GET["obj_id"]);
460 $ilCtrl->redirectByClass("ilskillrootgui", "listSkills");
461 break;
462 }
463
464 parent::redirectToParent();
465 }
466}
$_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 number 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 property in a property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
if(empty($password)) $table
Definition: pwgen.php:24
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18