ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilSkillTemplateCategoryGUI.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");
6include_once("./Services/Skill/classes/class.ilSkillTemplateCategory.php");
7
18{
19
23 function __construct($a_node_id = 0, $a_tref_id)
24 {
25 global $ilCtrl;
26
27 $ilCtrl->saveParameter($this, "obj_id");
28 $this->tref_id = $a_tref_id;
29
30 parent::ilSkillTreeNodeGUI($a_node_id);
31 }
32
36 function getType()
37 {
38 return "sctp";
39 }
40
44 function &executeCommand()
45 {
46 global $ilCtrl, $tpl, $ilTabs;
47
48 $tpl->getStandardTemplate();
49
50 $next_class = $ilCtrl->getNextClass($this);
51 $cmd = $ilCtrl->getCmd();
52
53 switch($next_class)
54 {
55 default:
56 $ret = $this->$cmd();
57 break;
58 }
59 }
60
64 function setTabs($a_tab)
65 {
66 global $ilTabs, $ilCtrl, $tpl, $lng, $ilHelp;
67
68 $ilTabs->clearTargets();
69 $ilHelp->setScreenIdComponent("skmg_sctp");
70
71 // content
72 $ilTabs->addTab("content", $lng->txt("content"),
73 $ilCtrl->getLinkTarget($this, 'listItems'));
74
75 if ($this->tref_id > 0)
76 {
77 // usage
78 $this->addUsageTab($ilTabs);
79 }
80
81 // properties
82 if ($this->tref_id == 0)
83 {
84 $ilTabs->addTab("properties", $lng->txt("settings"),
85 $ilCtrl->getLinkTarget($this, 'editProperties'));
86 }
87
88 // back link
89 if ($this->tref_id == 0)
90 {
91 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id",
92 $this->node_object->skill_tree->getRootId());
93 $ilTabs->setBackTarget($lng->txt("skmg_skill_templates"),
94 $ilCtrl->getLinkTargetByClass("ilskillrootgui", "listTemplates"));
95 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id",
96 $_GET["obj_id"]);
97 }
98
99 parent::setTitleIcon();
100 $tpl->setTitle(
101 $lng->txt("skmg_sctp").": ".$this->node_object->getTitle());
103
104 $ilTabs->activateTab($a_tab);
105
106 }
107
114 function listItems()
115 {
116 global $tpl;
117
118 if ($this->tref_id == 0)
119 {
121 }
122
123 $this->setTabs("content");
124
125 include_once("./Services/Skill/classes/class.ilSkillCatTableGUI.php");
126 $table = new ilSkillCatTableGUI($this, "listItems", (int) $_GET["obj_id"],
127 ilSkillCatTableGUI::MODE_SCTP, $this->tref_id);
128
129 $tpl->setContent($table->getHTML());
130 }
131
138 static function addCreationButtons()
139 {
140 global $ilCtrl, $lng, $ilToolbar, $ilUser;
141
142 $ilCtrl->setParameterByClass("ilobjskillmanagementgui", "tmpmode", 1);
143
144 $ilCtrl->setParameterByClass("ilbasicskilltemplategui",
145 "obj_id", (int) $_GET["obj_id"]);
146 $ilToolbar->addButton($lng->txt("skmg_create_skill_template"),
147 $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "create"));
148 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui",
149 "obj_id", (int) $_GET["obj_id"]);
150 $ilToolbar->addButton($lng->txt("skmg_create_skill_template_category"),
151 $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "create"));
152
153 // skill templates from clipboard
154 $sep = false;
155 if ($ilUser->clipboardHasObjectsOfType("sktp"))
156 {
157 $ilToolbar->addSeparator();
158 $sep = true;
159 $ilToolbar->addButton($lng->txt("skmg_insert_skill_template_from_clip"),
160 $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "insertSkillTemplateClip"));
161 }
162
163 // template categories from clipboard
164 if ($ilUser->clipboardHasObjectsOfType("sctp"))
165 {
166 if (!$sep)
167 {
168 $ilToolbar->addSeparator();
169 $sep = true;
170 }
171 $ilToolbar->addButton($lng->txt("skmg_insert_template_category_from_clip"),
172 $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "insertTemplateCategoryClip"));
173 }
174
175 }
176
180 function editProperties()
181 {
182 $this->setTabs("properties");
183 parent::editProperties();
184 }
185
186
190 function saveItem()
191 {
192 $it = new ilSkillTemplateCategory();
193 $it->setTitle($this->form->getInput("title"));
194 $it->setOrderNr($this->form->getInput("order_nr"));
195 $it->create();
196 ilSkillTreeNode::putInTree($it, (int) $_GET["obj_id"], IL_LAST_NODE);
197 }
198
202 function updateItem()
203 {
204 $this->node_object->setTitle($this->form->getInput("title"));
205 $this->node_object->setOrderNr($this->form->getInput("order_nr"));
206 $this->node_object->setSelfEvaluation($_POST["self_eval"]);
207 $this->node_object->update();
208 }
209
213 function afterSave()
214 {
215 $this->redirectToParent(true);
216 }
217
218}
219
220?>
global $tpl
Definition: ilias.php:8
$_GET["client_id"]
const IL_LAST_NODE
Definition: class.ilTree.php:4
Skill template category GUI class.
__construct($a_node_id=0, $a_tref_id)
Constructor.
static addCreationButtons()
Add creation buttons.
Basic GUI class for skill tree nodes.
redirectToParent($a_tmp_mode=false)
Redirect to parent (identified by current obj_id)
setSkillNodeDescription()
Set skill node description.
addUsageTab($a_tabs)
Add usage tab.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.
$_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