ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilChapterHierarchyFormGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (string $a_lm_type, string $a_lang="-")
 
 getChildTitle (array $a_child)
 
 getChildInfo (array $a_child)
 Get child info. More...
 
 getMenuItems (array $a_node, int $a_depth, bool $a_first_child=false, ?array $a_next_sibling=null, ?array $a_childs=null)
 Get menu items. More...
 
 nodeAllowsChilds (array $a_node)
 Which nodes allow child nodes? More...
 
 manageDragAndDrop (array $a_node, int $a_depth, bool $a_first_child=false, ?array $a_next_sibling=null, ?array $a_childs=null)
 Makes nodes drag and drop content and targets. More...
 
 getChildIcon (array $a_item)
 Get icon path for an item. More...
 
 getChildIconAlt (array $a_item)
 Get icon alt text. More...
 
 getChildCommands (array $a_item)
 Get item commands. More...
 
- Public Member Functions inherited from ilHierarchyFormGUI
 __construct ()
 
 setParentCommand (object $a_parent_obj, string $a_parent_cmd)
 
 getParentObject ()
 
 getParentCommand ()
 
 setId (string $a_id)
 
 getId ()
 
 setTree (ilTree $a_tree)
 
 getTree ()
 
 setCurrentTopNodeId (int $a_currenttopnodeid)
 
 getCurrentTopNodeId ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setIcon (string $a_icon)
 
 getIcon ()
 
 setCheckboxName (string $a_checkboxname)
 
 getCheckboxName ()
 
 setDragIcon (string $a_dragicon)
 
 getDragIcon ()
 
 setMaxDepth (int $a_maxdepth)
 
 getMaxDepth ()
 
 setExplorerUpdater (string $a_exp_frame, string $a_exp_id, string $a_exp_target_script)
 
 setTriggeredUpdateCommand (string $a_triggered_update_command)
 
 addHelpItem (string $a_text, string $a_image="")
 
 getHelpItems ()
 
 makeDragTarget (string $a_id, string $a_group, bool $a_first_child_drop_area=false, bool $a_as_subitem=false, string $a_diss_text="")
 
 makeDragContent (string $a_id, string $a_group)
 
 addMultiCommand (string $a_txt, string $a_cmd)
 
 addCommand (string $a_txt, string $a_cmd)
 
 setHighlightedNodes (array $a_val)
 
 getHighlightedNodes ()
 
 setFocusId (string $a_val)
 
 getFocusId ()
 
 setExpandVariable (string $a_val)
 
 getExpandVariable ()
 
 setExpanded (array $a_val)
 
 getExpanded ()
 
 updateExpanded ()
 
 setTypeWhiteList (array $a_val)
 
 getTypeWhiteList ()
 
 getChilds (?int $a_node_id=null)
 Get all childs of current node. More...
 
 getContent ()
 
 getLegend ()
 
 getLevelHTML (array $a_par_node, int $a_depth, array &$a_childs)
 
 renderChild (ilTemplate $a_tpl, array $a_child, int $a_depth, ?array $next_sibling=null)
 Render a single child (including grandchilds) More...
 
 getChildIcon (array $a_item)
 
 getChildIconAlt (array $a_item)
 
 getChildCommands (array $a_item)
 
 getChildTitle (array $a_child)
 
 getChildInfo (array $a_child)
 
 getMenuItems (array $a_node, int $a_depth, bool $a_first_child=false, ?array $a_next_sibling=null, ?array $a_childs=null)
 Get menu items for drop area of node. More...
 
 nodeAllowsChilds (array $a_node)
 Checks, whether current nodes allows childs at all. More...
 
 manageDragAndDrop (array $a_node, int $a_depth, bool $a_first_child=false, ?array $a_next_sibling=null, ?array $a_childs=null)
 Makes nodes drag and drop content and targets. More...
 
 getHTML ()
 
- Public Member Functions inherited from ilFormGUI
 setFormAction (string $a_formaction)
 
 getFormAction ()
 
 setTarget (string $a_target)
 
 getTarget ()
 
 setMultipart (bool $a_multipart)
 
 getMultipart ()
 
 setId (string $a_id)
 
 getId ()
 
 setName (string $a_name)
 
 getName ()
 
 setKeepOpen (bool $a_keepopen)
 
 getKeepOpen ()
 
 setOpenTag (bool $a_open)
 
 getOpenTag ()
 
 setCloseTag (bool $a_val)
 
 getCloseTag ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 getHTML ()
 
 getContent ()
 

Protected Attributes

ilObjUser $user
 
array $page_layouts
 
string $lang
 
string $lm_type
 
- Protected Attributes inherited from ilHierarchyFormGUI
ilGlobalTemplateInterface $main_tpl
 
