ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
5 include_once("./Services/Skill/classes/class.ilBasicSkillTemplate.php");
6 include_once("./Services/Skill/classes/class.ilBasicSkillGUI.php");
7 
18 {
19 
23  function __construct($a_node_id = 0)
24  {
25  global $ilCtrl;
26 
27  $ilCtrl->saveParameter($this, array("obj_id", "level_id"));
28 
29  parent::ilSkillTreeNodeGUI($a_node_id);
30  }
31 
35  function getType()
36  {
37  return "sktp";
38  }
39 
43  function setTabs()
44  {
45  global $ilTabs, $ilCtrl, $tpl, $lng;
46 
47  // properties
48  $ilTabs->addTarget("properties",
49  $ilCtrl->getLinkTarget($this,'showProperties'),
50  "showProperties", get_class($this));
51 
53  $tpl->setTitle(
54  $lng->txt("skmg_basic_skill_template").": ".$this->node_object->getTitle());
55  }
56 
62  public function initForm($a_mode = "edit")
63  {
64  global $lng, $ilCtrl;
65 
66  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
67  $this->form = new ilPropertyFormGUI();
68 
69  // title
70  $ti = new ilTextInputGUI($lng->txt("title"), "title");
71  $ti->setMaxLength(200);
72  $ti->setSize(50);
73  $ti->setRequired(true);
74  $this->form->addItem($ti);
75 
76  // order nr
77  $ni = new ilNumberInputGUI($lng->txt("skmg_order_nr"), "order_nr");
78  $ni->setMaxLength(6);
79  $ni->setSize(6);
80  $ni->setRequired(true);
81  $this->form->addItem($ni);
82 
83  // save and cancel commands
84  if ($a_mode == "create")
85  {
86  $this->form->addCommandButton("save", $lng->txt("save"));
87  $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
88  $this->form->setTitle($lng->txt("skmg_create_skll"));
89  }
90  else
91  {
92  $this->form->addCommandButton("update", $lng->txt("save"));
93  $this->form->setTitle($lng->txt("skmg_edit_skll"));
94  }
95 
96  $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
97  $this->form->setFormAction($ilCtrl->getFormAction($this));
98  }
99 
106  function setLevelHead()
107  {
108  global $ilTabs, $ilCtrl, $tpl, $lng;
109 
110  // tabs
111  $ilTabs->clearTargets();
112  $ilTabs->setBackTarget($lng->txt("skmg_skill_levels"),
113  $ilCtrl->getLinkTarget($this, "edit"));
114 
115  if ($_GET["level_id"] > 0)
116  {
117  $ilTabs->addTab("level_settings",
118  $lng->txt("settings"),
119  $ilCtrl->getLinkTarget($this, "editLevel"));
120 
121 /* $ilTabs->addTab("level_trigger",
122  $lng->txt("skmg_trigger"),
123  $ilCtrl->getLinkTarget($this, "editLevelTrigger"));
124 
125  $ilTabs->addTab("level_certificate",
126  $lng->txt("certificate"),
127  $ilCtrl->getLinkTargetByClass("ilcertificategui", "certificateEditor"));*/
128  }
129 
130  // title
131  if ($_GET["level_id"] > 0)
132  {
133  $tpl->setTitle($lng->txt("skmg_skill_level").": ".
134  ilBasicSkill::lookupLevelTitle((int) $_GET["level_id"]));
135  }
136  else
137  {
138  $tpl->setTitle($lng->txt("skmg_skill_level"));
139  }
140 
141  include_once("./Services/Skill/classes/class.ilSkillTree.php");
142  $tree = new ilSkillTree();
143  $path = $tree->getPathFull($this->node_object->getId());
144  $desc = "";
145  foreach ($path as $p)
146  {
147  if (in_array($p["type"], array("scat", "skll")))
148  {
149  $desc.= $sep.$p["title"];
150  $sep = " > ";
151  }
152  }
153  $tpl->setDescription($desc);
154  }
155 
162  function setSkillHead($a_tab)
163  {
164  global $ilTabs, $ilCtrl, $tpl, $lng;
165 
166  $ilTabs->clearTargets();
167  $ilTabs->setBackTarget($lng->txt("skmg_skill_templates"),
168  $ilCtrl->getLinkTargetByClass("ilobjskillmanagementgui", "editSkillTemplates"));
169 
170  if (is_object($this->node_object))
171  {
172  $tpl->setTitle($lng->txt("skmg_skill_template").": ".
173  $this->node_object->getTitle());
174 
175  // levels
176  $ilTabs->addTab("levels", $lng->txt("skmg_skill_levels"),
177  $ilCtrl->getLinkTarget($this, 'edit'));
178 
179  // properties
180  $ilTabs->addTab("properties", $lng->txt("settings"),
181  $ilCtrl->getLinkTarget($this, 'editProperties'));
182 
183  $ilTabs->activateTab($a_tab);
184 
185  //$tpl->setTitleIcon(ilUtil::getImagePath("icon_sktp_b.png"), $lng->txt("skmg_skill_template"));
187 
188  $this->setSkillNodeDescription();
189  }
190  else
191  {
192  $tpl->setTitle($lng->txt("skmg_skill"));
193  $tpl->setDescription("");
194  }
195  }
196 
200  function saveItem()
201  {
202  $it = new ilBasicSkillTemplate();
203  $it->setTitle($this->form->getInput("title"));
204  $it->setOrderNr($this->form->getInput("order_nr"));
205  $it->create();
206  ilSkillTreeNode::putInTree($it, (int) $_GET["obj_id"], IL_LAST_NODE);
207  $this->node_object = $it;
208  }
209 
213  function afterSave()
214  {
215  global $ilCtrl;
216 
217  $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id",
218  $this->node_object->getId());
219  $ilCtrl->redirectByClass("ilbasicskilltemplategui", "edit");
220  }
221 
222 }
223 ?>