ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTaxonomyExplorerGUI.php
Go to the documentation of this file.
1<?php
2
24{
25 protected string $requested_tax_node;
26 protected string $onclick = "";
28 protected string $id;
32 protected string $target_gui;
33 protected string $target_cmd;
34
39 public function __construct(
40 $a_parent_obj,
41 string $a_parent_cmd,
42 int $a_tax_id,
43 string $a_target_gui,
44 string $a_target_cmd,
45 string $a_id = ""
46 ) {
47 global $DIC;
48 $this->ctrl = $DIC->ctrl();
49 $this->tax_tree = new ilTaxonomyTree((int) $a_tax_id);
50 $this->id = $a_id != "" ? $a_id : "tax_expl_" . $this->tax_tree->getTreeId();
52 $this->setOrderField("title");
53 } else {
54 $this->setOrderField("order_nr", true);
55 }
56 $this->setPreloadChilds(true);
57 $this->target_gui = $a_target_gui;
58 $this->target_cmd = $a_target_cmd;
59 $params = $DIC->http()->request()->getQueryParams();
60 $tax_node = (string) ($params["tax_node"] ?? "");
61 $this->requested_tax_node = (string) ilUtil::stripSlashes($tax_node);
62 parent::__construct($this->id, $a_parent_obj, $a_parent_cmd, $this->tax_tree);
63 }
64
68 public function getNodeContent($a_node): string
69 {
70 $rn = $this->getRootNode();
71 if ($rn["child"] == $a_node["child"]) {
72 return ilObject::_lookupTitle($this->tax_tree->getTreeId());
73 } else {
74 return $a_node["title"];
75 }
76 }
77
83 public function getNodeHref($a_node): string
84 {
85 $ilCtrl = $this->ctrl;
86
87 if (!$this->onclick && $this->target_gui != "") {
88 $ilCtrl->setParameterByClass($this->target_gui, "tax_node", $a_node["child"]);
89 if (is_array($this->parent_obj)) {
90 // Used for taxonomies in categories
91 $href = $ilCtrl->getLinkTargetByClass($this->parent_obj, $this->target_cmd);
92 } else {
93 // See: https://mantis.ilias.de/view.php?id=27727
94 $href = $ilCtrl->getLinkTargetByClass($this->target_gui, $this->target_cmd);
95 }
96 if ($this->requested_tax_node != "" && !is_array($this->requested_tax_node)) {
97 $ilCtrl->setParameterByClass($this->target_gui, "tax_node", $this->requested_tax_node);
98 }
99 return $href;
100 } else {
101 return "#";
102 }
103 }
104
109 public function getNodeIcon($a_node): string
110 {
111 return ilUtil::getImagePath("standard/icon_taxn.svg");
112 }
113
118 public function isNodeHighlighted($a_node): bool
119 {
120 return (!$this->onclick && $a_node["child"] == $this->requested_tax_node) ||
121 ($this->onclick && is_array($this->selected_nodes) && in_array($a_node["child"], $this->selected_nodes));
122 }
123
124 public function setOnClick(string $a_value): void
125 {
126 $this->onclick = $a_value;
127 }
128
133 public function getNodeOnClick($a_node): string
134 {
135 if ($this->onclick !== '') {
136 return str_replace("{NODE_CHILD}", $a_node["child"], $this->onclick);
137 } else {
138 // #14623
139 return parent::getNodeOnClick($a_node);
140 }
141 }
142}
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
static lookupSortingMode(int $a_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct( $a_parent_obj, string $a_parent_cmd, int $a_tax_id, string $a_target_gui, string $a_target_cmd, string $a_id="")
Constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Explorer class that works on tree objects (Services/Tree)
setOrderField(string $a_val, bool $a_numeric=false)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26