string $exp_target_script = ""
 
string $icon = ""
 
string $exp_id = ""
 
ilLanguage $lng
 
ilCtrl $ctrl
 
string $expand_variable = ""
 
array $white_list = null
 
array $highlighted_nodes = []
 
string $focus_id = ""
 
string $exp_frame = ""
 
string $triggered_update_command = ""
 
array $drag_target = []
 
array $drag_content = []
 
object $parent_obj
 
string $parent_cmd = ""
 
ilTree $tree
 
int $currenttopnodeid = 0
 
string $title = ""
 
string $checkboxname = ""
 
string $dragicon = ""
 
int $maxdepth = 0
 
array $help_items = []
 
array $diss_menues = []
 
array $multi_commands = []
 
array $commands = []
 
array $expanded = []
 
HTTP Services $http
 
Refinery Factory $refinery
 
- Protected Attributes inherited from ilFormGUI
string $formaction = ""
 
bool $multipart = false
 
bool $keepopen = false
 
bool $opentag = true
 
string $id = ''
 
string $name = ''
 
string $target = ''
 
bool $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 ()
 
- Protected Member Functions inherited from ilHierarchyFormGUI
 str ($key)
 
- Static Protected Member Functions inherited from ilHierarchyFormGUI
static _str ($key)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning This class represents a hierarchical form. These forms are used for quick editing, where each node is represented by it's title.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

33  {
34  global $DIC;
35 
36  $this->lng = $DIC->language();
37  $this->user = $DIC->user();
38  $this->ctrl = $DIC->ctrl();
39  $this->lm_type = $a_lm_type;
40 
41  $this->lang = ($a_lang == "")
42  ? "-"
43  : $a_lang;
45  $this->setCheckboxName("id");
46 
47  $this->page_layouts = ilPageLayout::activeLayouts(
49  );
50  }
setCheckboxName(string $a_checkboxname)
static activeLayouts(int $a_module=0)
Get active layouts.
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getChildCommands()

ilChapterHierarchyFormGUI::getChildCommands ( array  $a_item)

Get item commands.

Parameters
array$a_item
Returns
array

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

References ilHierarchyFormGUI\$commands, ilHierarchyFormGUI\$ctrl, ilHierarchyFormGUI\$lng, and ilLanguage\txt().

323  : array
324  {
325  $lng = $this->lng;
326  $ilCtrl = $this->ctrl;
327 
328  $lm_class = "ilobjlearningmodulegui";
329 
330  $commands = array();
331  switch ($a_item["type"]) {
332  case "pg":
333  $ilCtrl->setParameterByClass(
334  "illmpageobjectgui",
335  "obj_id",
336  $a_item["node_id"]
337  );
338  $commands[] = array("text" => $lng->txt("edit"),
339  "link" => $ilCtrl->getLinkTargetByClass(array($lm_class, "illmpageobjectgui"), "edit"));
340  break;
341 
342  case "st":
343  $ilCtrl->setParameterByClass(
344  "ilstructureobjectgui",
345  "obj_id",
346  $a_item["node_id"]
347  );
348  $commands[] = array("text" => $lng->txt("edit"),
349  "link" => $ilCtrl->getLinkTargetByClass(array($lm_class, "ilstructureobjectgui"), "view"));
350  break;
351  }
352 
353  return $commands;
354  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ getChildIcon()

ilChapterHierarchyFormGUI::getChildIcon ( array  $a_item)

Get icon path for an item.

Parameters
array$a_itemitema array
Returns
string icon path

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

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

252  : string
253  {
254  $img = "icon_" . $a_item["type"] . ".svg";
255 
256  if ($a_item["type"] == "pg") {
257  $lm_set = new ilSetting("lm");
258  $active = ilLMPage::_lookupActive(
259  $a_item["node_id"],
260  $this->lm_type,
261  (bool) $lm_set->get("time_scheduled_page_activation")
262  );
263 
264  // is page scheduled?
265  $img_sc = ($lm_set->get("time_scheduled_page_activation") &&
266  ilLMPage::_isScheduledActivation($a_item["node_id"], $this->lm_type))
267  ? "_sc"
268  : "";
269 
270  $img = "icon_pg" . $img_sc . ".svg";
271 
272  if (!$active) {
273  $img = "icon_pg_d" . $img_sc . ".svg";
274  } else {
276  $a_item["node_id"],
277  $this->lm_type
278  );
279  if ($contains_dis) {
280  $img = "icon_pg_del" . $img_sc . ".svg";
281  }
282  }
283  }
284  return ilUtil::getImagePath($img);
285  }
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
static _isScheduledActivation(int $a_id, string $a_parent_type, string $a_lang="-")
Check whether page is activated by time schedule.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static _lookupContainsDeactivatedElements(int $a_id, string $a_parent_type, string $a_lang="-")
lookup whether page contains deactivated elements
$img
Definition: imgupload.php:83
$lm_set
+ Here is the call graph for this function:

