ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilWorkspaceExplorerGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
5 include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
6 
15 {
19  protected $ctrl;
20 
24  protected $lng;
25 
29  protected $link_to_node_class = false;
30 
34  protected $custom_link_target = "";
35 
39  protected $select_gui = null;
40 
44  protected $select_cmd = "";
45 
49  protected $select_par = "";
50 
54  protected $selectable_types = array();
55 
59  protected $activate_highlighting = false;
60 
64  public function __construct($a_user_id, $a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par = "sel_wsp_obj")
65  {
66  global $DIC;
67 
68  $this->ctrl = $DIC->ctrl();
69  $this->lng = $DIC->language();
70 
71  $this->select_gui = (is_object($a_select_gui))
72  ? strtolower(get_class($a_select_gui))
73  : $a_select_gui;
74  $this->select_cmd = $a_select_cmd;
75  $this->select_par = $a_select_par;
76 
77  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
78  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
79 
80  $this->tree = new ilWorkspaceTree($a_user_id);
81  $this->root_id = $this->tree->readRootId();
82  $this->access_handler = new ilWorkspaceAccessHandler($this->tree);
83 
84  parent::__construct("wsp_sel", $a_parent_obj, $a_parent_cmd, $this->tree);
85  $this->setSkipRootNode(false);
86  $this->setAjax(true);
87 
88  $this->setTypeWhiteList(array("wsrt", "wfld"));
89  }
90 
96  public function setLinkToNodeClass($a_val)
97  {
98  $this->link_to_node_class = $a_val;
99  }
100 
106  public function getLinkToNodeClass()
107  {
109  }
110 
116  public function setActivateHighlighting($a_val)
117  {
118  $this->activate_highlighting = $a_val;
119  }
120 
126  public function getActivateHighlighting()
127  {
129  }
130 
136  public function setSelectableTypes($a_val)
137  {
138  $this->selectable_types = $a_val;
139  }
140 
146  public function getSelectableTypes()
147  {
149  }
150 
156  public function setCustomLinkTarget($a_val)
157  {
158  $this->custom_link_target = $a_val;
159  }
160 
166  public function getCustomLinkTarget()
167  {
169  }
170 
177  public function getNodeHref($a_node)
178  {
179  if ($this->getCustomLinkTarget() != "") {
180  return $this->getCustomLinkTarget() . "&" . $this->select_par . "=" . $a_node["child"];
181  }
182 
184 
185  $target_class = $this->select_gui;
186 
187  if ($this->getLinkToNodeClass()) {
188  switch ($a_node["type"]) {
189  case "wsrt":
190  $target_class = "ilobjworkspacerootfoldergui";
191  break;
192  case "wfld":
193  $target_class = "ilobjworkspacefoldergui";
194  break;
195  }
196  }
197 
198  $ilCtrl->setParameterByClass($target_class, $this->select_par, $a_node["child"]);
199  $ret = $ilCtrl->getLinkTargetByClass($target_class, $this->select_cmd);
200  $ilCtrl->setParameterByClass($target_class, $this->select_par, $_GET[$this->select_par]);
201 
202  return $ret;
203  }
204 
211  public function getNodeContent($a_node)
212  {
213  $lng = $this->lng;
214 
215  if ($a_node["child"] == $this->tree->getRootId()) {
216  return $lng->txt("wsp_personal_workspace");
217  }
218 
219  return $a_node["title"];
220  }
221 
228  public function isNodeClickable($a_node)
229  {
230  if (in_array($a_node["type"], $this->getSelectableTypes())) {
231  return true;
232  }
233  return false;
234  }
235 
242  public function isNodeSelectable($a_node)
243  {
244  if (in_array($a_node["type"], $this->getSelectableTypes())) {
245  return true;
246  }
247  return false;
248  }
249 
253  public function getNodeIcon($a_node)
254  {
255  $t = $a_node["type"];
256  if (in_array($t, array("sktr"))) {
257  return ilUtil::getImagePath("icon_skll.svg");
258  }
259  return ilUtil::getImagePath("icon_" . $t . ".svg");
260  }
261 
268  public function isNodeHighlighted($a_node)
269  {
270  if ($this->getActivateHighlighting() &&
271  ($a_node["child"] == $_GET["wsp_id"] || $_GET["wsp_id"] == "" && $a_node["child"] == $this->getRootId())) {
272  return true;
273  }
274  return false;
275  }
276 }
isNodeClickable($a_node)
Is clickable.
setSelectableTypes($a_val)
Set selectable types.
getCustomLinkTarget()
Get custom link target.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
getNodeIcon($a_node)
get image path (may be overwritten by derived classes)
setSkipRootNode($a_val)
Set skip root node.
Access handler for personal workspace.
getActivateHighlighting()
Get activate highlighting.
Tree handler for personal workspace.
setTypeWhiteList($a_val)
Set type white list.
global $ilCtrl
Definition: ilias.php:18
getLinkToNodeClass()
Get link to node class.
isNodeHighlighted($a_node)
Is node highlighted?
isNodeSelectable($a_node)
Is selectable.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getNodeContent($a_node)
Get node content.
getSelectableTypes()
Get selectable types.
Explorer for selecting a personal workspace item.
__construct($a_user_id, $a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par="sel_wsp_obj")
Constructor.
setActivateHighlighting($a_val)
Set activate highlighting.
Create styles array
The data for the language used.
Explorer class that works on tree objects (Services/Tree)
getNodeHref($a_node)
Get href for node.
$ret
Definition: parser.php:6
setCustomLinkTarget($a_val)
Set custom link target.
setLinkToNodeClass($a_val)
Set link to node class.