ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilChapterHierarchyFormGUI Class Reference

This class represents a hierarchical form. More...

+ Inheritance diagram for ilChapterHierarchyFormGUI:
+ Collaboration diagram for ilChapterHierarchyFormGUI:

Public Member Functions

 __construct ($a_lm_type, $a_lang="-")
 Constructor. More...
 
 getChildTitle ($a_child)
 Get child title. More...
 
 getChildInfo ($a_child)
 Get child info. More...
 
 getMenuItems ($a_node, $a_depth, $a_first_child=false, $a_next_sibling=null, $a_childs=null)
 Get menu items. More...
 
 nodeAllowsChilds ($a_node)
 Which nodes allow child nodes? More...
 
 manageDragAndDrop ($a_node, $a_depth, $a_first_child_drop_area=false, $a_next_sibling=null, $a_childs=null)
 Makes nodes drag and drop content and targets. More...
 
 getChildIcon ($a_item)
 Get icon path for an item. More...
 
 getChildIconAlt ($a_item)
 Get icon alt text. More...
 
 getChildCommands ($a_item)
 Get item commands. More...
 
- Public Member Functions inherited from ilHierarchyFormGUI
 __construct ()
 Constructor. More...
 
 setParentCommand ($a_parent_obj, $a_parent_cmd)
 Set parent gui object/cmd. More...
 
 getParentObject ()
 Get Parent object. More...
 
 getParentCommand ()
 Get parent command. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setTree ($a_tree)
 Set Tree Object. More...
 
 getTree ()
 Get Tree Object. More...
 
 setCurrentTopNodeId ($a_currenttopnodeid)
 Set Current Top Node ID. More...
 
 getCurrentTopNodeId ()
 Get Current Top Node ID. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setIcon ($a_icon)
 Set Icon. More...
 
 getIcon ()
 Get Icon. More...
 
 setCheckboxName ($a_checkboxname)
 Set Checkbox Name. More...
 
 getCheckboxName ()
 Get Checkbox Name. More...
 
 setDragIcon ($a_dragicon)
 Set Drag Icon Path. More...
 
 getDragIcon ()
 Get Drag Icon Path. More...
 
 setMaxDepth ($a_maxdepth)
 Set Maximum Depth. More...
 
 getMaxDepth ()
 Get Maximum Depth. More...
 
 setExplorerUpdater ($a_exp_frame, $a_exp_id, $a_exp_target_script)
 Set Explorer Updater. More...
 
 setTriggeredUpdateCommand ($a_triggered_update_command)
 Set Explorer Updater. More...
 
 addHelpItem ($a_text, $a_image="")
 Get all help items. More...
 
 getHelpItems ()
 Get all help items. More...
 
 makeDragTarget ($a_id, $a_group, $a_first_child_drop_area=false, $a_as_subitem=false, $a_diss_text="")
 Makes a nodes (following droparea) a drag target. More...
 
 makeDragContent ($a_id, $a_group)
 Makes a node a drag content. More...
 
 addMultiCommand ($a_txt, $a_cmd)
 Add a multi command (for selection of items) More...
 
 addCommand ($a_txt, $a_cmd)
 Add a command. More...
 
 setHighlightedNodes ($a_val)
 Set highlighted nodes. More...
 
 getHighlightedNodes ()
 Get highlighted nodes. More...
 
 setFocusId ($a_val)
 Set focus if. More...
 
 getFocusId ()
 Get focus id. More...
 
 setExpandVariable ($a_val)
 Set expand variable. More...
 
 getExpandVariable ()
 Get expand variable. More...
 
 setExpanded ($a_val)
 Set expanded Array. More...
 
 getExpanded ()
 Get expanded array. More...
 
 updateExpanded ()
 Update expand information in session. More...
 
 setTypeWhiteList ($a_val)
 Set type whitelist. More...
 
 getTypeWhiteList ()
 Get type whitelist. More...
 
 getChilds ($a_node_id=false)
 Get all childs of current node. More...
 
 getContent ()
 Get Form Content. More...
 
 getLegend ()
 Get Legend. More...
 
 getLevelHTML ($a_par_node, $a_depth, &$a_childs)
 Get Form HTML. More...
 
 renderChild ($a_tpl, $a_child, $a_depth, $next_sibling=null)
 Render a single child (including grandchilds) More...
 
 getChildIcon ($a_item)
 Get icon path for an item. More...
 
 getChildIconAlt ($a_item)
 Get icon alt text for an item. More...
 
 getChildCommands ($a_item)
 Get item commands. More...
 
 getChildTitle ($a_child)
 Get child title. More...
 
 getChildInfo ($a_child)
 Get child info. More...
 
 getMenuItems ($a_node, $a_depth, $a_first_child=false, $a_next_sibling=null, $a_childs=null)
 Get menu items for drop area of node. More...
 
 nodeAllowsChilds ($a_node)
 Checks, whether current nodes allows childs at all. More...
 
 manageDragAndDrop ($a_node, $a_depth, $a_first_child=false, $a_next_sibling=null, $a_childs=null)
 Makes nodes drag and drop content and targets. More...
 
 getHTML ()
 Get HTML. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction ($a_formaction)
 Set FormAction. More...
 
 getFormAction ()
 Get FormAction. More...
 
 setTarget ($a_target)
 Set Target. More...
 
 getTarget ()
 Get Target. More...
 
 setMultipart ($a_multipart)
 Set Enctype Multipart/Formdata true/false. More...
 
 getMultipart ()
 Get Enctype Multipart/Formdata true/false. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setName ($a_name)
 Set Name. More...
 
 getName ()
 Get Name. More...
 
 setKeepOpen ($a_keepopen)
 Set Keep Form Tag Open. More...
 
 getKeepOpen ()
 Get Keep Form Tag Open. More...
 
 setOpenTag ($a_open)
 Enable/Disable Open Form Tag. More...
 
 getOpenTag ()
 Get Open Form Tag Enabled. More...
 
 setCloseTag ($a_val)
 Set close tag. More...
 
 getCloseTag ()
 Get close tag. More...
 
 setPreventDoubleSubmission ($a_val)
 Set prevent double submission. More...
 
 getPreventDoubleSubmission ()
 Get prevent double submission. More...
 
 getHTML ()
 Get HTML. More...
 
 getContent ()
 Get Content. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilHierarchyFormGUI
