ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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{
18
22 function __construct($a_node_id = 0)
23 {
24 global $ilCtrl;
25
26 $ilCtrl->saveParameter($this, "obj_id");
27
28 parent::ilSkillTreeNodeGUI($a_node_id);
29 }
30
34 function getType()
35 {
36 return "scat";
37 }
38
42 function &executeCommand()
43 {
44 global $ilCtrl, $tpl, $ilTabs;
45
46 $tpl->getStandardTemplate();
47
48 $next_class = $ilCtrl->getNextClass($this);
49 $cmd = $ilCtrl->getCmd();
50
51 switch($next_class)
52 {
53 default:
54 $ret = $this->$cmd();
55 break;
56 }
57 }
58
62 function setTabs($a_tab)
63 {
64 global $ilTabs, $ilCtrl, $tpl, $lng, $ilHelp;
65
66 $ilTabs->clearTargets();
67 $ilHelp->setScreenIdComponent("skmg_scat");
68
69 // content
70 $ilTabs->addTab("content", $lng->txt("content"),
71 $ilCtrl->getLinkTarget($this, 'listItems'));
72
73 // properties
74 $ilTabs->addTab("properties", $lng->txt("settings"),
75 $ilCtrl->getLinkTarget($this, 'editProperties'));
76
77 // usage
78 $this->addUsageTab($ilTabs);
79
80 // back link
81 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id",
82 $this->node_object->skill_tree->getRootId());
83 $ilTabs->setBackTarget($lng->txt("obj_skmg"),
84 $ilCtrl->getLinkTargetByClass("ilskillrootgui", "listSkills"));
85 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id",
86 $_GET["obj_id"]);
87
88
89 parent::setTitleIcon();
90 $tpl->setTitle(
91 $lng->txt("scat").": ".$this->node_object->getTitle());
93
94 $ilTabs->activateTab($a_tab);
95 }
96
100 function editProperties()
101 {
102 global $tpl;
103
104 $this->setTabs("properties");
105 parent::editProperties();
106 }
107
112 {
113 global $ilCtrl;
114
115// $this->slm_object->executeDragDrop($_POST["il_hform_source_id"], $_POST["il_hform_target_id"],
116// $_POST["il_hform_fc"], $_POST["il_hform_as_subitem"]);
117// $ilCtrl->redirect($this, "showOrganization");
118 }
119
123 function edit()
124 {
125 global $tpl;
126
127 $this->initForm();
128 $this->getValues();
129 $tpl->setContent($this->form->getHTML());
130 }
131
137 public function initForm($a_mode = "edit")
138 {
139 global $lng, $ilCtrl;
140
141 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
142 $this->form = new ilPropertyFormGUI();
143
144 // title
145 $ti = new ilTextInputGUI($lng->txt("title"), "title");
146 $ti->setMaxLength(200);
147 $ti->setSize(50);
148 $ti->setRequired(true);
149 $this->form->addItem($ti);
150
151 // order nr
152 $ni = new ilNumberInputGUI($lng->txt("skmg_order_nr"), "order_nr");
153 $ni->setMaxLength(6);
154 $ni->setSize(6);
155 $ni->setRequired(true);
156 $this->form->addItem($ni);
157
158 // status
159 $this->addStatusInput($this->form);
160
161 // selectable
162 $cb = new ilCheckboxInputGUI($lng->txt("skmg_selectable"), "self_eval");
163 $cb->setInfo($lng->txt("skmg_selectable_info"));
164 $this->form->addItem($cb);
165
166 // save and cancel commands
167 if ($a_mode == "create")
168 {
169 $this->form->addCommandButton("save", $lng->txt("save"));
170 $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
171 $this->form->setTitle($lng->txt("skmg_create_skill_category"));
172 }
173 else
174 {
175 $this->form->addCommandButton("update", $lng->txt("save"));
176 $this->form->setTitle($lng->txt("skmg_edit_scat"));
177 }
178
179 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
180 $this->form->setFormAction($ilCtrl->getFormAction($this));
181 }
182
186 function saveItem()
187 {
188 include_once "Services/Skill/classes/class.ilSkillCategory.php";
189 $it = new ilSkillCategory();
190 $it->setTitle($this->form->getInput("title"));
191 $it->setOrderNr($this->form->getInput("order_nr"));
192 $it->setSelfEvaluation($_POST["self_eval"]);
193 $it->setStatus($_POST["status"]);
194 $it->create();
195 ilSkillTreeNode::putInTree($it, (int) $_GET["obj_id"], IL_LAST_NODE);
196 }
197
201 public function getValues()
202 {
203 $values = array();
204 $values["title"] = $this->node_object->getTitle();
205 $values["order_nr"] = $this->node_object->getOrderNr();
206 $values["self_eval"] = $this->node_object->getSelfEvaluation();
207 $values["status"] = $this->node_object->getStatus();
208 $this->form->setValuesByArray($values);
209 }
210
214 function updateItem()
215 {
216 $this->node_object->setTitle($this->form->getInput("title"));
217 $this->node_object->setOrderNr($this->form->getInput("order_nr"));
218 $this->node_object->setSelfEvaluation($_POST["self_eval"]);
219 $this->node_object->setStatus($_POST["status"]);
220 $this->node_object->update();
221 }
222
226/* function updateSkillCategory()
227 {
228 global $lng, $ilCtrl, $tpl;
229
230 $this->initForm("edit");
231 if ($this->form->checkInput())
232 {
233 // perform update
234 $this->node_object->setSelfEvaluation($_POST["self_eval"]);
235 $this->node_object->update();
236
237 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
238 $ilCtrl->redirect($this, "edit");
239 }
240
241 $this->form->setValuesByPost();
242 $tpl->setContent($this->form->getHtml());
243 }*/
244
251 function listItems()
252 {
253 global $tpl;
254
256 $this->setTabs("content");
257
258 include_once("./Services/Skill/classes/class.ilSkillCatTableGUI.php");
259 $table = new ilSkillCatTableGUI($this, "listItems", (int) $_GET["obj_id"],
261
262 $tpl->setContent($table->getHTML());
263 }
264
271 static function addCreationButtons()
272 {
273 global $ilCtrl, $lng, $ilToolbar, $ilUser;
274
275 // skill
276 $ilCtrl->setParameterByClass("ilbasicskillgui",
277 "obj_id", (int) $_GET["obj_id"]);
278 $ilToolbar->addButton($lng->txt("skmg_create_skll"),
279 $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "create"));
280
281 // skill category
282 $ilCtrl->setParameterByClass("ilskillcategorygui",
283 "obj_id", (int) $_GET["obj_id"]);
284 $ilToolbar->addButton($lng->txt("skmg_create_skill_category"),
285 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "create"));
286
287 // skill template reference
288 $ilCtrl->setParameterByClass("ilskilltemplatereferencegui",
289 "obj_id", (int) $_GET["obj_id"]);
290 $ilToolbar->addButton($lng->txt("skmg_create_skill_template_reference"),
291 $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "create"));
292
293 // skills from clipboard
294 $sep = false;
295 if ($ilUser->clipboardHasObjectsOfType("skll"))
296 {
297 $ilToolbar->addSeparator();
298 $sep = true;
299 $ilToolbar->addButton($lng->txt("skmg_insert_basic_skill_from_clip"),
300 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertBasicSkillClip"));
301 }
302
303 // skills from clipboard
304 if ($ilUser->clipboardHasObjectsOfType("scat"))
305 {
306 if (!$sep)
307 {
308 $ilToolbar->addSeparator();
309 $sep = true;
310 }
311 $ilToolbar->addButton($lng->txt("skmg_insert_skill_category_from_clip"),
312 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertSkillCategoryClip"));
313 }
314
315 // skills from clipboard
316 if ($ilUser->clipboardHasObjectsOfType("sktr"))
317 {
318 if (!$sep)
319 {
320 $ilToolbar->addSeparator();
321 $sep = true;
322 }
323 $ilToolbar->addButton($lng->txt("skmg_insert_skill_template_reference_from_clip"),
324 $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertTemplateReferenceClip"));
325 }
326
327 }
328
335 function cancel()
336 {
337 global $ilCtrl;
338
339 $ilCtrl->redirectByClass("ilobjskillmanagementgui", "editSkills");
340 }
341
349 {
350 global $ilCtrl;
351
352 $t = ilSkillTreeNode::_lookupType((int) $_GET["obj_id"]);
353
354 switch ($t)
355 {
356 case "skrt":
357 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", (int) $_GET["obj_id"]);
358 $ilCtrl->redirectByClass("ilskillrootgui", "listSkills");
359 break;
360 }
361
362 parent::redirectToParent();
363 }
364
365}
366
367?>
global $tpl
Definition: ilias.php:8
$_GET["client_id"]
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.
redirectToParent()
Redirect to parent (identified by current obj_id)
proceedDragDrop()
Perform drag and drop action.
& executeCommand()
Execute command.
getValues()
Get current values for from.
__construct($a_node_id=0)
Constructor.
setTabs($a_tab)
output tabs
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.
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.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15