ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
 
- 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 16 of file class.ilChapterHierarchyFormGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters

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

References $DIC, ilHierarchyFormGUI\setCheckboxName(), and user().

29  {
30  global $DIC;
31 
32  $this->lng = $DIC->language();
33  $this->user = $DIC->user();
34  $this->ctrl = $DIC->ctrl();
35  $this->lm_type = $a_lm_type;
36 
37  $this->lang = ($a_lang == "")
38  ? "-"
39  : $a_lang;
40  parent::__construct();
41  $this->setCheckboxName("id");
42  }
global $DIC
Definition: saml.php:7
setCheckboxName($a_checkboxname)
Set Checkbox Name.
user()
Definition: user.php:4
+ 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 314 of file class.ilChapterHierarchyFormGUI.php.

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

315  {
316  $lng = $this->lng;
318 
319  $lm_class = "ilobjlearningmodulegui";
320 
321  $commands = array();
322  switch ($a_item["type"]) {
323  case "pg":
324  $ilCtrl->setParameterByClass(
325  "illmpageobjectgui",
326  "obj_id",
327  $a_item["node_id"]
328  );
329  $commands[] = array("text" => $lng->txt("edit"),
330  "link" => $ilCtrl->getLinkTargetByClass(array($lm_class, "illmpageobjectgui"), "edit"));
331  break;
332 
333  case "st":
334  $ilCtrl->setParameterByClass(
335  "ilstructureobjectgui",
336  "obj_id",
337  $a_item["node_id"]
338  );
339  $commands[] = array("text" => $lng->txt("edit"),
340  "link" => $ilCtrl->getLinkTargetByClass(array($lm_class, "ilstructureobjectgui"), "view"));
341  break;
342  }
343 
344  return $commands;
345  }
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 237 of file class.ilChapterHierarchyFormGUI.php.

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

238  {
239  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
240 
241  $img = "icon_" . $a_item["type"] . ".svg";
242 
243  if ($a_item["type"] == "pg") {
244  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
245  $lm_set = new ilSetting("lm");
246  $active = ilLMPage::_lookupActive(
247  $a_item["node_id"],
248  $this->lm_type,
249  $lm_set->get("time_scheduled_page_activation")
250  );
251 
252  // is page scheduled?
253  $img_sc = ($lm_set->get("time_scheduled_page_activation") &&
254  ilLMPage::_isScheduledActivation($a_item["node_id"], $this->lm_type))
255  ? "_sc"
256  : "";
257 
258  $img = "icon_pg" . $img_sc . ".svg";
259 
260  if (!$active) {
261  $img = "icon_pg_d" . $img_sc . ".svg";
262  } else {
263  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
265  $a_item["node_id"],
266  $this->lm_type
267  );
268  if ($contains_dis) {
269  $img = "icon_pg_del" . $img_sc . ".svg";
270  }
271  }
272  }
273  return ilUtil::getImagePath($img);
274  }
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 282 of file class.ilChapterHierarchyFormGUI.php.

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

283  {
284  $lng = $this->lng;
285 
286  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
287 
288  if ($a_item["type"] == "pg") {
289  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
290  $active = ilLMPage::_lookupActive($a_item["node_id"], $this->lm_type);
291 
292  if (!$active) {
293  return $lng->txt("cont_page_deactivated");
294  } else {
295  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
297  $a_item["node_id"],
298  $this->lm_type
299  );
300  if ($contains_dis) {
301  return $lng->txt("cont_page_deactivated_elements");
302  }
303  }
304  }
305  return ilUtil::getImagePath("icon_" . $a_item["type"] . ".svg");
306  }
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 65 of file class.ilChapterHierarchyFormGUI.php.

66  {
67  if ($this->lang != "-") {
68  return $a_child["title"];
69  }
70  return "";
71  }

◆ getChildTitle()

ilChapterHierarchyFormGUI::getChildTitle (   $a_child)

Get child title.

Parameters

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

51  {
52  if ($this->lang != "-") {
53  $lmobjtrans = new ilLMObjTranslation($a_child["node_id"], $this->lang);
54  return $lmobjtrans->getTitle();
55  }
56  return $a_child["title"];
57  }
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 76 of file class.ilChapterHierarchyFormGUI.php.

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

