ILIAS  release_8 Revision v8.24
class.ilTaxonomyClassificationExplorerGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 public function __construct(
27 string $parent_cmd,
28 int $tax_id,
29 string $target_gui,
30 string $target_cmd,
31 string $id = ""
32 ) {
33 global $DIC;
34
38 $tax_id,
41 $id
42 );
43 }
44
45 public function getNodeContent($a_node): string
46 {
47 $rn = $this->getRootNode();
48 if ($rn["child"] == $a_node["child"]) {
49 $title = ilObject::_lookupTitle($this->tax_tree->getTreeId());
50 } else {
51 $title = $a_node["title"];
52 }
53 return $title;
54 }
55
56 public function getTreeComponent(): Tree
57 {
58 $f = $this->ui->factory();
59 $tree = $this->getTree();
60
61 if (!$this->getSkipRootNode()) {
62 $data = array(
64 );
65 } else {
67 }
68
69 $label = $this->getTreeLabel();
70 if ($this->getTreeLabel() === "" && $this->getNodeContent($this->getRootNode())) {
71 $label = $this->getNodeContent($this->getRootNode());
72 }
73
74 $tree = $f->tree()->expandable($label, $this)
75 ->withData($data)
76 ->withHighlightOnNodeClick(true);
77
78 return $tree;
79 }
80
81 protected function createNode(
82 \ILIAS\UI\Component\Tree\Node\Factory $factory,
83 $record
84 ): \ILIAS\UI\Component\Tree\Node\Node {
85 $nodeIconPath = $this->getNodeIcon($record);
86
87 $icon = null;
88 if ($nodeIconPath !== '') {
89 $icon = $this->ui
90 ->factory()
91 ->symbol()
92 ->icon()
93 ->custom($nodeIconPath, $this->getNodeIconAlt($record));
94 }
95 $node = $factory->simple($this->getNodeContent($record), $icon)
96 ->withOnLoadCode(function ($id) use ($record) {
97 return
98 "$(\"#$id a\").click(function(ev) { ev.preventDefault(); " . $this->getNodeOnClick($record) . "; return false;});";
99 })
100 ->withLink(new \ILIAS\Data\URI(ILIAS_HTTP_PATH . "/#tax_node_" . $record["child"]));
101 if (in_array($this->getNodeId($record), $this->selected_nodes)) {
102 $node = $node->withHighlighted(true);
103 }
104 return $node;
105 }
106
107
108}
static _lookupTitle(int $obj_id)
createNode(\ILIAS\UI\Component\Tree\Node\Factory $factory, $record)
Creates at tree node, can be overwritten in derivatives if another node type should be used.
__construct( $parent_obj, string $parent_cmd, int $tax_id, string $target_gui, string $target_cmd, string $id="")
Constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getNodeId($a_node)
Get id for node.
getNodeIconAlt($a_node)
Get node icon alt attribute.
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
get child nodes of given node
global $DIC
Definition: feed.php:28
This describes a Tree Control.
Definition: Tree.php:29
$factory
Definition: metadata.php:75
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.