ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilTaxonomyExplorerGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
6
15{
19 protected $ctrl;
20
27 public function __construct(
28 $a_parent_obj,
29 $a_parent_cmd,
30 $a_tax_id,
31 $a_target_gui,
32 $a_target_cmd,
33 $a_id = ""
34 ) {
35 global $DIC;
36 $this->ctrl = $DIC->ctrl();
37 include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
38 $this->tax_tree = new ilTaxonomyTree($a_tax_id);
39 if ($a_id != "") {
40 $this->id = $a_id;
41 } else {
42 $this->id = "tax_expl_" . $this->tax_tree->getTreeId();
43 }
44 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
46 $this->setOrderField("title");
47 } else {
48 $this->setOrderField("order_nr", true);
49 }
50 $this->setPreloadChilds(true);
51 $this->target_gui = $a_target_gui;
52 $this->target_cmd = $a_target_cmd;
53 //$this->setOrderField("title");
54 parent::__construct($this->id, $a_parent_obj, $a_parent_cmd, $this->tax_tree);
55 }
56
57
64 public function getNodeContent($a_node)
65 {
66 $rn = $this->getRootNode();
67 if ($rn["child"] == $a_node["child"]) {
68 return ilObject::_lookupTitle($this->tax_tree->getTreeId());
69 } else {
70 return $a_node["title"];
71 }
72 }
73
80 public function getNodeHref($a_node)
81 {
82 $ilCtrl = $this->ctrl;
83
84 if (!$this->onclick && $this->target_gui != "") {
85 $ilCtrl->setParameterByClass($this->target_gui, "tax_node", $a_node["child"]);
86 if (is_array($this->parent_obj)) {
87 // Used for taxonomies in categories
88 $href = $ilCtrl->getLinkTargetByClass($this->parent_obj, $this->target_cmd);
89 } else {
90 // See: https://mantis.ilias.de/view.php?id=27727
91 $href = $ilCtrl->getLinkTargetByClass($this->target_gui, $this->target_cmd);
92 }
93 if (isset($_GET["tax_node"]) && !is_array($_GET['tax_node'])) {
94 $ilCtrl->setParameterByClass($this->target_gui, "tax_node", ilUtil::stripSlashes((string) $_GET["tax_node"]));
95 }
96 return $href;
97 } else {
98 return "#";
99 }
100 }
101
108 public function getNodeIcon($a_node)
109 {
110 return ilUtil::getImagePath("icon_taxn.svg");
111 }
112
119 public function isNodeHighlighted($a_node)
120 {
121 if ((!$this->onclick && $a_node["child"] == $_GET["tax_node"]) ||
122 ($this->onclick && is_array($this->selected_nodes) && in_array($a_node["child"], $this->selected_nodes))) {
123 return true;
124 }
125 return false;
126 }
127
128 public function setOnClick($a_value)
129 {
130 $this->onclick = $a_value;
131 }
132
133 public function getNodeOnClick($a_node)
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}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
static lookupSortingMode($a_id)
Lookup sorting mode.
static _lookupTitle($a_id)
lookup object title
Taxonomy explorer GUI class.
getNodeOnClick($a_node)
Get node onclick attribute.
__construct( $a_parent_obj, $a_parent_cmd, $a_tax_id, $a_target_gui, $a_target_cmd, $a_id="")
Constructor.
getNodeHref($a_node)
Get node href.
getNodeIcon($a_node)
Get node icon.
getNodeContent($a_node)
Get content of node.
Explorer class that works on tree objects (Services/Tree)
setPreloadChilds($a_val)
Set preload childs.
setOrderField($a_val, $a_numeric=false)
Set order field.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc