ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.ilWorkspaceExplorerGUI.php
Go to the documentation of this file.
1<?php
2
20
27{
29 protected bool $link_to_node_class = false;
30 protected string $custom_link_target = "";
31 protected object|string|null $select_gui = null;
32 protected string $select_cmd = "";
33 protected string $select_par = "";
34 protected array $selectable_types = array();
35 protected bool $activate_highlighting = false;
37
43 public function __construct(
44 int $a_user_id,
45 $a_parent_obj,
46 string $a_parent_cmd,
47 $a_select_gui,
48 string $a_select_cmd,
49 string $a_select_par = "sel_wsp_obj"
50 ) {
51 global $DIC;
52
53 $this->ctrl = $DIC->ctrl();
54 $this->lng = $DIC->language();
55
56 $this->select_gui = (is_object($a_select_gui))
57 ? strtolower(get_class($a_select_gui))
58 : $a_select_gui;
59 $this->select_cmd = $a_select_cmd;
60 $this->select_par = $a_select_par;
61
62 $this->request = new StandardGUIRequest(
63 $DIC->http(),
64 $DIC->refinery()
65 );
66
67 $this->tree = new ilWorkspaceTree($a_user_id);
68 $this->root_id = $this->tree->readRootId();
69 $this->access_handler = new ilWorkspaceAccessHandler($this->tree);
70
71 parent::__construct("wsp_sel", $a_parent_obj, $a_parent_cmd, $this->tree);
72 $this->setSkipRootNode(false);
73 $this->setAjax(true);
74 $this->setPathOpen($this->root_id);
75
76 $this->setTypeWhiteList(array("wsrt", "wfld"));
77 }
78
79 public function setLinkToNodeClass(bool $a_val): void
80 {
81 $this->link_to_node_class = $a_val;
82 }
83
84 public function getLinkToNodeClass(): bool
85 {
87 }
88
89 public function setActivateHighlighting(bool $a_val): void
90 {
91 $this->activate_highlighting = $a_val;
92 }
93
94 public function getActivateHighlighting(): bool
95 {
97 }
98
99 public function setSelectableTypes(array $a_val): void
100 {
101 $this->selectable_types = $a_val;
102 }
103
104 public function getSelectableTypes(): array
105 {
107 }
108
109 public function setCustomLinkTarget(string $a_val): void
110 {
111 $this->custom_link_target = $a_val;
112 }
113
114 public function getCustomLinkTarget(): string
115 {
117 }
118
122 public function getNodeHref($a_node): string
123 {
124 if ($this->select_postvar != "") {
125 return "";
126 }
127 if ($this->getCustomLinkTarget() != "") {
128 return $this->getCustomLinkTarget() . "&" . $this->select_par . "=" . $a_node["child"];
129 }
130
131 $ilCtrl = $this->ctrl;
132
133 $target_class = $this->select_gui;
134 if (is_object($this->parent_obj)) {
135 $target_path = [get_class($this->parent_obj)];
136 } else {
137 $target_path = $this->parent_obj;
138 }
139 $target_path = $target_path + [$target_class];
140
141 if ($this->getLinkToNodeClass()) {
142 switch ($a_node["type"]) {
143 case "wsrt":
144 $target_class = "ilobjworkspacerootfoldergui";
145 $target_path = ["ilDashboardGUI", "ilPersonalWorkspaceGUI", "ilobjworkspacerootfoldergui"];
146 break;
147 case "wfld":
148 $target_class = "ilobjworkspacefoldergui";
149 break;
150 }
151 }
152
153 /*var_dump($target_path);
154 var_dump($target_class);
155 var_dump($this->select_par);
156 var_dump($a_node);*/
157 $ilCtrl->setParameterByClass($target_class, $this->select_par, $a_node["child"]);
158 $ret = $ilCtrl->getLinkTargetByClass($target_path, $this->select_cmd);
159 /*var_dump($ret);
160 exit;*/
161 $ilCtrl->setParameterByClass($target_class, $this->select_par, $this->request->getSelectPar());
162 return $ret;
163 }
164
168 public function getNodeContent($a_node): string
169 {
171
172 if ($a_node["child"] == $this->tree->getRootId()) {
173 return $lng->txt("personal_resources");
174 }
175
176 return $a_node["title"];
177 }
178
182 public function isNodeClickable($a_node): bool
183 {
184 if (in_array($a_node["type"], $this->getSelectableTypes())) {
185 return true;
186 }
187 return false;
188 }
189
193 protected function isNodeSelectable($a_node): bool
194 {
195 if (in_array($a_node["type"], $this->getSelectableTypes())) {
196 return true;
197 }
198 return false;
199 }
200
204 public function getNodeIcon($a_node): string
205 {
206 $t = $a_node["type"];
207 if (in_array($t, array("sktr"))) {
208 return ilUtil::getImagePath("standard/icon_skll.svg");
209 }
210 return ilUtil::getImagePath("standard/icon_" . $t . ".svg");
211 }
212
216 public function isNodeHighlighted($a_node): bool
217 {
218 $wsp_id = $this->request->getWspId();
219 if ($this->getActivateHighlighting() &&
220 ((int) $a_node["child"] == $wsp_id || $wsp_id == 0 && $a_node["child"] == $this->getRootId())) {
221 return true;
222 }
223 return false;
224 }
225}
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Explorer class that works on tree objects (Services/Tree)
setPathOpen($a_id)
Set node path to be opened.
setTypeWhiteList(array $a_val)
Set type white list.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Explorer for selecting a personal workspace item.
ilWorkspaceAccessHandler $access_handler
__construct(int $a_user_id, $a_parent_obj, string $a_parent_cmd, $a_select_gui, string $a_select_cmd, string $a_select_par="sel_wsp_obj")
ilWorkspaceExplorerGUI constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26