ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTaxonomyClassificationExplorerGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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 
37  $parent_cmd,
38  $tax_id,
39  $target_gui,
40  $target_cmd,
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(
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 }
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
Class Factory.
Class ChatMainBarProvider .
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
get child nodes of given node
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createNode(\ILIAS\UI\Component\Tree\Node\Factory $factory, $record)
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
getNodeIconAlt($a_node)
Get node icon alt attribute.
getNodeId($a_node)
Get id for node.
__construct( $parent_obj, string $parent_cmd, int $tax_id, string $target_gui, string $target_cmd, string $id="")
getRootNode()
Get root node.
This describes a Tree Control.
Definition: Tree.php:28
__construct(Container $dic, ilPlugin $plugin)
$factory
Definition: metadata.php:75