ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilBasicSkillTemplateGUI.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.ilBasicSkillTemplate.php");
6include_once("./Services/Skill/classes/class.ilBasicSkillGUI.php");
7
18{
19
23 function __construct($a_node_id = 0, $a_tref_id = 0)
24 {
25 global $ilCtrl;
26
27 $this->tref_id = $a_tref_id;
28
29 $ilCtrl->saveParameter($this, array("obj_id", "level_id"));
30
31 parent::__construct($a_node_id);
32 }
33
37 function getType()
38 {
39 return "sktp";
40 }
41
47 public function initForm($a_mode = "edit")
48 {
49 global $lng, $ilCtrl;
50
51 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
52 $this->form = new ilPropertyFormGUI();
53
54 // title
55 $ti = new ilTextInputGUI($lng->txt("title"), "title");
56 $ti->setMaxLength(200);
57 $ti->setSize(50);
58 $ti->setRequired(true);
59 $this->form->addItem($ti);
60
61 // order nr
62 $ni = new ilNumberInputGUI($lng->txt("skmg_order_nr"), "order_nr");
63 $ni->setMaxLength(6);
64 $ni->setSize(6);
65 $ni->setRequired(true);
66 $this->form->addItem($ni);
67
68 // save and cancel commands
69 if ($a_mode == "create")
70 {
71 $this->form->addCommandButton("save", $lng->txt("save"));
72 $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
73 $this->form->setTitle($lng->txt("skmg_create_skll"));
74 }
75 else
76 {
77 $this->form->addCommandButton("update", $lng->txt("save"));
78 $this->form->setTitle($lng->txt("skmg_edit_skll"));
79 }
80
81 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
82 $this->form->setFormAction($ilCtrl->getFormAction($this));
83 }
84
88 function setLevelHead()
89 {
90 global $ilTabs, $ilCtrl, $tpl, $lng, $ilHelp;
91
92 // tabs
93 $ilTabs->clearTargets();
94 $ilHelp->setScreenIdComponent("skmg_lev");
95 $ilTabs->setBackTarget($lng->txt("skmg_skill_levels"),
96 $ilCtrl->getLinkTarget($this, "edit"));
97
98 if ($_GET["level_id"] > 0)
99 {
100 if ($this->tref_id == 0)
101 {
102 $ilTabs->addTab("level_settings",
103 $lng->txt("settings"),
104 $ilCtrl->getLinkTarget($this, "editLevel"));
105 }
106 else
107 {
108 $ilTabs->addTab("level_resources",
109 $lng->txt("skmg_resources"),
110 $ilCtrl->getLinkTarget($this, "showLevelResources"));
111 }
112
113/* $ilTabs->addTab("level_trigger",
114 $lng->txt("skmg_trigger"),
115 $ilCtrl->getLinkTarget($this, "editLevelTrigger"));
116
117 $ilTabs->addTab("level_certificate",
118 $lng->txt("certificate"),
119 $ilCtrl->getLinkTargetByClass("ilcertificategui", "certificateEditor"));*/
120 }
121
122 // title
123 if ($_GET["level_id"] > 0)
124 {
125 $tpl->setTitle($lng->txt("skmg_skill_level").": ".
126 ilBasicSkill::lookupLevelTitle((int) $_GET["level_id"]));
127 }
128 else
129 {
130 $tpl->setTitle($lng->txt("skmg_skill_level"));
131 }
132
133 include_once("./Services/Skill/classes/class.ilSkillTree.php");
134 $tree = new ilSkillTree();
135 $path = $tree->getPathFull($this->node_object->getId());
136 $desc = "";
137 foreach ($path as $p)
138 {
139 if (in_array($p["type"], array("scat", "skll")))
140 {
141 $desc.= $sep.$p["title"];
142 $sep = " > ";
143 }
144 }
145 $tpl->setDescription($desc);
146
147 $tpl->setTitleIcon(
149 0, "sktp", "", false));
150
151 }
152
159 function setTabs($a_tab)
160 {
161 global $ilTabs, $ilCtrl, $tpl, $lng, $ilHelp;
162
163 $ilTabs->clearTargets();
164 $ilHelp->setScreenIdComponent("skmg_sktp");
165
166 if ($this->tref_id == 0)
167 {
168 $ilTabs->setBackTarget($lng->txt("skmg_skill_templates"),
169 $ilCtrl->getLinkTargetByClass("ilobjskillmanagementgui", "editSkillTemplates"));
170 }
171
172 if (is_object($this->node_object))
173 {
174 if ($this->tref_id == 0)
175 {
176 $tpl->setTitle($lng->txt("skmg_skill_template").": ".
177 $this->node_object->getTitle());
178 }
179 else
180 {
181 $tpl->setTitle(
182 $this->node_object->getTitle());
183 }
184
185 // levels
186 $ilTabs->addTab("levels", $lng->txt("skmg_skill_levels"),
187 $ilCtrl->getLinkTarget($this, 'edit'));
188
189 if ($this->tref_id > 0)
190 {
191 // usage
192 $this->addUsageTab($ilTabs);
193 }
194
195
196 // properties
197 if ($this->tref_id == 0)
198 {
199 $ilTabs->addTab("properties", $lng->txt("settings"),
200 $ilCtrl->getLinkTarget($this, 'editProperties'));
201 }
202
203 $ilTabs->activateTab($a_tab);
204
205 parent::setTitleIcon();
206
208 }
209 else
210 {
211 $tpl->setTitle($lng->txt("skmg_skill"));
212 $tpl->setDescription("");
213 }
214 }
215
219 function saveItem()
220 {
221 $it = new ilBasicSkillTemplate();
222 $it->setTitle($this->form->getInput("title"));
223 $it->setOrderNr($this->form->getInput("order_nr"));
224 $it->create();
225 ilSkillTreeNode::putInTree($it, (int) $_GET["obj_id"], IL_LAST_NODE);
226 $this->node_object = $it;
227 }
228
232 function afterSave()
233 {
234 global $ilCtrl;
235
236 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id",
237 $this->node_object->getId());
238 $ilCtrl->redirectByClass("ilbasicskilltemplategui", "edit");
239 }
240
247 function edit()
248 {
249 global $tpl, $ilToolbar, $lng, $ilCtrl;
250
251 $this->setTabs("levels");
252
253 if ($this->tref_id == 0)
254 {
255 $ilToolbar->addButton($lng->txt("skmg_add_level"),
256 $ilCtrl->getLinkTarget($this, "addLevel"));
257 }
258
259 include_once("./Services/Skill/classes/class.ilSkillLevelTableGUI.php");
260 $table = new ilSkillLevelTableGUI((int) $_GET["obj_id"], $this, "edit", $this->tref_id);
261 $tpl->setContent($table->getHTML());
262 }
263}
264?>
global $tpl
Definition: ilias.php:8
$_GET["client_id"]
const IL_LAST_NODE
Definition: class.ilTree.php:4
Basic skill GUI class.
Basic skill template GUI class.
setTabs($a_tab)
Set header for skill.
__construct($a_node_id=0, $a_tref_id=0)
Constructor.
initForm($a_mode="edit")
Init form.
static lookupLevelTitle($a_id)
Lookup level title.
This class represents a number property in a property form.
This class represents a property form user interface.
setSkillNodeDescription()
Set skill node description.
addUsageTab($a_tabs)
Add usage tab.
static getIconPath($a_obj_id, $a_type, $a_size="", $a_status=0)
Get icon path.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.
This class represents a text property in a property form.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$path
Definition: index.php:22