ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 if (is_object($this->parent_obj)) {
203 $target_path = [get_class($this->parent_obj)];
204 } else {
205 $target_path = $this->parent_obj;
206 }
207 $target_path = $target_path + [$target_class];
208 $ilCtrl->setParameterByClass($target_class, $this->select_par, $a_node["child"]);
209 //$ret = $ilCtrl->getLinkTargetByClass(["ilPersonalWorkspaceGUI", $target_class], $this->select_cmd);
210 $ret = $ilCtrl->getLinkTargetByClass($target_path, $this->select_cmd);
211 $ilCtrl->setParameterByClass($target_class, $this->select_par, $_GET[$this->select_par]);
212
213 //$ret = ILIAS_HTTP_PATH . "/" . $ret;
214
215 return $ret;
216 }
217
224 public function getNodeContent($a_node)
225 {
227
228 if ($a_node["child"] == $this->tree->getRootId()) {
229 return $lng->txt("personal_resources");
230 }
231
232 return $a_node["title"];
233 }
234
241 public function isNodeClickable($a_node)
242 {
243 if (in_array($a_node["type"], $this->getSelectableTypes())) {
244 return true;
245 }
246 return false;
247 }
248
255 public function isNodeSelectable($a_node)
256 {
257 if (in_array($a_node["type"], $this->getSelectableTypes())) {
258 return true;
259 }
260 return false;
261 }
262
266 public function getNodeIcon($a_node)
267 {
268 $t = $a_node["type"];
269 if (in_array($t, array("sktr"))) {
270 return ilUtil::getImagePath("icon_skll.svg");
271 }
272 return ilUtil::getImagePath("icon_" . $t . ".svg");
273 }
274
281 public function isNodeHighlighted($a_node)
282 {
283 if ($this->getActivateHighlighting() &&
284 ($a_node["child"] == $_GET["wsp_id"] || $_GET["wsp_id"] == "" && $a_node["child"] == $this->getRootId())) {
285 return true;
286 }
287 return false;
288 }
289}
$_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
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
$DIC
Definition: xapitoken.php:46