static getPostMulti ()
 Get multi number of _POST input. More...
 
static getPostNodeId ()
 Get node ID of _POST input. More...
 
static getPostFirstChild ()
 Should node be inserted as first child of target node (true) or as successor (false) More...
 
static getPostFields ()
 Get all post fields. More...
 
- Protected Attributes inherited from ilFormGUI
 $formaction
 
 $multipart = false
 
 $keepopen = false
 
 $opentag = true
 
 $id
 
 $name
 
 $prevent_double_submission = false
 

Detailed Description

This class represents a hierarchical form.

These forms are used for quick editing, where each node is represented by it's title.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 16 of file class.ilChapterHierarchyFormGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilChapterHierarchyFormGUI::__construct (   $a_lm_type,
  $a_lang = "-" 
)

Constructor.

Parameters

Definition at line 23 of file class.ilChapterHierarchyFormGUI.php.

References ilHierarchyFormGUI\setCheckboxName().

24  {
25  $this->lm_type = $a_lm_type;
26 
27  $this->lang = ($a_lang == "")
28  ? "-"
29  : $a_lang;
30  parent::__construct();
31  $this->setCheckboxName("id");
32  }
setCheckboxName($a_checkboxname)
Set Checkbox Name.
+ Here is the call graph for this function:

Member Function Documentation

◆ getChildCommands()

ilChapterHierarchyFormGUI::getChildCommands (   $a_item)

Get item commands.

