ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
5 include_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::__construct($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());
92  $this->setSkillNodeDescription();
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 
111  function proceedDragDrop()
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 ($this->checkPermissionBool("write"))
168  {
169  if ($a_mode == "create")
170  {
171  $this->form->addCommandButton("save", $lng->txt("save"));
172  $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
173  $this->form->setTitle($lng->txt("skmg_create_skill_category"));
174  } else
175  {
176  $this->form->addCommandButton("update", $lng->txt("save"));
177  $this->form->setTitle($lng->txt("skmg_edit_scat"));
178  }
179  }
180 
181  $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
182  $this->form->setFormAction($ilCtrl->getFormAction($this));
183  }
184 
188  function saveItem()
189  {
190  if (!$this->checkPermissionBool("write"))
191  {
192  return;
193  }
194  include_once "Services/Skill/classes/class.ilSkillCategory.php";
195  $it = new ilSkillCategory();
196  $it->setTitle($this->form->getInput("title"));
197  $it->setOrderNr($this->form->getInput("order_nr"));
198  $it->setSelfEvaluation($_POST["self_eval"]);
199  $it->setStatus($_POST["status"]);
200  $it->create();
201  ilSkillTreeNode::putInTree($it, (int) $_GET["obj_id"], IL_LAST_NODE);
202  }
203 
207  public function getValues()
208  {
209  $values = array();
210  $values["title"] = $this->node_object->getTitle();
211  $values["order_nr"] = $this->node_object->getOrderNr();
212  $values["self_eval"] = $this->node_object->getSelfEvaluation();
213  $values["status"] = $this->node_object->getStatus();
214  $this->form->setValuesByArray($values);
215  }
216 
220  function updateItem()
221  {
222  if (!$this->checkPermissionBool("write"))
223  {
224  return;
225  }
226 
227  $this->node_object->setTitle($this->form->getInput("title"));
228  $this->node_object->setOrderNr($this->form->getInput("order_nr"));
229  $this->node_object->setSelfEvaluation($_POST["self_eval"]);
230  $this->node_object->setStatus($_POST["status"]);
231  $this->node_object->update();
232  }
233 
237 /* function updateSkillCategory()
238  {
239  global $lng, $ilCtrl, $tpl;
240 
241  $this->initForm("edit");
242  if ($this->form->checkInput())
243  {
244  // perform update
245  $this->node_object->setSelfEvaluation($_POST["self_eval"]);
246  $this->node_object->update();
247 
248  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
249  $ilCtrl->redirect($this, "edit");
250  }
251 
252  $this->form->setValuesByPost();
253  $tpl->setContent($this->form->getHtml());
254  }*/
255 
262  function listItems()
263  {
264  global $tpl, $lng;
265 
266  if ($this->isInUse())
267  {
268  ilUtil::sendInfo($lng->txt("skmg_skill_in_use"));
269  }
270 
271  if ($this->checkPermissionBool("write"))
272  {
273  self::addCreationButtons();
274  }
275  $this->setTabs("content");
276 
277  include_once("./Services/Skill/classes/class.ilSkillCatTableGUI.php");
278  $table = new ilSkillCatTableGUI($this, "listItems", (int) $_GET["obj_id"],
280 
281  $tpl->setContent($table->getHTML());
282  }
283 
290  static function addCreationButtons()
291  {
292  global $ilCtrl, $lng, $ilToolbar, $ilUser;
293 
294  // skill
295  $ilCtrl->setParameterByClass("ilbasicskillgui",
296  "obj_id", (int) $_GET["obj_id"]);
297  $ilToolbar->addButton($lng->txt("skmg_create_skll"),
298  $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "create"));
299 
300  // skill category
301  $ilCtrl->setParameterByClass("ilskillcategorygui",
302  "obj_id", (int) $_GET["obj_id"]);
303  $ilToolbar->addButton($lng->txt("skmg_create_skill_category"),
304  $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "create"));
305 
306  // skill template reference
307  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui",
308  "obj_id", (int) $_GET["obj_id"]);
309  $ilToolbar->addButton($lng->txt("skmg_create_skill_template_reference"),
310  $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "create"));
311 
312  // skills from clipboard
313  $sep = false;
314  if ($ilUser->clipboardHasObjectsOfType("skll"))
315  {
316  $ilToolbar->addSeparator();
317  $sep = true;
318  $ilToolbar->addButton($lng->txt("skmg_insert_basic_skill_from_clip"),
319  $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertBasicSkillClip"));
320  }
321 
322  // skills from clipboard
323  if ($ilUser->clipboardHasObjectsOfType("scat"))
324  {
325  if (!$sep)
326  {
327  $ilToolbar->addSeparator();
328  $sep = true;
329  }
330  $ilToolbar->addButton($lng->txt("skmg_insert_skill_category_from_clip"),
331  $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertSkillCategoryClip"));
332  }
333 
334  // skills from clipboard
335  if ($ilUser->clipboardHasObjectsOfType("sktr"))
336  {
337  if (!$sep)
338  {
339  $ilToolbar->addSeparator();
340  $sep = true;
341  }
342  $ilToolbar->addButton($lng->txt("skmg_insert_skill_template_reference_from_clip"),
343  $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "insertTemplateReferenceClip"));
344  }
345 
346  // skill template reference
347  $ilToolbar->addButton($lng->txt("skmg_import_skills"),
348  $ilCtrl->getLinkTargetByClass("ilskillrootgui", "showImportForm"));
349 
350  }
351 
358  function cancel()
359  {
360  global $ilCtrl;
361 
362  $ilCtrl->redirectByClass("ilobjskillmanagementgui", "editSkills");
363  }
364 
371  function redirectToParent($a_tmp_mode = false)
372  {
373  global $ilCtrl;
374 
375  $t = ilSkillTreeNode::_lookupType((int) $_GET["obj_id"]);
376 
377  switch ($t)
378  {
379  case "skrt":
380  $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", (int) $_GET["obj_id"]);
381  $ilCtrl->redirectByClass("ilskillrootgui", "listSkills");
382  break;
383  }
384 
385  parent::redirectToParent();
386  }
387 
388 
389 }
390 
391 ?>
addUsageTab($a_tabs)
Add usage tab.
Skill category GUI class.
static addCreationButtons()
Add creation buttons.
This class represents a property form user interface.
setSkillNodeDescription()
Set skill node description.
$_GET["client_id"]
proceedDragDrop()
Perform drag and drop action.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.
$cmd
Definition: sahs_server.php:35
This class represents a checkbox property in a property form.
global $tpl
Definition: ilias.php:8
static _lookupType($a_obj_id)
Lookup Type.
checkPermissionBool($a_perm)
Check permission pool.
global $ilCtrl
Definition: ilias.php:18
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setTabs($a_tab)
output tabs
executeCommand()
Execute command.
Basic GUI class for skill tree nodes.
__construct($a_node_id=0)
Constructor.
This class represents a number property in a property form.
This class represents a text property in a property form.
$ilUser
Definition: imgupload.php:18
setMaxLength($a_maxlength)
Set Max Length.
Create styles array
The data for the language used.
editProperties()
Edit properties.
const IL_LAST_NODE
Definition: class.ilTree.php:4
setMaxLength($a_maxlength)
Set Max Length.
global $lng
Definition: privfeed.php:17
$ret
Definition: parser.php:6
getValues()
Get current values for from.
initForm($a_mode="edit")
Init form.
$_POST["username"]
addStatusInput(ilPropertyFormGUI $a_form)
Add status input.
redirectToParent($a_tmp_mode=false)
Redirect to parent (identified by current obj_id)