ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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)
 
 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
 setChildLimit (int $a_val)
 
 getChildLimit ()
 
 setSearchTerm (string $a_val)
 
 getSearchTerm ()
 
 setMainTemplate (?ilGlobalTemplateInterface $a_main_tpl=null)
 
 getRootNode ()
 Get root node. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get children 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 children Please note that this standard method may not be optimal depending on what a derived class does in isNodeVisible. More...
 
 sortChilds (array $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 (bool $a_val)
 
 getSkipRootNode ()
 
 setAjax (bool $a_val)
 
 getAjax ()
 
 setSecondaryHighlightedNodes (array $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 (string $a_postvar, bool $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 (bool $a_val)
 
 getOfflineMode ()
 
 handleCommand ()
 Handle explorer internal command. More...
 
 getContainerId ()
 
 openNode ()
 Open node. More...
 
 closeNode ()
 Close node. More...
 
 getNodeAsync ()
 Get node asynchronously. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getOnLoadCode ()
 Get on load code. More...
 
 getHTML ()
 
 renderNode ($a_node, ilTemplate $tpl)
 Render node. More...
 
 renderChilds ($a_node_id, ilTemplate $tpl)
 Render childs. More...
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id. More...
 
 getNodeIdForDomNodeId (string $a_dom_node_id)
 Get node id for dom node id. More...
 
 listItemStart (ilTemplate $tpl, $a_node)
 List item start. More...
 
 listItemEnd (ilTemplate $tpl)
 
 listStart (ilTemplate $tpl)
 
 listEnd (ilTemplate $tpl)
 
 isNodeOnclickEnabled ()
 
 setNodeOnclickEnabled (bool $nodeOnclickEnabled)
 
 isEnableDnd ()
 
 setEnableDnd (bool $enable_dnd)
 

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 ()
 
 isNodeRequested (string $a_node_id)
 

Protected Attributes

array $structure
 
array $nodes = []
 
LSUrlBuilder $url_builder
 
int $counter = 0
 
array $node_icons
 
- Protected Attributes inherited from ilExplorerBaseGUI
string $node_parameter_name
 
ilLogger $log
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
bool $skip_root_node = false
 
bool $ajax = false
 
array $custom_open_nodes = array()
 
array $selected_nodes = array()
 
string $select_postvar = ""
 
bool $offline_mode = false
 
array $sec_highl_nodes = array()
 
bool $enable_dnd = false
 
string $search_term = ""
 
array $open_nodes = []
 
ilSessionIStorage $store
 
bool $select_multi = false
 
 $parent_obj
 
int $child_limit = 0
 
string $parent_cmd = ''
 
string $requested_exp_cmd = ""
 
string $requested_exp_cont = ""
 
string $requested_searchterm = ""
 
string $requested_node_id = ""
 
string $id
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 
static getLocalJsTreeJsPath ()
 
static getLocalJsTreeCssPath ()
 
static createHTMLExportDirs (string $a_target_dir)
 
static init (?ilGlobalTemplateInterface $a_main_tpl=null)
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static string $js_tree_path = "./node_modules/jstree/dist/jstree.js"
 
static string $js_tree_path_css = "./node_modules/jstree/dist/themes/default/style.min.css"
 
static string $js_expl_path = "assets/js/Explorer2.js"
 

Detailed Description

Tree-GUI for ToC.

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

Constructor & Destructor Documentation

◆ __construct()

ilLSTOCGUI::__construct ( LSUrlBuilder  $url_builder)

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

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

61  {
62  parent::__construct("lsq_toc", null, "");
63 
64  $this->url_builder = $url_builder;
65  $this->setSkipRootNode(false);
66  $this->setNodeOnclickEnabled(true);
67 
68  //get the image paths to the node icons
70  $this->node_icons[TOCBuilder::LP_NOT_STARTED] = $lp_icons->getImagePathNotAttempted();
71  $this->node_icons[TOCBuilder::LP_COMPLETED] = $lp_icons->getImagePathCompleted();
72  $this->node_icons[TOCBuilder::LP_IN_PROGRESS] = $lp_icons->getImagePathInProgress();
73  $this->node_icons[TOCBuilder::LP_FAILED] = $lp_icons->getImagePathFailed();
74  }
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(Container $dic, ilPlugin $plugin)
LSUrlBuilder $url_builder
setNodeOnclickEnabled(bool $nodeOnclickEnabled)
+ Here is the call graph for this function:

Member Function Documentation

◆ addIds()

ilLSTOCGUI::addIds ( array  $node)
protected

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

References $counter.

85  : array
86  {
87  $node['_id'] = $this->counter;
88  $this->counter++;
89  if (array_key_exists('childs', $node)) {
90  foreach ($node['childs'] as $idx => $child) {
91  $node['childs'][$idx] = $this->addIds($child);
92  }
93  }
94  return $node;
95  }
addIds(array $node)

◆ buildLookup()

ilLSTOCGUI::buildLookup ( array  $node)
protected

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

97  : void
98  {
99  $this->nodes[$node['_id']] = $node;
100  if (array_key_exists('childs', $node)) {
101  foreach ($node['childs'] as $child) {
102  $this->buildLookup($child);
103  }
104  }
105  }
buildLookup(array $node)

◆ getChildsOfNode()

ilLSTOCGUI::getChildsOfNode (   $a_parent_node_id)

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

118  : array
119  {
120  $parent_node = $this->nodes[$a_parent_node_id];
121  return (array) ($parent_node['childs'] ?? []);
122  }

◆ getNodeContent()

ilLSTOCGUI::getNodeContent (   $a_node)

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

127  : string
128  {
129  return $a_node['label'];
130  }

◆ getNodeHref()

ilLSTOCGUI::getNodeHref (   $a_node)

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

152  : string
153  {
154  return $this->url_builder->getHref($a_node['command'], $a_node['parameter']);
155  }

◆ getNodeIcon()

ilLSTOCGUI::getNodeIcon (   $a_node)

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

135  : string
136  {
137  $state = $a_node['state'] ?? TOCBuilder::LP_NOT_STARTED;
138  return $this->node_icons[$state];
139  }

◆ getNodeId()

ilLSTOCGUI::getNodeId (   $a_node)

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

145  {
146  return $a_node['_id'];
147  }

◆ getRootNode()

ilLSTOCGUI::getRootNode ( )

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

111  {
112  return reset($this->nodes);
113  }

◆ isNodeClickable()

ilLSTOCGUI::isNodeClickable (   $a_node)

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

160  : bool
161  {
162  return !is_null($a_node['parameter']);
163  }

◆ isNodeHighlighted()

ilLSTOCGUI::isNodeHighlighted (   $a_node)

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

168  : bool
169  {
170  return $a_node['current'] ?? false;
171  }

◆ withStructure()

ilLSTOCGUI::withStructure ( string  $json_structure)

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

76  : self
77  {
78  $clone = clone $this;
79  $clone->structure = $clone->addIds(json_decode($json_structure, true));
80  $clone->buildLookup($clone->structure);
81  $clone->open_nodes = array_keys($clone->nodes);
82  return $clone;
83  }

Field Documentation

◆ $counter

int ilLSTOCGUI::$counter = 0
protected

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

Referenced by addIds().

◆ $node_icons

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

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

◆ $nodes

array ilLSTOCGUI::$nodes = []
protected

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

◆ $structure

array ilLSTOCGUI::$structure
protected

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

◆ $url_builder

LSUrlBuilder ilLSTOCGUI::$url_builder
protected

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

Referenced by __construct().

◆ NODE_ICONS

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

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


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