ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
76 // properties
77 if ($this->tref_id == 0)
78 {
79 $ilTabs->addTab("properties", $lng->txt("settings"),
80 $ilCtrl->getLinkTarget($this, 'editProperties'));
81 }
82
83 // usage
84 $this->addUsageTab($ilTabs);
85
86 // back link
87 if ($this->tref_id == 0)
88 {
89 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id",
90 $this->node_object->skill_tree->getRootId());
91 $ilTabs->setBackTarget($lng->txt("skmg_skill_templates"),
92 $ilCtrl->getLinkTargetByClass("ilskillrootgui", "listTemplates"));
93 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id",
94 $_GET["obj_id"]);
95 }
96
97 parent::setTitleIcon();
98 $tpl->setTitle(
99 $lng->txt("skmg_sctp").": ".$this->node_object->getTitle());
101
102 $ilTabs->activateTab($a_tab);
103
104 }
105
112 function listItems()
113 {
114 global $tpl;
115
116 if ($this->checkPermissionBool("write"))
117 {
118 if ($this->tref_id == 0)
119 {
121 }
122 }
123
124 $this->setTabs("content");
125
126 include_once("./Services/Skill/classes/class.ilSkillCatTableGUI.php");
127 $table = new ilSkillCatTableGUI($this, "listItems", (int) $_GET["obj_id"],
128 ilSkillCatTableGUI::MODE_SCTP, $this->tref_id);
129
130 $tpl->setContent($table->getHTML());
131 }
132
139 static function addCreationButtons()
140 {
141 global $ilCtrl, $lng, $ilToolbar, $ilUser;
142
143 $ilCtrl->setParameterByClass("ilobjskillmanagementgui", "tmpmode", 1);
144
145 $ilCtrl->setParameterByClass("ilbasicskilltemplategui",
146 "obj_id", (int) $_GET["obj_id"]);
147 $ilToolbar->addButton($lng->txt("skmg_create_skill_template"),
148 $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "create"));
149 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui",
150 "obj_id", (int) $_GET["obj_id"]);
151 $ilToolbar->addButton($lng->txt("skmg_create_skill_template_category"),
152 $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "create"));
153
154 // skill templates from clipboard
155 $sep = false;
156 if ($ilUser->clipboardHasObjectsOfType("sktp"))
157 {
158 $ilToolbar->addSeparator();
159 $sep = true;
160 $ilToolbar->addButton($lng->txt("skmg_insert_skill_template_from_clip"),
161 $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "insertSkillTemplateClip"));
162 }
163
164 // template categories from clipboard
165 if ($ilUser->clipboardHasObjectsOfType("sctp"))
166 {
167 if (!$sep)
168 {
169 $ilToolbar->addSeparator();
170 $sep = true;
171 }
172 $ilToolbar->addButton($lng->txt("skmg_insert_template_category_from_clip"),
173 $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "insertTemplateCategoryClip"));
174 }
175
176 }
177
181 function editProperties()
182 {
183 $this->setTabs("properties");
184 parent::editProperties();
185 }
186
187
191 function saveItem()
192 {
193 if (!$this->checkPermissionBool("write"))
194 {
195 return;
196 }
197
198 $it = new ilSkillTemplateCategory();
199 $it->setTitle($this->form->getInput("title"));
200 $it->setOrderNr($this->form->getInput("order_nr"));
201 $it->create();
202 ilSkillTreeNode::putInTree($it, (int) $_GET["obj_id"], IL_LAST_NODE);
203 }
204
208 function updateItem()
209 {
210 if (!$this->checkPermissionBool("write"))
211 {
212 return;
213 }
214
215 $this->node_object->setTitle($this->form->getInput("title"));
216 $this->node_object->setOrderNr($this->form->getInput("order_nr"));
217 $this->node_object->setSelfEvaluation($_POST["self_eval"]);
218 $this->node_object->update();
219 }
220
224 function afterSave()
225 {
226 $this->redirectToParent(true);
227 }
228
232 function showUsage()
233 {
234 global $tpl;
235
236 // (a) referenced skill template category in main tree
237 if ($this->tref_id > 0)
238 {
239 return parent::showUsage();
240 }
241
242 // (b) skill template category in templates view
243
244 $this->setTabs("usage");
245
246 include_once("./Services/Skill/classes/class.ilSkillUsage.php");
247 $usage_info = new ilSkillUsage();
248 $usages = $usage_info->getAllUsagesOfTemplate((int) $_GET["obj_id"]);
249
250 $html = "";
251 include_once("./Services/Skill/classes/class.ilSkillUsageTableGUI.php");
252 foreach ($usages as $k => $usage)
253 {
254 $tab = new ilSkillUsageTableGUI($this, "showUsage", $k, $usage);
255 $html.= $tab->getHTML()."<br/><br/>";
256 }
257
258 $tpl->setContent($html);
259 }
260
261
262}
263
264?>
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.
checkPermissionBool($a_perm)
Check permission pool.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.
TableGUI class for skill usages.
$_POST['username']
Definition: cron.php:12
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15