ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTaxonomyExplorer.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 
13 require_once("./Services/UIComponent/Explorer/classes/class.ilExplorer.php");
14 
16 {
23  function __construct($a_target, $a_tax_tree, $a_gui_class = "ilobjtaxonomygui",
24  $a_gui_cmd = "listItems")
25  {
26  global $lng;
27 
28  parent::__construct($a_target);
29 
30  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
31  $sort_mode = ilObjTaxonomy::lookupSortingMode($a_tax_tree->getTreeId());
32  $this->setPostSort(false);
33  if ($sort_mode == ilObjTaxonomy::SORT_MANUAL)
34  {
35  $this->setPostSort(true);
36  }
37 
38  //$this->setFilterMode(IL_FM_POSITIVE);
39  //$this->addFilter("tax");
40 
41  $this->gui_class = $a_gui_class;
42  $this->gui_cmd = $a_gui_cmd;
43  $this->tree = $a_tax_tree;
44  $this->root_id = $this->tree->readRootId();
45 
46  $this->setSessionExpandVariable("txexpand");
47  $this->checkPermissions(false);
48 
49 // $this->setOrderColumn("order_nr");
50 // $this->textwidth = 200;
51 
52  $this->force_open_path = array();
53 
54  $this->setRootNodeTitle($lng->txt("tax_taxonomy"));
55  }
56 
62  function setRootNodeTitle($a_val)
63  {
64  $this->root_node_title = $a_val;
65  }
66 
72  function getRootNodeTitle()
73  {
74  return $this->root_node_title;
75  }
76 
80  function setForceOpenPath($a_path)
81  {
82  $this->force_open_path = $a_path;
83  }
84 
92  function formatHeader(&$tpl, $a_obj_id,$a_option)
93  {
94  global $lng, $ilias, $ilCtrl;
95 
96  $ilCtrl->setParameterByClass($this->gui_class, "tax_node",
97  $this->tree->readRootId());
98 
99  $tpl->setCurrentBlock("icon");
100  $tpl->setVariable("ICON_IMAGE" , ilUtil::getImagePath("icon_scat_s.png"));
101  $tpl->setVariable("TXT_ALT_IMG", $lng->txt("tax_node"));
102  $tpl->parseCurrentBlock();
103 
104  $tpl->setCurrentBlock("link");
105  $tpl->setVariable("TITLE", $this->getRootNodeTitle());
106  if ($this->highlighted == $this->tree->readRootId())
107  {
108  $tpl->setVariable("A_CLASS", "class='il_HighlightedNode'");
109  }
110  $tpl->setVariable("LINK_TARGET",
111  $ilCtrl->getLinkTargetByClass($this->gui_class, $this->gui_cmd));
112  $tpl->parseCurrentBlock();
113 
114  $tpl->touchBlock("element");
115  $ilCtrl->setParameterByClass($this->gui_class, "tax_node",
116  $_GET["tax_node"]);
117 
118  }
119 
127  function formatObject(&$tpl, $a_node_id,$a_option,$a_obj_id = 0)
128  {
129  global $lng;
130 
131 /* $tpl->setCurrentBlock("icon");
132  $tpl->setVariable("ICON_IMAGE" , $this->getImage("icon_".$a_option["type"]."_s.png", $a_option["type"], $a_obj_id));
133  $tpl->setVariable("TARGET_ID" , "iconid_".$a_node_id);
134  $this->iconList[] = "iconid_".$a_node_id;
135  $tpl->setVariable("TXT_ALT_IMG", $lng->txt($a_option["desc"]));
136  $tpl->parseCurrentBlock();
137 
138  $this->outputIcons(false);*/
139  parent::formatObject($tpl, $a_node_id,$a_option,$a_obj_id);
140  }
141 
149  function isClickable($a_type, $a_obj_id = 0)
150  {
151  global $ilUser;
152  return true;
153  }
154 
158  function buildLinkTarget($a_node_id, $a_type)
159  {
160  global $ilCtrl;
161 
162  switch($a_type)
163  {
164  // taxonomy node
165  case "taxn":
166  $ilCtrl->setParameterByClass($this->gui_class, "tax_node", $a_node_id);
167  $ret = $ilCtrl->getLinkTargetByClass($this->gui_class, $this->gui_cmd);
168  $ilCtrl->setParameterByClass($this->gui_class, "tax_node", $_GET["tax_node"]);
169  return $ret;
170  break;
171  }
172  }
173 
177  function buildTitle($a_title, $a_id, $a_type)
178  {
179  return $a_title;
180  }
181 
185  function forceExpanded($a_obj_id)
186  {
187  if (in_array($a_obj_id, $this->force_open_path))
188  {
189  return true;
190  }
191  return false;
192  }
193 
197  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
198  {
199  return "";
200  }
201 
205  function getImage($a_name, $a_type = "", $a_obj_id = "")
206  {
207  return ilUtil::getImagePath($a_name);
208  }
209 
216  function sortNodes($a_nodes,$a_parent_obj_id)
217  {
218  $a_nodes = ilUtil::sortArray($a_nodes, "order_nr", "asc", true);
219 
220 
221  return $a_nodes;
222  }
223 
224 }
225 ?>