Parameters
arrayitem array
Returns
array array of arrays("text", "link")

Definition at line 301 of file class.ilChapterHierarchyFormGUI.php.

References $ilCtrl, $lng, and array.

302  {
303  global $lng, $ilCtrl;
304 
305  $lm_class = "ilobjlearningmodulegui";
306 
307  $commands = array();
308  switch ($a_item["type"])
309  {
310  case "pg":
311  $ilCtrl->setParameterByClass("illmpageobjectgui", "obj_id",
312  $a_item["node_id"]);
313  $commands[] = array("text" => $lng->txt("edit"),
314  "link" => $ilCtrl->getLinkTargetByClass(array($lm_class, "illmpageobjectgui"), "edit"));
315  break;
316 
317  case "st":
318  $ilCtrl->setParameterByClass("ilstructureobjectgui", "obj_id",
319  $a_item["node_id"]);
320  $commands[] = array("text" => $lng->txt("edit"),
321  "link" => $ilCtrl->getLinkTargetByClass(array($lm_class, "ilstructureobjectgui"), "view"));
322  break;
323  }
324 
325  return $commands;
326  }
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17

◆ getChildIcon()

ilChapterHierarchyFormGUI::getChildIcon (   $a_item)

Get icon path for an item.

Parameters
arrayitema array
Returns
string icon path

Definition at line 221 of file class.ilChapterHierarchyFormGUI.php.

References $img, $lm_set, ilPageObject\_isScheduledActivation(), ilPageObject\_lookupActive(), ilPageObject\_lookupContainsDeactivatedElements(), and ilUtil\getImagePath().

222  {
223  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
224 
225  $img = "icon_".$a_item["type"].".svg";
226 
227  if ($a_item["type"] == "pg")
228  {
229  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
230  $lm_set = new ilSetting("lm");
231  $active = ilLMPage::_lookupActive($a_item["node_id"], $this->lm_type,
232  $lm_set->get("time_scheduled_page_activation"));
233 
234  // is page scheduled?
235  $img_sc = ($lm_set->get("time_scheduled_page_activation") &&
236  ilLMPage::_isScheduledActivation($a_item["node_id"], $this->lm_type))
237  ? "_sc"
238  : "";
239 
240  $img = "icon_pg".$img_sc.".svg";
241 
242  if (!$active)
243  {
244  $img = "icon_pg_d".$img_sc.".svg";
245  }
246  else
247  {
248  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
249  $contains_dis = ilLMPage::_lookupContainsDeactivatedElements($a_item["node_id"],
250  $this->lm_type);
251  if ($contains_dis)
252  {
253  $img = "icon_pg_del".$img_sc.".svg";
254  }
255  }
256  }
257  return ilUtil::getImagePath($img);
258  }
ILIAS Setting Class.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupContainsDeactivatedElements($a_id, $a_parent_type, $a_lang="-")
lookup whether page contains deactivated elements
static _isScheduledActivation($a_id, $a_parent_type, $a_lang="-")
Check whether page is activated by time schedule.
$lm_set
+ Here is the call graph for this function:

◆ getChildIconAlt()

ilChapterHierarchyFormGUI::getChildIconAlt (   $a_item)

Get icon alt text.

Parameters
arrayitema array
Returns
string icon alt text

Definition at line 266 of file class.ilChapterHierarchyFormGUI.php.

References $lng, ilPageObject\_lookupActive(), ilPageObject\_lookupContainsDeactivatedElements(), and ilUtil\getImagePath().

