ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilWorkspaceExplorerGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
11 {
15  protected $ctrl;
16 
20  protected $lng;
21 
25  protected $link_to_node_class = false;
26 
30  protected $custom_link_target = "";
31 
35  protected $select_gui = null;
36 
40  protected $select_cmd = "";
41 
45  protected $select_par = "";
46 
50  protected $selectable_types = array();
51 
55  protected $activate_highlighting = false;
56 
60  public function __construct($a_user_id, $a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par = "sel_wsp_obj")
61  {
62  global $DIC;
63 
64  $this->ctrl = $DIC->ctrl();
65  $this->lng = $DIC->language();
66 
67  $this->select_gui = (is_object($a_select_gui))
68  ? strtolower(get_class($a_select_gui))
69  : $a_select_gui;
70  $this->select_cmd = $a_select_cmd;
71  $this->select_par = $a_select_par;
72 
73  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
74  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
75 
76  $this->tree = new ilWorkspaceTree($a_user_id);
77  $this->root_id = $this->tree->readRootId();
78  $this->access_handler = new ilWorkspaceAccessHandler($this->tree);
79 
80  parent::__construct("wsp_sel", $a_parent_obj, $a_parent_cmd, $this->tree);
81  $this->setSkipRootNode(false);
82  $this->setAjax(true);
83  $this->setPathOpen($this->root_id);
84 
85  $this->setTypeWhiteList(array("wsrt", "wfld"));
86  }
87 
93  public function setLinkToNodeClass($a_val)
94  {
95  $this->link_to_node_class = $a_val;
96  }
97 
103  public function getLinkToNodeClass()
104  {
106  }
107 
113  public function setActivateHighlighting($a_val)
114  {
115  $this->activate_highlighting = $a_val;
116  }
117 
123  public function getActivateHighlighting()
124  {
126  }
127 
133  public function setSelectableTypes($a_val)
134  {
135  $this->selectable_types = $a_val;
136  }
137 
143  public function getSelectableTypes()
144  {
146  }
147 
153  public function setCustomLinkTarget($a_val)
154  {
155  $this->custom_link_target = $a_val;
156  }
157 
163  public function getCustomLinkTarget()
164  {
166  }
167 
174  public function getNodeHref($a_node)
175  {
176  if ($this->select_postvar != "") {
177  return "";
178  }
179  if ($this->getCustomLinkTarget() != "") {
180  return $this->getCustomLinkTarget() . "&" . $this->select_par . "=" . $a_node["child"];
181  }
182 
183  $ilCtrl = $this->ctrl;
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  if (is_object($this->parent_obj)) {
199  $target_path = [get_class($this->parent_obj)];
200  } else {
201  $target_path = $this->parent_obj;
202  }
203  $target_path = $target_path + [$target_class];
204  $ilCtrl->setParameterByClass($target_class, $this->select_par, $a_node["child"]);
205  //$ret = $ilCtrl->getLinkTargetByClass(["ilPersonalWorkspaceGUI", $target_class], $this->select_cmd);
206  $ret = $ilCtrl->getLinkTargetByClass($target_path, $this->select_cmd);
207  $ilCtrl->setParameterByClass($target_class, $this->select_par, $_GET[$this->select_par]);
208 
209  //$ret = ILIAS_HTTP_PATH . "/" . $ret;
210 
211  return $ret;
212  }
213 
220  public function getNodeContent($a_node)
221  {
222  $lng = $this->lng;
223 
224  if ($a_node["child"] == $this->tree->getRootId()) {
225  return $lng->txt("personal_resources");
226  }
227 
228  return $a_node["title"];
229  }
230 
237  public function isNodeClickable($a_node)
238  {
239  if (in_array($a_node["type"], $this->getSelectableTypes())) {
240  return true;
241  }
242  return false;
243  }
244 
251  public function isNodeSelectable($a_node)
252  {
253  if (in_array($a_node["type"], $this->getSelectableTypes())) {
254  return true;
255  }
256  return false;
257  }
258 
262  public function getNodeIcon($a_node)
263  {
264  $t = $a_node["type"];
265  if (in_array($t, array("sktr"))) {
266  return ilUtil::getImagePath("icon_skll.svg");
267  }
268  return ilUtil::getImagePath("icon_" . $t . ".svg");
269  }
270 
277  public function isNodeHighlighted($a_node)
278  {
279  if ($this->getActivateHighlighting() &&
280  ($a_node["child"] == $_GET["wsp_id"] || $_GET["wsp_id"] == "" && $a_node["child"] == $this->getRootId())) {
281  return true;
282  }
283  return false;
284  }
285 }
isNodeClickable($a_node)
Is clickable.
setSelectableTypes($a_val)
Set selectable types.
getCustomLinkTarget()
Get custom link target.
$_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.
setPathOpen($a_id)
Set node path to be opened.
Tree handler for personal workspace.
setTypeWhiteList($a_val)
Set type white list.
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.
global $DIC
Definition: goto.php:24
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.
Explorer class that works on tree objects (Services/Tree)
__construct(Container $dic, ilPlugin $plugin)
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.