ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
 ilFormGUI ()
 Constructor. More...
 
 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.

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.

References ilHierarchyFormGUI\setCheckboxName().

+ 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")

Reimplemented from ilHierarchyFormGUI.

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

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

References $ilCtrl, and $lng.

◆ getChildIcon()

ilChapterHierarchyFormGUI::getChildIcon (   $a_item)

Get icon path for an item.

Parameters
arrayitema array
Returns
string icon path

Reimplemented from ilHierarchyFormGUI.

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

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 }
258 }
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
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.
ILIAS Setting Class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$lm_set

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

+ 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

Reimplemented from ilHierarchyFormGUI.

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

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 }

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

+ 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

Reimplemented from ilHierarchyFormGUI.

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

return

Reimplemented from ilHierarchyFormGUI.

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.

Reimplemented from ilHierarchyFormGUI.

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

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.
global $ilUser
Definition: imgupload.php:15

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

+ 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

Reimplemented from ilHierarchyFormGUI.

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

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.

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

+ Here is the call graph for this function:

◆ nodeAllowsChilds()

ilChapterHierarchyFormGUI::nodeAllowsChilds (   $a_node)

Which nodes allow child nodes?

Reimplemented from ilHierarchyFormGUI.

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: