ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilVirtualSkillTreeExplorerGUI Class Reference

Virtual skill tree explorer. More...

+ Inheritance diagram for ilVirtualSkillTreeExplorerGUI:
+ Collaboration diagram for ilVirtualSkillTreeExplorerGUI:

Public Member Functions

 __construct (string $a_id, $a_parent_obj, string $a_parent_cmd, int $tree_id=0)
 
 setShowDraftNodes (bool $a_val)
 
 getShowDraftNodes ()
 
 setShowOutdatedNodes (bool $a_val)
 
 getShowOutdatedNodes ()
 
 getRootNode ()
 
 getNodeId ($a_node)
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id.
Parameters
string$a_node_id
More...
 
 getNodeIdForDomNodeId (string $a_dom_node_id)
 Get node id for dom node id. More...
 
 getChildsOfNode ($a_parent_node_id)
 
 getNodeContent ($a_node)
 
 getNodeIcon ($a_node)
 
 getNodeHref ($a_node)
 
 isNodeClickable ($a_node)
 
 getNodeIconAlt ($a_node)
 
 getHTML ()
 
 getTreeComponent ()
 
 getChildren ($record, $environment=null)
 Get a list of records (that list can also be empty). More...
 
 build (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record, $environment=null)
 
- 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)
 
- Public Member Functions inherited from ILIAS\UI\Component\Tree\TreeRecursion
 getChildren ( $record, $environment=null)
 Get a list of records (that list can also be empty). More...
 
 build (Node\Factory $factory, $record, $environment=null)
 Build and return a Node. More...
 

Protected Member Functions

 render ()
 
 createNode (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record)
 
- 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

ILIAS DI UIServices $ui
 
ilLanguage $lng
 
ilVirtualSkillTree $vtree
 
SkillTreeManager $skill_tree_manager
 
SkillInternalFactoryService $tree_factory
 
bool $show_draft_nodes = false
 
bool $show_outdated_nodes = false
 
- 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

Virtual skill tree explorer.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

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

Constructor & Destructor Documentation

◆ __construct()

ilVirtualSkillTreeExplorerGUI::__construct ( string  $a_id,
  $a_parent_obj,
string  $a_parent_cmd,
int  $tree_id = 0 
)

Definition at line 40 of file class.ilVirtualSkillTreeExplorerGUI.php.

41 {
42 global $DIC;
43
44 $this->lng = $DIC->language();
45 $this->ctrl = $DIC->ctrl();
46 $this->ui = $DIC->ui();
47 parent::__construct($a_id, $a_parent_obj, $a_parent_cmd);
48
49 $this->skill_tree_manager = $DIC->skills()->internal()->manager()->getTreeManager();
50 $this->tree_factory = $DIC->skills()->internal()->factory();
51
52 if ($tree_id == 0) {
53 $this->vtree = $this->tree_factory->tree()->getGlobalVirtualTree();
54 } else {
55 $this->vtree = $this->tree_factory->tree()->getVirtualTreeById($tree_id);
56 }
57
58 $this->setSkipRootNode(false);
59 $this->setAjax(false);
60 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilExplorerBaseGUI\setAjax(), ilExplorerBaseGUI\setSkipRootNode(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

Member Function Documentation

◆ build()

ilVirtualSkillTreeExplorerGUI::build ( \ILIAS\UI\Component\Tree\Node\Factory  $factory,
  $record,
  $environment = null 
)

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

298 $node = $this->createNode($factory, $record);
299
300 $href = $this->getNodeHref($record);
301 if ($href !== '' && '#' !== $href && $this->isNodeClickable($record)) {
302 $node = $node->withLink(new \ILIAS\Data\URI(ILIAS_HTTP_PATH . '/' . $href));
303 }
304
305 if ($this->isNodeOpen((int) $this->getNodeId($record))) {
306 $node = $node->withExpanded(true);
307 }
308
309 /*
310 $nodeStateToggleCmdClasses = $this->getNodeStateToggleCmdClasses($record);
311 $cmdClass = end($nodeStateToggleCmdClasses);
312
313 if (is_string($cmdClass) && $cmdClass !== '') {
314 $node = $node->withAdditionalOnLoadCode(function ($id) use ($record, $nodeStateToggleCmdClasses, $cmdClass): string {
315 $serverNodeId = $this->getNodeId($record);
316
317 $this->ctrl->setParameterByClass($cmdClass, $this->node_parameter_name, $serverNodeId);
318 $url = $this->ctrl->getLinkTargetByClass($nodeStateToggleCmdClasses, 'toggleExplorerNodeState', '', true, false);
319 $this->ctrl->setParameterByClass($cmdClass, $this->node_parameter_name, null);
320
321 $javascript = "il.UI.tree.registerToggleNodeAsyncAction('$id', '$url', 'prior_state');";
322
323 return $javascript;
324 });
325 }*/
326
327 return $node;
328 }
isNodeOpen($node_id)
Get all open nodes.
createNode(\ILIAS\UI\Component\Tree\Node\Factory $factory, $record)
This describes a Tree Node.
Definition: Node.php:31
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

◆ createNode()

ilVirtualSkillTreeExplorerGUI::createNode ( \ILIAS\UI\Component\Tree\Node\Factory  $factory,
  $record 
)
protected

Definition at line 275 of file class.ilVirtualSkillTreeExplorerGUI.php.

279 $nodeIconPath = $this->getNodeIcon($record);
280
281 $icon = null;
282 if ($nodeIconPath !== '') {
283 $icon = $this->ui
284 ->factory()
285 ->symbol()
286 ->icon()
287 ->custom($nodeIconPath, $this->getNodeIconAlt($record));
288 }
289
290 return $factory->simple($this->getNodeContent($record), $icon);
291 }