77  {
78  $lng = $this->lng;
80 
81  $cmds = array();
82 
83  if ($a_childs == null) {
84  $a_childs = [];
85  }
86 
87  if (!$a_first_child) { // drop area of node
88  if ($a_node["type"] == "pg" || ($a_node["type"] == "st" && count($a_childs) == 0 && $this->getMaxDepth() != 0)) {
89  if ($a_node["type"] == "st") {
90  $cmds[] = array("text" => $lng->txt("cont_insert_page"), "cmd" => "insertPage", "multi" => 10,
91  "as_subitem" => true);
92  if ($ilUser->clipboardHasObjectsOfType("pg")) {
93  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"),
94  "cmd" => "insertPageClip", "as_subitem" => true);
95  }
96  } else {
97  $cmds[] = array("text" => $lng->txt("cont_insert_page"), "cmd" => "insertPage", "multi" => 10);
98  if ($ilUser->clipboardHasObjectsOfType("pg")) {
99  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"),
100  "cmd" => "insertPageClip");
101  }
102  }
103  }
104  if ($a_node["type"] != "pg" && $this->getMaxDepth() != 0) {
105  $cmds[] = array("text" => $lng->txt("cont_insert_subchapter"),
106  "cmd" => "insertSubchapter", "multi" => 10);
107  if ($ilUser->clipboardHasObjectsOfType("st")) {
108  $cmds[] = array("text" => $lng->txt("cont_insert_subchapter_from_clip"),
109  "cmd" => "insertSubchapterClip");
110  }
111  }
112 
113  if (($a_next_sibling["type"] != "pg" && ($a_depth == 0 || $a_next_sibling["type"] == "st"))
114  || $a_node["type"] == "st") {
115  $cmds[] = array("text" => $lng->txt("cont_insert_chapter"),
116  "cmd" => "insertChapter", "multi" => 10);
117  if ($ilUser->clipboardHasObjectsOfType("st")) {
118  $cmds[] = array("text" => $lng->txt("cont_insert_chapter_from_clip"),
119  "cmd" => "insertChapterClip");
120  }
121  }
122  } else { // drop area before first child of node
123  if ($a_node["type"] == "st" && $this->getMaxDepth() != 0) {
124  $cmds[] = array("text" => $lng->txt("cont_insert_page"),
125  "cmd" => "insertPage", "multi" => 10);
126  if ($ilUser->clipboardHasObjectsOfType("pg")) {
127  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"),
128  "cmd" => "insertPageClip");
129  }
130  }
131  if ($a_childs[0]["type"] != "pg") {
132  $cmds[] = array("text" => $lng->txt("cont_insert_chapter"),
133  "cmd" => "insertChapter", "multi" => 10);
134  if ($ilUser->clipboardHasObjectsOfType("st")) {
135  $cmds[] = array("text" => $lng->txt("cont_insert_chapter_from_clip"),
136  "cmd" => "insertChapterClip");
137  }
138  }
139  }
140 
141  return $cmds;
142  }
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 160 of file class.ilChapterHierarchyFormGUI.php.

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

161  {
162  $lng = $this->lng;
163 
164  $this->makeDragContent($a_node["node_id"], "grp_" . $a_node["type"]);
165 
166  if ($a_childs == null) {
167  $a_childs = [];
168  }
169 
170  if (!$a_first_child_drop_area) {
171  if ($a_node["type"] == "pg" || ($a_node["type"] == "st" && count($a_childs) == 0 && $this->getMaxDepth() != 0)) {
172  if ($a_node["type"] == "st") {
173  $this->makeDragTarget(
174  $a_node["node_id"],
175  "grp_pg",
176  $a_first_child_drop_area,
177  true,
178  ""
179  );
180  } else {
181  $this->makeDragTarget(
182  $a_node["node_id"],
183  "grp_pg",
184  $a_first_child_drop_area,
185  false,
186  ""
187  );
188  }
189  }
190 
191  if ($a_node["type"] != "pg" && $this->getMaxDepth() != 0) {
192  $this->makeDragTarget(
193  $a_node["node_id"],
194  "grp_st",
195  $a_first_child_drop_area,
196  true,
197  $lng->txt("cont_insert_as_subchapter")
198  );
199  }
200 
201  if (($a_next_sibling["type"] != "pg" && ($a_depth == 0 || $a_next_sibling["type"] == "st"))
202  || $a_node["type"] == "st") {
203  $this->makeDragTarget(
204  $a_node["node_id"],
205  "grp_st",
206  $a_first_child_drop_area,
207  false,
208  $lng->txt("cont_insert_as_chapter")
209  );
210  }
211  } else {
212  if ($a_node["type"] == "st" && $this->getMaxDepth() != 0) {
213  $this->makeDragTarget(
214  $a_node["node_id"],
215  "grp_pg",
216  $a_first_child_drop_area,
217  true
218  );
219  }
220  if ($a_childs[0]["type"] != "pg") {
221  $this->makeDragTarget(
222  $a_node["node_id"],
223  "grp_st",
224  $a_first_child_drop_area,
225  true
226  );
227  }
228  }
229  }
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 147 of file class.ilChapterHierarchyFormGUI.php.

148  {
149  if ($a_node["type"] == "pg") {
150  return false;
151  }
152  return true;
153  }

Field Documentation

◆ $user

ilChapterHierarchyFormGUI::$user
protected

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

Referenced by getMenuItems().


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