◆ getChildIconAlt()

ilChapterHierarchyFormGUI::getChildIconAlt ( array  $a_item)

Get icon alt text.

Parameters
array$a_itemitema array
Returns
string icon alt text

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

References ilHierarchyFormGUI\$lng, ilPageObject\_lookupActive(), ilPageObject\_lookupContainsDeactivatedElements(), and ilLanguage\txt().

293  : string
294  {
295  $lng = $this->lng;
296 
297 
298  if ($a_item["type"] == "pg") {
299  $active = ilLMPage::_lookupActive($a_item["node_id"], $this->lm_type);
300 
301  if (!$active) {
302  return $lng->txt("cont_page_deactivated");
303  } else {
305  $a_item["node_id"],
306  $this->lm_type
307  );
308  if ($contains_dis) {
309  return $lng->txt("cont_page_deactivated_elements");
310  }
311  }
312  return $lng->txt("pg");
313  }
314  return $lng->txt("st");
315  ;
316  }
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupContainsDeactivatedElements(int $a_id, string $a_parent_type, string $a_lang="-")
lookup whether page contains deactivated elements
+ Here is the call graph for this function:

◆ getChildInfo()

ilChapterHierarchyFormGUI::getChildInfo ( array  $a_child)

Get child info.

Parameters
array$a_childnode array
Returns
string node title

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

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

◆ getChildTitle()

ilChapterHierarchyFormGUI::getChildTitle ( array  $a_child)

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

52  : string
53  {
54  if ($this->lang != "-") {
55  $lmobjtrans = new ilLMObjTranslation($a_child["node_id"], $this->lang);
56  return $lmobjtrans->getTitle();
57  }
58  return $a_child["title"];
59  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getMenuItems()

ilChapterHierarchyFormGUI::getMenuItems ( array  $a_node,
int  $a_depth,
bool  $a_first_child = false,
?array  $a_next_sibling = null,
?array  $a_childs = null 
)

Get menu items.

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

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

77  : array
78  {
79  $lng = $this->lng;
81 
82  $cmds = array();
83 
84  if ($a_childs == null) {
85  $a_childs = [];
86  }
87 
88  if (!$a_first_child) { // drop area of node
89  if ($a_node["type"] == "pg" || ($a_node["type"] == "st" && count($a_childs) == 0 && $this->getMaxDepth() != 0)) {
90  if ($a_node["type"] == "st") {
91  $cmds[] = array("text" => $lng->txt("cont_insert_page"), "cmd" => "insertPage", "multi" => 10,
92  "as_subitem" => true);
93  if (count($this->page_layouts) > 0) {
94  $cmds[] = array("text" => $lng->txt("cont_insert_pagelayout"), "cmd" => "insertTemplate", "multi" => 10,
95  "as_subitem" => true);
96  }
97  if ($ilUser->clipboardHasObjectsOfType("pg")) {
98  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"), "multi" => 0,
99  "cmd" => "insertPageClip", "as_subitem" => true);
100  }
101  } else {
102  $cmds[] = array("text" => $lng->txt("cont_insert_page"), "cmd" => "insertPage", "multi" => 10);
103  if (count($this->page_layouts) > 0) {
104  $cmds[] = array("text" => $lng->txt("cont_insert_pagelayout"), "cmd" => "insertTemplate", "multi" => 10);
105  }
106  if ($ilUser->clipboardHasObjectsOfType("pg")) {
107  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"), "multi" => 0,
108  "cmd" => "insertPageClip");
109  }
110  }
111  }
112  if ($a_node["type"] != "pg" && $this->getMaxDepth() != 0) {
113  $cmds[] = array("text" => $lng->txt("cont_insert_subchapter"),
114  "cmd" => "insertSubchapter", "multi" => 10);
115  if ($ilUser->clipboardHasObjectsOfType("st")) {
116  $cmds[] = array("text" => $lng->txt("cont_insert_subchapter_from_clip"), "multi" => 0,
117  "cmd" => "insertSubchapterClip");
118  }
119  }
120 
121  if ((($a_next_sibling["type"] ?? "") != "pg" && ($a_depth == 0 || ($a_next_sibling["type"] ?? "") == "st"))
122  || $a_node["type"] == "st") {
123  $cmds[] = array("text" => $lng->txt("cont_insert_chapter"),
124  "cmd" => "insertChapter",
125  "multi" => 10
126  );
127  if ($ilUser->clipboardHasObjectsOfType("st")) {
128  $cmds[] = array("text" => $lng->txt("cont_insert_chapter_from_clip"),
129  "cmd" => "insertChapterClip", "multi" => 0
130  );
131  }
132  }
133  } else { // drop area before first child of node
134  if ($a_node["type"] == "st" && $this->getMaxDepth() != 0) {
135  $cmds[] = array("text" => $lng->txt("cont_insert_page"),
136  "cmd" => "insertPage", "multi" => 10);
137  if (count($this->page_layouts) > 0) {
138  $cmds[] = array("text" => $lng->txt("cont_insert_pagelayout"), "cmd" => "insertTemplate", "multi" => 10);
139  }
140  if ($ilUser->clipboardHasObjectsOfType("pg")) {
141  $cmds[] = array("text" => $lng->txt("cont_insert_page_from_clip"),"multi" => 0,
142  "cmd" => "insertPageClip");
143  }
144  }
145  if (($a_childs[0]["type"] ?? "") != "pg") {
146  $cmds[] = array("text" => $lng->txt("cont_insert_chapter"),
147  "cmd" => "insertChapter", "multi" => 10);
148  if ($ilUser->clipboardHasObjectsOfType("st")) {
149  $cmds[] = array("text" => $lng->txt("cont_insert_chapter_from_clip"),"multi" => 0,
150  "cmd" => "insertChapterClip");
151  }
152  }
153  }
154 
155  return $cmds;
156  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:

◆ manageDragAndDrop()

ilChapterHierarchyFormGUI::manageDragAndDrop ( array  $a_node,
int  $a_depth,
bool  $a_first_child = false,
?array  $a_next_sibling = null,
?array  $a_childs = null 
)

Makes nodes drag and drop content and targets.

Parameters
array$a_nodenode array

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

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

173  : void
174  {
175  $lng = $this->lng;
176 
177  $this->makeDragContent($a_node["node_id"], "grp_" . $a_node["type"]);
178 
179  if ($a_childs == null) {
180  $a_childs = [];
181  }
182 
183  if (!$a_first_child) {
184  if ($a_node["type"] == "pg" || ($a_node["type"] == "st" && count($a_childs) == 0 && $this->getMaxDepth() != 0)) {
185  if ($a_node["type"] == "st") {
186  $this->makeDragTarget(
187  $a_node["node_id"],
188  "grp_pg",
189  $a_first_child,
190  true,
191  ""
192  );
193  } else {
194  $this->makeDragTarget(
195  $a_node["node_id"],
196  "grp_pg",
197  $a_first_child,
198  false,
199  ""
200  );
201  }
202  }
203 
204  if ($a_node["type"] != "pg" && $this->getMaxDepth() != 0) {
205  $this->makeDragTarget(
206  $a_node["node_id"],
207  "grp_st",
208  $a_first_child,
209  true,
210  $lng->txt("cont_insert_as_subchapter")
211  );
212  }
213 
214  if ($a_next_sibling) {
215  if (($a_next_sibling["type"] != "pg" && ($a_depth == 0 || $a_next_sibling["type"] == "st"))
216  || $a_node["type"] == "st") {
217  $this->makeDragTarget(
218  $a_node["node_id"],
219  "grp_st",
220  $a_first_child,
221  false,
222  $lng->txt("cont_insert_as_chapter")
223  );
224  }
225  }
226  } else {
227  if ($a_node["type"] == "st" && $this->getMaxDepth() != 0) {
228  $this->makeDragTarget(
229  $a_node["node_id"],
230  "grp_pg",
231  $a_first_child,
232  true
233  );
234  }
235  if (($a_childs[0]["type"] ?? "") != "pg") {
236  $this->makeDragTarget(
237  $a_node["node_id"],
238  "grp_st",
239  $a_first_child,
240  true
241  );
242  }
243  }
244  }
makeDragContent(string $a_id, string $a_group)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
makeDragTarget(string $a_id, string $a_group, bool $a_first_child_drop_area=false, bool $a_as_subitem=false, string $a_diss_text="")
+ Here is the call graph for this function:

◆ nodeAllowsChilds()

ilChapterHierarchyFormGUI::nodeAllowsChilds ( array  $a_node)

Which nodes allow child nodes?

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

161  : bool
162  {
163  if ($a_node["type"] == "pg") {
164  return false;
165  }
166  return true;
167  }

Field Documentation

◆ $lang

string ilChapterHierarchyFormGUI::$lang
protected

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

◆ $lm_type

string ilChapterHierarchyFormGUI::$lm_type
protected

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

◆ $page_layouts

array ilChapterHierarchyFormGUI::$page_layouts
protected

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

◆ $user

ilObjUser ilChapterHierarchyFormGUI::$user
protected

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

Referenced by getMenuItems().


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