ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
5 include_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 
37  $this->ctrl = $DIC->ctrl();
38  include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
39  $this->tax_tree = new ilTaxonomyTree($a_tax_id);
40  if ($a_id != "") {
41  $this->id = $a_id;
42  } else {
43  $this->id = "tax_expl_" . $this->tax_tree->getTreeId();
44  }
45  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
47  $this->setOrderField("title");
48  } else {
49  $this->setOrderField("order_nr", true);
50  }
51  $this->setPreloadChilds(true);
52  $this->target_gui = $a_target_gui;
53  $this->target_cmd = $a_target_cmd;
54  //$this->setOrderField("title");
55  parent::__construct($this->id, $a_parent_obj, $a_parent_cmd, $this->tax_tree);
56  }
57 
58 
65  public function getNodeContent($a_node)
66  {
67  $rn = $this->getRootNode();
68  if ($rn["child"] == $a_node["child"]) {
69  return ilObject::_lookupTitle($this->tax_tree->getTreeId());
70  } else {
71  return $a_node["title"];
72  }
73  }
74 
81  public function getNodeHref($a_node)
82  {
84 
85  if (!$this->onclick && $this->target_gui != "") {
86  $ilCtrl->setParameterByClass($this->target_gui, "tax_node", $a_node["child"]);
87  $href = $ilCtrl->getLinkTargetByClass($this->target_gui, $this->target_cmd);
88  if (isset($_GET["tax_node"]) && !is_array($_GET['tax_node'])) {
89  $ilCtrl->setParameterByClass($this->target_gui, "tax_node", ilUtil::stripSlashes((string) $_GET["tax_node"]));
90  }
91  return $href;
92  } else {
93  return "#";
94  }
95  }
96 
103  public function getNodeIcon($a_node)
104  {
105  return ilUtil::getImagePath("icon_taxn.svg");
106  }
107 
114  public function isNodeHighlighted($a_node)
115  {
116  if ((!$this->onclick && $a_node["child"] == $_GET["tax_node"]) ||
117  ($this->onclick && is_array($this->selected_nodes) && in_array($a_node["child"], $this->selected_nodes))) {
118  return true;
119  }
120  return false;
121  }
122 
123  public function setOnClick($a_value)
124  {
125  $this->onclick = $a_value;
126  }
127 
128  public function getNodeOnClick($a_node)
129  {
130  if ($this->onclick) {
131  return str_replace("{NODE_CHILD}", $a_node["child"], $this->onclick);
132  } else {
133  // #14623
134  return parent::getNodeOnClick($a_node);
135  }
136  }
137 }
getNodeIcon($a_node)
Get node icon.
getNodeHref($a_node)
Get node href.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
Taxonomy explorer GUI class.
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
setPreloadChilds($a_val)
Set preload childs.
static lookupSortingMode($a_id)
Lookup sorting mode.
__construct( $a_parent_obj, $a_parent_cmd, $a_tax_id, $a_target_gui, $a_target_cmd, $a_id="")
Constructor.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getNodeContent($a_node)
Get content of node.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
getRootNode()
Get root node.
Explorer class that works on tree objects (Services/Tree)
setOrderField($a_val, $a_numeric=false)
Set order field.