ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 

Protected Attributes

 $user
 
 $page_layouts
 
- Protected Attributes inherited from ilHierarchyFormGUI
 $lng
 
 $tpl
 
 $ctrl
 
- Protected Attributes inherited from ilFormGUI
 $formaction
 
 $multipart = false
 
 $keepopen = false
 
 $opentag = true
 
 $id
 
 $name
 
 $prevent_double_submission = false
 

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...
 

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 14 of file class.ilChapterHierarchyFormGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ilPageLayout\activeLayouts(), ilPageLayout\MODULE_LM, ilHierarchyFormGUI\setCheckboxName(), and user().

32  {
33  global $DIC;
34 
35  $this->lng = $DIC->language();
36  $this->user = $DIC->user();
37  $this->ctrl = $DIC->ctrl();
38  $this->lm_type = $a_lm_type;
39 
40  $this->lang = ($a_lang == "")
41  ? "-"
42  : $a_lang;
44  $this->setCheckboxName("id");
45 
46  $this->page_layouts = ilPageLayout::activeLayouts(
47  false,
49  );
50  }
setCheckboxName($a_checkboxname)
Set Checkbox Name.
user()
Definition: user.php:4
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
static activeLayouts($a_special_page=false, $a_module=null)
Get active layouts.
+ 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 325 of file class.ilChapterHierarchyFormGUI.php.

References ilHierarchyFormGUI\$ctrl, $ilCtrl, and ilHierarchyFormGUI\$lng.

326  {
327  $lng = $this->lng;
329 
330  $lm_class = "ilobjlearningmodulegui";
331 
332  $commands = array();
333  switch ($a_item["type"]) {
334  case "pg":
335  $ilCtrl->setParameterByClass(
336  "illmpageobjectgui",
337  "obj_id",
338  $a_item["node_id"]
339  );
340  $commands[] = array("text" => $lng->txt("edit"),
341  "link" => $ilCtrl->getLinkTargetByClass(array($lm_class, "illmpageobjectgui"), "edit"));
342  break;
343 
344  case "st":
345  $ilCtrl->setParameterByClass(
346  "ilstructureobjectgui",
347  "obj_id",
348  $a_item["node_id"]
349  );
350  $commands[] = array("text" => $lng->txt("edit"),
351  "link" => $ilCtrl->getLinkTargetByClass(array($lm_class, "ilstructureobjectgui"), "view"));
352  break;
353  }
354 
355  return $commands;
356  }
global $ilCtrl
Definition: ilias.php:18

◆ getChildIcon()

ilChapterHierarchyFormGUI::getChildIcon (   $a_item)

Get icon path for an item.

Parameters
arrayitema array
Returns
string icon path

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

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

256  {
257  $img = "icon_" . $a_item["type"] . ".svg";
258 
259  if ($a_item["type"] == "pg") {
260  $lm_set = new ilSetting("lm");
261  $active = ilLMPage::_lookupActive(
262  $a_item["node_id"],
263  $this->lm_type,
264  $lm_set->get("time_scheduled_page_activation")
265  );
266 
267  // is page scheduled?
268  $img_sc = ($lm_set->get("time_scheduled_page_activation") &&
269  ilLMPage::_isScheduledActivation($a_item["node_id"], $this->lm_type))
270  ? "_sc"
271  : "";
272 
273  $img = "icon_pg" . $img_sc . ".svg";
274 
275  if (!$active) {
276  $img = "icon_pg_d" . $img_sc . ".svg";
277  } else {
279  $a_item["node_id"],
280  $this->lm_type
281  );
282  if ($contains_dis) {
283  $img = "icon_pg_del" . $img_sc . ".svg";
284  }
285  }
286  }
287  return ilUtil::getImagePath($img);
288  }
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 296 of file class.ilChapterHierarchyFormGUI.php.

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

297  {
298  $lng = $this->lng;
299 
300 
301  if ($a_item["type"] == "pg") {
302  $active = ilLMPage::_lookupActive($a_item["node_id"], $this->lm_type);
303 
304  if (!$active) {
305  return $lng->txt("cont_page_deactivated");
306  } else {
308  $a_item["node_id"],
309  $this->lm_type
310  );
311  if ($contains_dis) {
312  return $lng->txt("cont_page_deactivated_elements");
313  }
314  }
315  }
316  return ilUtil::getImagePath("icon_" . $a_item["type"] . ".svg");
317  }
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
+ 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 73 of file class.ilChapterHierarchyFormGUI.php.

74  {
75  if ($this->lang != "-") {
76  return $a_child["title"];
77  }
78  return "";
79  }

◆ getChildTitle()

ilChapterHierarchyFormGUI::getChildTitle (   $a_child)

Get child title.

Parameters

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

59  {
60  if ($this->lang != "-") {
61  $lmobjtrans = new ilLMObjTranslation($a_child["node_id"], $this->lang);
62  return $lmobjtrans->getTitle();
63  }
64  return $a_child["title"];
65  }
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 84 of file class.ilChapterHierarchyFormGUI.php.

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