References getNodeIconAlt(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ getChildren()

ilVirtualSkillTreeExplorerGUI::getChildren (   $record,
  $environment = null 
)

Get a list of records (that list can also be empty).

Each record will be relayed to $this->build to retrieve a Node. Also, each record will be asked for Sub-Nodes using this function.

Implements ILIAS\UI\Component\Tree\TreeRecursion.

Definition at line 270 of file class.ilVirtualSkillTreeExplorerGUI.php.

270 : array
271 {
272 return $this->getChildsOfNode((string) $record["id"]);
273 }

References getChildsOfNode().

+ Here is the call graph for this function:

◆ getChildsOfNode()

ilVirtualSkillTreeExplorerGUI::getChildsOfNode (   $a_parent_node_id)
Parameters
string$a_parent_node_id
Returns
array{cskill_id: string, id: string, skill_id: string, tref_id: string, parent: string}[]

Reimplemented from ilExplorerBaseGUI.

Definition at line 122 of file class.ilVirtualSkillTreeExplorerGUI.php.

122 : array
123 {
124 return $this->vtree->getChildsOfNode($a_parent_node_id);
125 }

Referenced by getChildren().

+ Here is the caller graph for this function:

◆ getDomNodeIdForNodeId()

ilVirtualSkillTreeExplorerGUI::getDomNodeIdForNodeId (   $a_node_id)

Get DOM node id for node id.

Parameters
string$a_node_id

Reimplemented from ilExplorerBaseGUI.

Definition at line 104 of file class.ilVirtualSkillTreeExplorerGUI.php.

104 : string
105 {
106 return parent::getDomNodeIdForNodeId(str_replace(":", "_", $a_node_id));
107 }

◆ getHTML()

ilVirtualSkillTreeExplorerGUI::getHTML ( )

Reimplemented from ilExplorerBaseGUI.

Definition at line 230 of file class.ilVirtualSkillTreeExplorerGUI.php.

230 : string
231 {
232 return $this->render();
233 }

References render().

+ Here is the call graph for this function:

◆ getNodeContent()

ilVirtualSkillTreeExplorerGUI::getNodeContent (   $a_node)
Parameters
array | object$a_node
Returns
string

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilSkillTreeExplorerGUI.

Definition at line 131 of file class.ilVirtualSkillTreeExplorerGUI.php.

131 : string
132 {
134
135 $a_parent_id_parts = explode(":", (string) $a_node["id"]);
136 $a_parent_skl_tree_id = (int) $a_parent_id_parts[0];
137 $a_parent_skl_template_tree_id = isset($a_parent_id_parts[1]) ? (int) $a_parent_id_parts[1] : 0;
138
139 // title
140 if ((int) $a_node["parent"] == 0) {
141 $tree_obj = $this->skill_tree_manager->getTree($a_node["skl_tree_id"]);
142 $title = $tree_obj->getTitle();
143 } else {
144 $title = $a_node["title"];
145 }
146
147 // root?
148 if ($a_node["type"] == "skrt") {
149 $lng->txt("skmg_skills");
150 }
151
152 return $title;
153 }
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...

References $lng, ILIAS\Repository\int(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getNodeHref()

ilVirtualSkillTreeExplorerGUI::getNodeHref (   $a_node)
Parameters
array | object$a_node
Returns
string

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilSkillSelectorGUI, and ilSkillTreeExplorerGUI.

Definition at line 188 of file class.ilVirtualSkillTreeExplorerGUI.php.

188 : string
189 {
190 $ilCtrl = $this->ctrl;
191
192 // we have a tree id like <skl_tree_id>:<skl_template_tree_id> here
193 // use this, if you want a "common" skill id in format <skill_id>:<tref_id>
194 $id_parts = explode(":", (string) $a_node["id"]);
195 if (!isset($id_parts[1]) || $id_parts[1] == 0) {
196 // skill in main tree
197 $skill_id = $a_node["id"];
198 } else {
199 // skill in template
200 $skill_id = $id_parts[1] . ":" . $id_parts[0];
201 }
202
203 return "";
204 }

References ilExplorerBaseGUI\$ctrl.

◆ getNodeIcon()

ilVirtualSkillTreeExplorerGUI::getNodeIcon (   $a_node)
Parameters
array | object$a_node
Returns
string

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilSkillTreeExplorerGUI.

Definition at line 159 of file class.ilVirtualSkillTreeExplorerGUI.php.

159 : string
160 {
161 $a_id_parts = explode(":", (string) $a_node["id"]);
162 $a_skl_template_tree_id = isset($a_id_parts[1]) ? (int) $a_id_parts[1] : 0;
163
164 // root?
165 if ($a_node["type"] == "skrt") {
166 $icon = ilUtil::getImagePath("standard/icon_scat.svg");
167 } else {
168 $type = $a_node["type"];
169 if ($type == "sktr") {
170 $type = ilSkillTreeNode::_lookupType($a_skl_template_tree_id);
171 }
172 if ($type == "sktp") {
173 $type = "skll";
174 }
175 if ($type == "sctp") {
176 $type = "scat";
177 }
178 $icon = ilUtil::getImagePath("standard/icon_" . $type . ".svg");
179 }
180
181 return $icon;
182 }
static _lookupType(int $a_obj_id)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References ilSkillTreeNode\_lookupType(), ilUtil\getImagePath(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getNodeIconAlt()

ilVirtualSkillTreeExplorerGUI::getNodeIconAlt (   $a_node)
Parameters
array | object$a_node
Returns
string

Reimplemented from ilExplorerBaseGUI.

Definition at line 219 of file class.ilVirtualSkillTreeExplorerGUI.php.

219 : string
220 {
222
223 if ($lng->exists("skmg_" . $a_node["type"])) {
224 return $lng->txt("skmg_" . $a_node["type"]);
225 }
226
227 return $lng->txt($a_node["type"]);
228 }
exists(string $a_topic)
Check if language entry exists.

References $lng, ilLanguage\exists(), and ilLanguage\txt().

Referenced by createNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNodeId()

ilVirtualSkillTreeExplorerGUI::getNodeId (   $a_node)
Parameters
array | object$a_node
Returns
string

Reimplemented from ilExplorerBaseGUI.

Definition at line 96 of file class.ilVirtualSkillTreeExplorerGUI.php.

96 : string
97 {
98 return (string) $a_node["id"];
99 }

◆ getNodeIdForDomNodeId()

ilVirtualSkillTreeExplorerGUI::getNodeIdForDomNodeId ( string  $a_dom_node_id)

Get node id for dom node id.

Reimplemented from ilExplorerBaseGUI.

Definition at line 112 of file class.ilVirtualSkillTreeExplorerGUI.php.

112 : string
113 {
114 $id = parent::getNodeIdForDomNodeId($a_dom_node_id);
115 return str_replace("_", ":", $id);
116 }

References ilExplorerBaseGUI\$id.

◆ getRootNode()

ilVirtualSkillTreeExplorerGUI::getRootNode ( )
Returns
array{id: string, cskill_id: string}

Reimplemented from ilExplorerBaseGUI.

Definition at line 87 of file class.ilVirtualSkillTreeExplorerGUI.php.

87 : array
88 {
89 return $this->vtree->getRootNode();
90 }

◆ getShowDraftNodes()

ilVirtualSkillTreeExplorerGUI::getShowDraftNodes ( )

◆ getShowOutdatedNodes()

ilVirtualSkillTreeExplorerGUI::getShowOutdatedNodes ( )

◆ getTreeComponent()

ilVirtualSkillTreeExplorerGUI::getTreeComponent ( )

Definition at line 244 of file class.ilVirtualSkillTreeExplorerGUI.php.

245 {
246 $f = $this->ui->factory();
247 $tree = $this->vtree;
248
249 if (!$this->getSkipRootNode()) {
250 $data = array(
251 $tree->getRootNode()
252 );
253 } else {
254 $data = $tree->getChildsOfNode((string) ($tree->getRootNode()["id"]));
255 }
256
257 //$label = $this->vtree->getNodeTitle($tree->getRootNode());
258 //if ($label === "" && $this->getNodeContent($this->getRootNode())) {
259 // $label = $this->getNodeContent($this->getRootNode());
260 //}
261 $label = "test";
262
263 $tree = $f->tree()->expandable($label, $this)
264 ->withData($data)
265 ->withHighlightOnNodeClick(true);
266
267 return $tree;
268 }
This describes a Tree Control.
Definition: Tree.php:29

References $data, Vendor\Package\$f, $vtree, ilExplorerBaseGUI\getSkipRootNode(), and ILIAS\Repository\ui().

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isNodeClickable()

ilVirtualSkillTreeExplorerGUI::isNodeClickable (   $a_node)
Parameters
array | object$a_node
Returns
bool

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilSkillSelectorGUI, and ilSkillTreeExplorerGUI.

Definition at line 210 of file class.ilVirtualSkillTreeExplorerGUI.php.

210 : bool
211 {
212 return false;
213 }

◆ render()

ilVirtualSkillTreeExplorerGUI::render ( )
protected

Definition at line 235 of file class.ilVirtualSkillTreeExplorerGUI.php.

235 : string
236 {
237 $r = $this->ui->renderer();
238
239 return $r->render([
240 $this->getTreeComponent()
241 ]);
242 }

References getTreeComponent(), and ILIAS\Repository\ui().

Referenced by getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShowDraftNodes()

ilVirtualSkillTreeExplorerGUI::setShowDraftNodes ( bool  $a_val)

Definition at line 62 of file class.ilVirtualSkillTreeExplorerGUI.php.

62 : void
63 {
64 $this->show_draft_nodes = $a_val;
65 $this->vtree->setIncludeDrafts($a_val);
66 }

Referenced by ilSkillTreeExplorerGUI\__construct().

+ Here is the caller graph for this function:

◆ setShowOutdatedNodes()

ilVirtualSkillTreeExplorerGUI::setShowOutdatedNodes ( bool  $a_val)

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

73 : void
74 {
75 $this->show_outdated_nodes = $a_val;
76 $this->vtree->setIncludeOutdated($a_val);
77 }

Referenced by ilSkillTreeExplorerGUI\__construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $lng

ilLanguage ilVirtualSkillTreeExplorerGUI::$lng
protected

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

Referenced by getNodeContent(), and getNodeIconAlt().

◆ $show_draft_nodes

bool ilVirtualSkillTreeExplorerGUI::$show_draft_nodes = false
protected

Definition at line 37 of file class.ilVirtualSkillTreeExplorerGUI.php.

Referenced by getShowDraftNodes().

◆ $show_outdated_nodes

bool ilVirtualSkillTreeExplorerGUI::$show_outdated_nodes = false
protected

Definition at line 38 of file class.ilVirtualSkillTreeExplorerGUI.php.

Referenced by getShowOutdatedNodes().

◆ $skill_tree_manager

SkillTreeManager ilVirtualSkillTreeExplorerGUI::$skill_tree_manager
protected

Definition at line 34 of file class.ilVirtualSkillTreeExplorerGUI.php.

◆ $tree_factory

SkillInternalFactoryService ilVirtualSkillTreeExplorerGUI::$tree_factory
protected

Definition at line 35 of file class.ilVirtualSkillTreeExplorerGUI.php.

◆ $ui

ILIAS DI UIServices ilVirtualSkillTreeExplorerGUI::$ui
protected

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

◆ $vtree

ilVirtualSkillTree ilVirtualSkillTreeExplorerGUI::$vtree
protected

Definition at line 33 of file class.ilVirtualSkillTreeExplorerGUI.php.

Referenced by getTreeComponent().


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