ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSkillTemplateHFormGUI.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/Form/classes/class.ilHierarchyFormGUI.php");
6 
15 {
19  function __construct()
20  {
21  global $lng;
22 
24  $this->setCheckboxName("id");
25  $lng->loadLanguageModule("skmg");
26  $this->setExpandVariable("sktexpand");
27  $this->setTypeWhiteList(array("skrt", "sktp", "sctp"));
28  }
29 
33  function getMenuItems($a_node, $a_depth, $a_first_child = false, $a_next_sibling = null, $a_childs)
34  {
35  global $lng, $ilUser;
36 
37  $cmds = array();
38 
39  if (!$a_first_child) // drop area of node
40  {
41  // page inserts
42  if ($a_node["type"] == "sktp" || $a_node["type"] == "sctp")
43  {
44  $cmds[] = array("text" => $lng->txt("skmg_insert_basic_skill_template"), "cmd" => "insertBasicSkillTemplate", "multi" => 10);
45  $cmds[] = array("text" => $lng->txt("skmg_insert_skill_template_category"), "cmd" => "insertSkillTemplateCategory", "multi" => 10);
46  if ($ilUser->clipboardHasObjectsOfType("sktp"))
47  {
48  $cmds[] = array("text" => $lng->txt("skmg_insert_basic_skill_template_from_clip"),
49  "cmd" => "insertBasicSkillTemplateClip", "as_subitem" => false);
50  }
51  if ($ilUser->clipboardHasObjectsOfType("sctp"))
52  {
53  $cmds[] = array("text" => $lng->txt("skmg_insert_skill_template_category_from_clip"),
54  "cmd" => "insertSkillTemplateCategoryClip", "as_subitem" => false);
55  }
56  }
57 
58  if ($a_node["type"] == "sctp" || $a_node["type"] == "skrt")
59  {
60  $cmds[] = array("text" => $lng->txt("skmg_insert_basic_skill_template_child"), "cmd" => "insertBasicSkillTemplate", "multi" => 10,
61  "as_subitem" => true);
62  $cmds[] = array("text" => $lng->txt("skmg_insert_skill_template_category_child"), "cmd" => "insertSkillTemplateCategory", "multi" => 10,
63  "as_subitem" => true);
64  if ($ilUser->clipboardHasObjectsOfType("sktp"))
65  {
66  $cmds[] = array("text" => $lng->txt("skmg_insert_basic_skill_template_from_clip_child"),
67  "cmd" => "insertBasicSkillTemplateClip", "as_subitem" => true);
68  }
69  if ($ilUser->clipboardHasObjectsOfType("sctp"))
70  {
71  $cmds[] = array("text" => $lng->txt("skmg_insert_skill_template_category_from_clip_child"),
72  "cmd" => "insertSkillTemplateCategoryClip", "as_subitem" => true);
73  }
74  }
75  }
76  else // drop area before first child of node
77  {
78  if (($a_node["type"] == "skrt" && $a_node["node_id"] == 1)
79  || $a_node["type"] == "sctp")
80  {
81  $cmds[] = array("text" => $lng->txt("skmg_insert_basic_skill_template"), "cmd" => "insertBasicSkillTemplate", "multi" => 10);
82  $cmds[] = array("text" => $lng->txt("skmg_insert_skill_template_category"), "cmd" => "insertSkillTemplateCategory", "multi" => 10);
83  if ($ilUser->clipboardHasObjectsOfType("sktp"))
84  {
85  $cmds[] = array("text" => $lng->txt("skmg_insert_basic_skill_template_from_clip"),
86  "cmd" => "insertBasicSkillTemplateClip", "as_subitem" => false);
87  }
88  if ($ilUser->clipboardHasObjectsOfType("sctp"))
89  {
90  $cmds[] = array("text" => $lng->txt("skmg_insert_skill_template_category_from_clip"),
91  "cmd" => "insertSkillTemplateCategoryClip", "as_subitem" => false);
92  }
93  }
94  }
95 
96  return $cmds;
97  }
98 
102  function nodeAllowsChilds($a_node)
103  {
104  if ($a_node["type"] == "skll" || $a_node["type"] == "sktp")
105  {
106  return false;
107  }
108  return true;
109  }
110 
116  function manageDragAndDrop($a_node, $a_depth, $a_first_child_drop_area = false, $a_next_sibling = null, $a_childs = null)
117  {
118  global $lng;
119 
120  $this->makeDragContent($a_node["node_id"], "grp_".$a_node["type"]);
121 
122  if (!$a_first_child_drop_area)
123  {
124  if ($a_node["type"] == "sktp" || $a_node["type"] == "sctp")
125  {
126  $this->makeDragTarget($a_node["node_id"], "grp_sktp", $a_first_child_drop_area,
127  false, $lng->txt("skmg_insert_on_same_level"));
128  $this->makeDragTarget($a_node["node_id"], "grp_sctp", $a_first_child_drop_area,
129  false, $lng->txt("skmg_insert_on_same_level"));
130  }
131  if ($a_node["type"] == "sctp" || $a_node["type"] == "skrt")
132  {
133  $this->makeDragTarget($a_node["node_id"], "grp_sktp", $a_first_child_drop_area,
134  true, $lng->txt("skmg_insert_as_subitem"));
135  $this->makeDragTarget($a_node["node_id"], "grp_sctp", $a_first_child_drop_area,
136  true, $lng->txt("skmg_insert_as_subitem"));
137  }
138  }
139  else
140  {
141  if (($a_node["type"] == "skrt" && $a_node["node_id"] == 1)
142  || $a_node["type"] == "sctp")
143  {
144  $this->makeDragTarget($a_node["node_id"], "grp_sktp", $a_first_child_drop_area,
145  true, "");
146  $this->makeDragTarget($a_node["node_id"], "grp_sctp", $a_first_child_drop_area,
147  true, "");
148  }
149  }
150  }
151 
158  function getChildCommands($a_item)
159  {
160  global $lng, $ilCtrl;
161 
162  $commands = array();
163 //echo "-".$a_item["type"]."-";
164  switch ($a_item["type"])
165  {
166  case "sctp":
167 /* $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id",
168  $a_item["node_id"]);
169  $commands[] = array("text" => $lng->txt("edit"),
170  "link" => $ilCtrl->getLinkTargetByClass(array("ilobjskillmanagementgui",
171  "ilskilltemplatecategorygui"), "edit"));*/
172  break;
173 
174  case "sktp":
175  $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id",
176  $a_item["node_id"]);
177  $commands[] = array("text" => $lng->txt("edit"),
178  "link" => $ilCtrl->getLinkTargetByClass(array("ilobjskillmanagementgui",
179  "ilbasicskilltemplategui"), "edit"));
180  break;
181 
182  }
183 
184  return $commands;
185  }
186 
187 }