267  {
268  global $lng;
269 
270  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
271 
272  if ($a_item["type"] == "pg")
273  {
274  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
275  $active = ilLMPage::_lookupActive($a_item["node_id"], $this->lm_type);
276 
277  if (!$active)
278  {
279  return $lng->txt("cont_page_deactivated");
280  }
281  else
282  {
283  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
284  $contains_dis = ilLMPage::_lookupContainsDeactivatedElements($a_item["node_id"],
285  $this->lm_type);
286  if ($contains_dis)
287  {
288  return $lng->txt("cont_page_deactivated_elements");
289  }
290  }
291  }
292  return ilUtil::getImagePath("icon_".$a_item["type"].".svg");
293  }
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupContainsDeactivatedElements($a_id, $a_parent_type, $a_lang="-")
lookup whether page contains deactivated elements
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ getChildInfo()

ilChapterHierarchyFormGUI::getChildInfo (   $a_child)

Get child info.

Parameters
array$a_childnode array
Returns
string node title

Definition at line 56 of file class.ilChapterHierarchyFormGUI.php.

57  {
58  if ($this->lang != "-")
59  {
60  return $a_child["title"];
61  }
62  return "";
63  }

◆ getChildTitle()

ilChapterHierarchyFormGUI::getChildTitle (   $a_child)

Get child title.

Parameters

Definition at line 40 of file class.ilChapterHierarchyFormGUI.php.

41  {
42  if ($this->lang != "-")
43  {
44  $lmobjtrans = new ilLMObjTranslation($a_child["node_id"], $this->lang);
45  return $lmobjtrans->getTitle();
46  }
47  return $a_child["title"];
48  }
Translation information on lm object.

◆ getMenuItems()

ilChapterHierarchyFormGUI::getMenuItems (   $a_node,
  $a_depth,
  $a_first_child = false,
  $a_next_sibling = null,
  $a_childs = null 
)

Get menu items.

Definition at line 68 of file class.ilChapterHierarchyFormGUI.php.

References $ilUser, $lng, array, and ilHierarchyFormGUI\getMaxDepth().

69  {
70  global $lng, $ilUser;
71 
72  $cmds = array();
73 
74  if (!$a_first_child) // drop area of node
75  {
76  if ($a_node["type"] == "pg" || ($a_node["type"] == "st" && count($a_childs) == 0 && $this->getMaxDepth() != 0))
77  {
78  if ($a_node["type"] == "st")
79  {
80  $cmds[] = array("text" => $lng->txt("cont_insert_page"), "cmd" => "insertPage", "multi" => 10,
81  "as_subitem" => true);
82  if ($ilUser->clipboardHasObjectsOfType("pg"))
83  {
84  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"),
85  "cmd" => "insertPageClip", "as_subitem" => true);
86  }
87  }
88  else
89  {
90  $cmds[] = array("text" => $lng->txt("cont_insert_page"), "cmd" => "insertPage", "multi" => 10);
91  if ($ilUser->clipboardHasObjectsOfType("pg"))
92  {
93  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"),
94  "cmd" => "insertPageClip");
95  }
96  }
97  }
98  if ($a_node["type"] != "pg" && $this->getMaxDepth() != 0)
99  {
100  $cmds[] = array("text" => $lng->txt("cont_insert_subchapter"),
101  "cmd" => "insertSubchapter", "multi" => 10);
102  if ($ilUser->clipboardHasObjectsOfType("st"))
103  {
104  $cmds[] = array("text" => $lng->txt("cont_insert_subchapter_from_clip"),
105  "cmd" => "insertSubchapterClip");
106  }
107  }
108 
109  if (($a_next_sibling["type"] != "pg" && ($a_depth == 0 || $a_next_sibling["type"] == "st"))
110  || $a_node["type"] == "st")
111  {
112  $cmds[] = array("text" => $lng->txt("cont_insert_chapter"),
113  "cmd" => "insertChapter", "multi" => 10);
114  if ($ilUser->clipboardHasObjectsOfType("st"))
115  {
116  $cmds[] = array("text" => $lng->txt("cont_insert_chapter_from_clip"),
117  "cmd" => "insertChapterClip");
118  }
119  }
120  }
121  else // drop area before first child of node
122  {
123  if ($a_node["type"] == "st" && $this->getMaxDepth() != 0)
124  {
125  $cmds[] = array("text" => $lng->txt("cont_insert_page"),
126  "cmd" => "insertPage", "multi" => 10);
127  if ($ilUser->clipboardHasObjectsOfType("pg"))
128  {
129  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"),
130  "cmd" => "insertPageClip");
131  }
132  }
133  if ($a_childs[0]["type"] != "pg")
134  {
135  $cmds[] = array("text" => $lng->txt("cont_insert_chapter"),
136  "cmd" => "insertChapter", "multi" => 10);
137  if ($ilUser->clipboardHasObjectsOfType("st"))
138  {
139  $cmds[] = array("text" => $lng->txt("cont_insert_chapter_from_clip"),
140  "cmd" => "insertChapterClip");
141  }
142  }
143  }
144 
145  return $cmds;
146  }
getMaxDepth()
Get Maximum Depth.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ manageDragAndDrop()