85  {
86  $lng = $this->lng;
88 
89  $cmds = array();
90 
91  if ($a_childs == null) {
92  $a_childs = [];
93  }
94 
95  if (!$a_first_child) { // drop area of node
96  if ($a_node["type"] == "pg" || ($a_node["type"] == "st" && count($a_childs) == 0 && $this->getMaxDepth() != 0)) {
97  if ($a_node["type"] == "st") {
98  $cmds[] = array("text" => $lng->txt("cont_insert_page"), "cmd" => "insertPage", "multi" => 10,
99  "as_subitem" => true);
100  if (count($this->page_layouts) > 0) {
101  $cmds[] = array("text" => $lng->txt("cont_insert_pagelayout"), "cmd" => "insertTemplate", "multi" => 10,
102  "as_subitem" => true);
103  }
104  if ($ilUser->clipboardHasObjectsOfType("pg")) {
105  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"),
106  "cmd" => "insertPageClip", "as_subitem" => true);
107  }
108  } else {
109  $cmds[] = array("text" => $lng->txt("cont_insert_page"), "cmd" => "insertPage", "multi" => 10);
110  if (count($this->page_layouts) > 0) {
111  $cmds[] = array("text" => $lng->txt("cont_insert_pagelayout"), "cmd" => "insertTemplate", "multi" => 10);
112  }
113  if ($ilUser->clipboardHasObjectsOfType("pg")) {
114  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"),
115  "cmd" => "insertPageClip");
116  }
117  }
118  }
119  if ($a_node["type"] != "pg" && $this->getMaxDepth() != 0) {
120  $cmds[] = array("text" => $lng->txt("cont_insert_subchapter"),
121  "cmd" => "insertSubchapter", "multi" => 10);
122  if ($ilUser->clipboardHasObjectsOfType("st")) {
123  $cmds[] = array("text" => $lng->txt("cont_insert_subchapter_from_clip"),
124  "cmd" => "insertSubchapterClip");
125  }
126  }
127 
128  if (($a_next_sibling["type"] != "pg" && ($a_depth == 0 || $a_next_sibling["type"] == "st"))
129  || $a_node["type"] == "st") {
130  $cmds[] = array("text" => $lng->txt("cont_insert_chapter"),
131  "cmd" => "insertChapter", "multi" => 10);
132  if ($ilUser->clipboardHasObjectsOfType("st")) {
133  $cmds[] = array("text" => $lng->txt("cont_insert_chapter_from_clip"),
134  "cmd" => "insertChapterClip");
135  }
136  }
137  } else { // drop area before first child of node
138  if ($a_node["type"] == "st" && $this->getMaxDepth() != 0) {
139  $cmds[] = array("text" => $lng->txt("cont_insert_page"),
140  "cmd" => "insertPage", "multi" => 10);
141  if (count($this->page_layouts) > 0) {
142  $cmds[] = array("text" => $lng->txt("cont_insert_pagelayout"), "cmd" => "insertTemplate", "multi" => 10);
143  }
144  if ($ilUser->clipboardHasObjectsOfType("pg")) {
145  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"),
146  "cmd" => "insertPageClip");
147  }
148  }
149  if ($a_childs[0]["type"] != "pg") {
150  $cmds[] = array("text" => $lng->txt("cont_insert_chapter"),
151  "cmd" => "insertChapter", "multi" => 10);
152  if ($ilUser->clipboardHasObjectsOfType("st")) {
153  $cmds[] = array("text" => $lng->txt("cont_insert_chapter_from_clip"),
154  "cmd" => "insertChapterClip");
155  }
156  }
157  }
158 
159  return $cmds;
160  }
getMaxDepth()
Get Maximum Depth.
$ilUser
Definition: imgupload.php:18
+ 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 178 of file class.ilChapterHierarchyFormGUI.php.

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

179  {
180  $lng = $this->lng;
181 
182  $this->makeDragContent($a_node["node_id"], "grp_" . $a_node["type"]);
183 
184  if ($a_childs == null) {
185  $a_childs = [];
186  }
187 
188  if (!$a_first_child_drop_area) {
189  if ($a_node["type"] == "pg" || ($a_node["type"] == "st" && count($a_childs) == 0 && $this->getMaxDepth() != 0)) {
190  if ($a_node["type"] == "st") {
191  $this->makeDragTarget(
192  $a_node["node_id"],
193  "grp_pg",
194  $a_first_child_drop_area,
195  true,
196  ""
197  );
198  } else {
199  $this->makeDragTarget(
200  $a_node["node_id"],
201  "grp_pg",
202  $a_first_child_drop_area,
203  false,
204  ""
205  );
206  }
207  }
208 
209  if ($a_node["type"] != "pg" && $this->getMaxDepth() != 0) {
210  $this->makeDragTarget(
211  $a_node["node_id"],
212  "grp_st",
213  $a_first_child_drop_area,
214  true,
215  $lng->txt("cont_insert_as_subchapter")
216  );
217  }
218 
219  if (($a_next_sibling["type"] != "pg" && ($a_depth == 0 || $a_next_sibling["type"] == "st"))
220  || $a_node["type"] == "st") {
221  $this->makeDragTarget(
222  $a_node["node_id"],
223  "grp_st",
224  $a_first_child_drop_area,
225  false,
226  $lng->txt("cont_insert_as_chapter")
227  );
228  }
229  } else {
230  if ($a_node["type"] == "st" && $this->getMaxDepth() != 0) {
231  $this->makeDragTarget(
232  $a_node["node_id"],
233  "grp_pg",
234  $a_first_child_drop_area,
235  true
236  );
237  }
238  if ($a_childs[0]["type"] != "pg") {
239  $this->makeDragTarget(
240  $a_node["node_id"],
241  "grp_st",
242  $a_first_child_drop_area,
243  true
244  );
245  }
246  }
247  }
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.
+ Here is the call graph for this function:

◆ nodeAllowsChilds()

ilChapterHierarchyFormGUI::nodeAllowsChilds (   $a_node)

Which nodes allow child nodes?

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

166  {
167  if ($a_node["type"] == "pg") {
168  return false;
169  }
170  return true;
171  }

Field Documentation

◆ $page_layouts

ilChapterHierarchyFormGUI::$page_layouts
protected

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

◆ $user

ilChapterHierarchyFormGUI::$user
protected

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

Referenced by getMenuItems().


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