ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLSTOCGUI Class Reference

Tree-GUI for ToC. More...

+ Inheritance diagram for ilLSTOCGUI:
+ Collaboration diagram for ilLSTOCGUI:

Public Member Functions

 __construct (LSUrlBuilder $url_builder, ilCtrl $il_ctrl)
 
 withStructure (string $json_structure)
 
 getRootNode ()
 
 getChildsOfNode ($a_parent_node_id)
 
 getNodeContent ($a_node)
 
 getNodeIcon ($a_node)
 
 getNodeId ($a_node)
 
 getNodeHref ($a_node)
 
 isNodeClickable ($a_node)
 
 isNodeHighlighted ($a_node)
 
- Public Member Functions inherited from ilExplorerBaseGUI
 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd)
 Constructor. More...
 
 setChildLimit ($a_val)
 Set child limit. More...
 
 getChildLimit ()
 Get child limit. More...
 
 setSearchTerm ($a_val)
 Set search term. More...
 
 getSearchTerm ()
 Get search term. More...
 
 setMainTemplate ($a_main_tpl=null)
 Set main template (that is responsible for adding js/css) More...
 
 getRootNode ()
 Get root node. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 getNodeContent ($a_node)
 Get content of a node. More...
 
 getNodeId ($a_node)
 Get id of a node. More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
 nodeHasVisibleChilds ($a_node)
 Node has childs? More...
 
 sortChilds ($a_childs, $a_parent_node_id)
 Sort childs. More...
 
 getNodeIcon ($a_node)
 Get node icon path. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getNodeTarget ($a_node)
 Get node target (frame) attribute. More...
 
 getNodeOnClick ($a_node)
 Get node onclick attribute. More...
 
 isNodeVisible ($a_node)
 Is node visible? More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
 isNodeClickable ($a_node)
 Is node clickable? More...
 
 getId ()
 Get id of explorer element. More...
 
 setSkipRootNode ($a_val)
 Set skip root node. More...
 
 getSkipRootNode ()
 Get skip root node. More...
 
 setAjax ($a_val)
 Set ajax. More...
 
 getAjax ()
 Get ajax. More...
 
 setSecondaryHighlightedNodes ($a_val)
 Set secondary (background) highlighted nodes. More...
 
 getSecondaryHighlightedNodes ()
 Get secondary (background) highlighted nodes. More...
 
 setNodeOpen ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setSelectMode ($a_postvar, $a_multi=false)
 Set select mode (to deactivate, pass an empty string as postvar) More...
 
 setNodeSelected ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setOfflineMode ($a_val)
 Set offline mode. More...
 
 getOfflineMode ()
 Get offline mode. More...
 
 handleCommand ()
 Handle explorer internal command. More...
 
 getContainerId ()
 Get container id. More...
 
 openNode ()
 Open node. More...
 
 closeNode ()
 Close node. More...
 
 getNodeAsync ()
 Get node asynchronously. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getOnLoadCode ()
 Get on load code. More...
 
 getHTML ()
 Get HTML. More...
 
 renderNode ($a_node, $tpl)
 Render node. More...
 
 renderChilds ($a_node_id, $tpl)
 Render childs. More...
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id. More...
 
 getNodeIdForDomNodeId ($a_dom_node_id)
 Get node id for dom node id. More...
 
 listItemStart ($tpl, $a_node)
 List item start. More...
 
 listItemEnd ($tpl)
 List item end. More...
 
 listStart ($tpl)
 List start. More...
 
 listEnd ($tpl)
 List end. More...
 
 isNodeOnclickEnabled ()
 
 setNodeOnclickEnabled ($nodeOnclickEnabled)
 
 isEnableDnd ()
 
 setEnableDnd ($enable_dnd)
 Enable Drag & Drop functionality. More...
 

Data Fields

const NODE_ICONS
 

Protected Member Functions

 addIds (array $node)
 
 buildLookup (array $node)
 
- Protected Member Functions inherited from ilExplorerBaseGUI
 isNodeSelectable ($a_node)
 Is node selectable? More...
 
 getNodeToggleOnClick ($a_node)
 Get onclick attribute for node toggling. More...
 
 getSelectOnClick ($a_node)
 Get onclick attribute for selecting radio/checkbox. More...
 
 isNodeOpen ($node_id)
 Get all open nodes. More...
 
 getJSTreePlugins ()
 

Protected Attributes

 $id = 'ls_toc'
 
 $structure
 
 $nodes = []
 
 $url_builder
 
 $node_icons
 
 $counter = 0
 
- Protected Attributes inherited from ilExplorerBaseGUI
 $log
 
 $ctrl
 
 $tpl
 
 $skip_root_node = false
 
 $ajax = false
 
 $custom_open_nodes = array()
 
 $selected_nodes = array()
 
 $select_postvar = ""
 
 $offline_mode = false
 
 $sec_highl_nodes = array()
 
 $enable_dnd = false
 
 $search_term = ""
 
 $open_nodes = []
 
 $store
 
 $parent_obj
 
 $child_limit = 0
 
 $parent_cmd = ''
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 Get local path of explorer js. More...
 
static getLocalJsTreeJsPath ()
 Get local path of jsTree js. More...
 
static getLocalJsTreeCssPath ()
 Get local path of jsTree js. More...
 
static createHTMLExportDirs ($a_target_dir)
 Create html export directories. More...
 
static init ($a_main_tpl=null)
 Init JS. More...
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static $js_tree_path = "./node_modules/jstree/dist/jstree.js"
 
static $js_tree_path_css = "./node_modules/jstree/dist/themes/default/style.min.css"
 
static $js_expl_path = "./Services/UIComponent/Explorer2/js/Explorer2.js"
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLSTOCGUI::__construct ( LSUrlBuilder  $url_builder,
ilCtrl  $il_ctrl 
)

Definition at line 43 of file class.ilLSTOCGUI.php.

References $url_builder, ILIAS\GlobalScreen\Provider\__construct(), ilLPStatusIcons\getInstance(), ilLPStatusIcons\ICON_VARIANT_SHORT, ilExplorerBaseGUI\setNodeOnclickEnabled(), and ilExplorerBaseGUI\setSkipRootNode().

46  {
47  parent::__construct("lsq_toc", null, "");
48  $this->url_builder = $url_builder;
49  $this->ctrl = $il_ctrl; //ilExplorerBaseGUI needs ctrl...
50  $this->setSkipRootNode(false);
51  $this->setNodeOnclickEnabled(true);
52 
53  //get the image paths to the node icons
55  $this->node_icons[TOCBuilder::LP_NOT_STARTED] = $lp_icons->getImagePathNotAttempted();
56  $this->node_icons[TOCBuilder::LP_COMPLETED] = $lp_icons->getImagePathCompleted();
57  $this->node_icons[TOCBuilder::LP_IN_PROGRESS] = $lp_icons->getImagePathInProgress();
58  $this->node_icons[TOCBuilder::LP_FAILED] = $lp_icons->getImagePathFailed();
59  }
setSkipRootNode($a_val)
Set skip root node.
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
__construct(Container $dic, ilPlugin $plugin)
setNodeOnclickEnabled($nodeOnclickEnabled)
+ Here is the call graph for this function:

Member Function Documentation

◆ addIds()

ilLSTOCGUI::addIds ( array  $node)
protected

Definition at line 73 of file class.ilLSTOCGUI.php.

References $counter.

73  : array
74  {
75  $node['_id'] = $this->counter;
76  $this->counter++;
77  if (array_key_exists('childs', $node)) {
78  foreach ($node['childs'] as $idx => $child) {
79  $node['childs'][$idx] = $this->addIds($child);
80  }
81  }
82  return $node;
83  }
addIds(array $node)

◆ buildLookup()

ilLSTOCGUI::buildLookup ( array  $node)
protected

Definition at line 85 of file class.ilLSTOCGUI.php.

86  {
87  $this->nodes[$node['_id']] = $node;
88  if (array_key_exists('childs', $node)) {
89  foreach ($node['childs'] as $child) {
90  $this->buildLookup($child);
91  }
92  }
93  }
buildLookup(array $node)

◆ getChildsOfNode()

ilLSTOCGUI::getChildsOfNode (   $a_parent_node_id)

Definition at line 106 of file class.ilLSTOCGUI.php.

107  {
108  $parent_node = $this->nodes[$a_parent_node_id];
109  return (array) $parent_node['childs'];
110  }

◆ getNodeContent()

ilLSTOCGUI::getNodeContent (   $a_node)

Definition at line 115 of file class.ilLSTOCGUI.php.

116  {
117  return $a_node['label'];
118  }

◆ getNodeHref()

ilLSTOCGUI::getNodeHref (   $a_node)

Definition at line 140 of file class.ilLSTOCGUI.php.

141  {
142  return $this->url_builder->getHref($a_node['command'], $a_node['parameter']);
143  }

◆ getNodeIcon()

ilLSTOCGUI::getNodeIcon (   $a_node)

Definition at line 123 of file class.ilLSTOCGUI.php.

124  {
125  $state = $a_node['state'] ?? TOCBuilder::LP_NOT_STARTED;
126  return $this->node_icons[$state];
127  }

◆ getNodeId()

ilLSTOCGUI::getNodeId (   $a_node)

Definition at line 132 of file class.ilLSTOCGUI.php.

133  {
134  return $a_node['_id'];
135  }

◆ getRootNode()

ilLSTOCGUI::getRootNode ( )

Definition at line 98 of file class.ilLSTOCGUI.php.

99  {
100  return reset($this->nodes);
101  }

◆ isNodeClickable()

ilLSTOCGUI::isNodeClickable (   $a_node)

Definition at line 148 of file class.ilLSTOCGUI.php.

149  {
150  return !is_null($a_node['parameter']);
151  }

◆ isNodeHighlighted()

ilLSTOCGUI::isNodeHighlighted (   $a_node)

Definition at line 156 of file class.ilLSTOCGUI.php.

157  {
158  return $a_node['current'];
159  }

◆ withStructure()

ilLSTOCGUI::withStructure ( string  $json_structure)

Definition at line 61 of file class.ilLSTOCGUI.php.

62  {
63  $clone = clone $this;
64  $clone->structure = $clone->addIds(
65  json_decode($json_structure, true)
66  );
67  $clone->buildLookup($clone->structure); //sets $this->nodes
68  $clone->open_nodes = array_keys($clone->nodes); //all open
69  return $clone;
70  }

Field Documentation

◆ $counter

ilLSTOCGUI::$counter = 0
protected

Definition at line 72 of file class.ilLSTOCGUI.php.

Referenced by addIds().

◆ $id

ilLSTOCGUI::$id = 'ls_toc'
protected

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

◆ $node_icons

ilLSTOCGUI::$node_icons
protected
Initial value:
= [
TOCBuilder::LP_NOT_STARTED => ''

Definition at line 36 of file class.ilLSTOCGUI.php.

◆ $nodes

ilLSTOCGUI::$nodes = []
protected

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

◆ $structure

ilLSTOCGUI::$structure
protected

Definition at line 26 of file class.ilLSTOCGUI.php.

◆ $url_builder

ilLSTOCGUI::$url_builder
protected

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

Referenced by __construct().

◆ NODE_ICONS

const ilLSTOCGUI::NODE_ICONS
Initial value:
= [
TOCBuilder::LP_NOT_STARTED => "./templates/default/images/scorm/not_attempted.svg"
Deprecated:
will be deleted with R8

Definition at line 18 of file class.ilLSTOCGUI.php.


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