ilChapterHierarchyFormGUI::manageDragAndDrop (   $a_node,
  $a_depth,
  $a_first_child_drop_area = false,
  $a_next_sibling = null,
  $a_childs = null 
)

Makes nodes drag and drop content and targets.

Parameters
object$a_nodenode array

Definition at line 165 of file class.ilChapterHierarchyFormGUI.php.

References $lng, ilHierarchyFormGUI\getMaxDepth(), ilHierarchyFormGUI\makeDragContent(), and ilHierarchyFormGUI\makeDragTarget().

166  {
167  global $lng;
168 
169  $this->makeDragContent($a_node["node_id"], "grp_".$a_node["type"]);
170 
171  if (!$a_first_child_drop_area)
172  {
173  if ($a_node["type"] == "pg" || ($a_node["type"] == "st" && count($a_childs) == 0 && $this->getMaxDepth() != 0))
174  {
175  if ($a_node["type"] == "st")
176  {
177  $this->makeDragTarget($a_node["node_id"], "grp_pg", $a_first_child_drop_area,
178  true, "");
179  }
180  else
181  {
182  $this->makeDragTarget($a_node["node_id"], "grp_pg", $a_first_child_drop_area,
183  false, "");
184  }
185  }
186 
187  if ($a_node["type"] != "pg" && $this->getMaxDepth() != 0)
188  {
189  $this->makeDragTarget($a_node["node_id"], "grp_st", $a_first_child_drop_area,
190  true, $lng->txt("cont_insert_as_subchapter"));
191  }
192 
193  if (($a_next_sibling["type"] != "pg" && ($a_depth == 0 || $a_next_sibling["type"] == "st"))
194  || $a_node["type"] == "st")
195  {
196  $this->makeDragTarget($a_node["node_id"], "grp_st", $a_first_child_drop_area,
197  false, $lng->txt("cont_insert_as_chapter"));
198  }
199  }
200  else
201  {
202  if ($a_node["type"] == "st" && $this->getMaxDepth() != 0)
203  {
204  $this->makeDragTarget($a_node["node_id"], "grp_pg", $a_first_child_drop_area,
205  true);
206  }
207  if ($a_childs[0]["type"] != "pg")
208  {
209  $this->makeDragTarget($a_node["node_id"], "grp_st", $a_first_child_drop_area,
210  true);
211  }
212  }
213  }
makeDragContent($a_id, $a_group)
Makes a node a drag content.
makeDragTarget($a_id, $a_group, $a_first_child_drop_area=false, $a_as_subitem=false, $a_diss_text="")
Makes a nodes (following droparea) a drag target.
getMaxDepth()
Get Maximum Depth.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ nodeAllowsChilds()

ilChapterHierarchyFormGUI::nodeAllowsChilds (   $a_node)

Which nodes allow child nodes?

Definition at line 151 of file class.ilChapterHierarchyFormGUI.php.

152  {
153  if ($a_node["type"] == "pg")
154  {
155  return false;
156  }
157  return true;
158  }

The documentation for this class was generated from the following file: