ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
4include_once("./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
5include_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 $this->setPathOpen($this->root_id);
88
89 $this->setTypeWhiteList(array("wsrt", "wfld"));
90 }
91
97 public function setLinkToNodeClass($a_val)
98 {
99 $this->link_to_node_class = $a_val;
100 }
101
107 public function getLinkToNodeClass()
108 {
110 }
111
117 public function setActivateHighlighting($a_val)
118 {
119 $this->activate_highlighting = $a_val;
120 }
121
127 public function getActivateHighlighting()
128 {
130 }
131
137 public function setSelectableTypes($a_val)
138 {
139 $this->selectable_types = $a_val;
140 }
141
147 public function getSelectableTypes()
148 {
150 }
151
157 public function setCustomLinkTarget($a_val)
158 {
159 $this->custom_link_target = $a_val;
160 }
161
167 public function getCustomLinkTarget()
168 {
170 }
171
178 public function getNodeHref($a_node)
179 {
180 if ($this->select_postvar != "") {
181 return "";
182 }
183 if ($this->getCustomLinkTarget() != "") {
184 return $this->getCustomLinkTarget() . "&" . $this->select_par . "=" . $a_node["child"];
185 }
186
188
189 $target_class = $this->select_gui;
190
191 if ($this->getLinkToNodeClass()) {
192 switch ($a_node["type"]) {
193 case "wsrt":
194 $target_class = "ilobjworkspacerootfoldergui";
195 break;
196 case "wfld":
197 $target_class = "ilobjworkspacefoldergui";
198 break;
199 }
200 }
201
202 $ilCtrl->setParameterByClass($target_class, $this->select_par, $a_node["child"]);
203 $ret = $ilCtrl->getLinkTargetByClass($target_class, $this->select_cmd);
204 $ilCtrl->setParameterByClass($target_class, $this->select_par, $_GET[$this->select_par]);
205
206 return $ret;
207 }
208
215 public function getNodeContent($a_node)
216 {
218
219 if ($a_node["child"] == $this->tree->getRootId()) {
220 return $lng->txt("wsp_personal_workspace");
221 }
222
223 return $a_node["title"];
224 }
225
232 public function isNodeClickable($a_node)
233 {
234 if (in_array($a_node["type"], $this->getSelectableTypes())) {
235 return true;
236 }
237 return false;
238 }
239
246 public function isNodeSelectable($a_node)
247 {
248 if (in_array($a_node["type"], $this->getSelectableTypes())) {
249 return true;
250 }
251 return false;
252 }
253
257 public function getNodeIcon($a_node)
258 {
259 $t = $a_node["type"];
260 if (in_array($t, array("sktr"))) {
261 return ilUtil::getImagePath("icon_skll.svg");
262 }
263 return ilUtil::getImagePath("icon_" . $t . ".svg");
264 }
265
272 public function isNodeHighlighted($a_node)
273 {
274 if ($this->getActivateHighlighting() &&
275 ($a_node["child"] == $_GET["wsp_id"] || $_GET["wsp_id"] == "" && $a_node["child"] == $this->getRootId())) {
276 return true;
277 }
278 return false;
279 }
280}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
setSkipRootNode($a_val)
Set skip root node.
Explorer class that works on tree objects (Services/Tree)
setTypeWhiteList($a_val)
Set type white list.
setPathOpen($a_id)
Set node path to be opened.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Access handler for personal workspace.
Explorer for selecting a personal workspace item.
getNodeContent($a_node)
Get node content.
getNodeHref($a_node)
Get href for node.
__construct($a_user_id, $a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par="sel_wsp_obj")
Constructor.
setSelectableTypes($a_val)
Set selectable types.
setLinkToNodeClass($a_val)
Set link to node class.
isNodeSelectable($a_node)
Is selectable.
getActivateHighlighting()
Get activate highlighting.
isNodeHighlighted($a_node)
Is node highlighted?
getLinkToNodeClass()
Get link to node class.
getCustomLinkTarget()
Get custom link target.
getSelectableTypes()
Get selectable types.
setCustomLinkTarget($a_val)
Set custom link target.
setActivateHighlighting($a_val)
Set activate highlighting.
getNodeIcon($a_node)
get image path (may be overwritten by derived classes)
Tree handler for personal workspace.
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
global $DIC
Definition: saml.php:7