ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilWorkspaceFolderExplorer.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24/*
25* Explorer View for Workspace Folders
26*
27* @author Jörg Lützenkirchen <luetzenkirchen@leifos.com>
28* @version $Id: class.ilBookmarkExplorer.php 23354 2010-03-24 13:25:09Z akill $
29*
30*/
31
32include_once("./Services/UIComponent/Explorer/classes/class.ilExplorer.php");
33include_once("Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php");
34
36{
43
50
57
64 function __construct($a_target,$a_user_id)
65 {
66 parent::__construct($a_target);
67 $this->tree = new ilWorkspaceTree($a_user_id);
68 $this->root_id = $this->tree->readRootId();
69 $this->user_id = $a_user_id;
70 $this->allowed_types= array ('wfld', 'wsrt');
71 $this->enablesmallmode = false;
72 }
73
79 function setEnableSmallMode($a_enablesmallmode)
80 {
81 $this->enablesmallmode = $a_enablesmallmode;
82 }
83
90 {
91 return $this->enablesmallmode;
92 }
93
94
103 function setOutput($a_parent, $a_depth = 1)
104 {
105 global $lng;
106 static $counter = 0;
107
108 if ($objects = $this->tree->getChilds($a_parent,"type DESC,title"))
109 {
110 $tab = ++$a_depth - 2;
111
112 foreach ($objects as $key => $object)
113 {
114 if (!in_array($object["type"],$this->allowed_types))
115 {
116 continue;
117 }
118
119 //ask for FILTER
120 if ($object["child"] != $this->root_id)
121 {
122 //$data = $this->tree->getParentNodeData($object["child"]);
123 $parent_index = $this->getIndex($object);
124 }
125
126 $this->format_options["$counter"]["parent"] = $object["parent"];
127 $this->format_options["$counter"]["child"] = $object["child"];
128 $this->format_options["$counter"]["title"] = $object["title"];
129 $this->format_options["$counter"]["description"] = $object["description"];
130 $this->format_options["$counter"]["type"] = $object["type"];
131 $this->format_options["$counter"]["depth"] = $tab;
132 $this->format_options["$counter"]["container"] = false;
133 $this->format_options["$counter"]["visible"] = true;
134
135 // Create prefix array
136 for ($i = 0; $i < $tab; ++$i)
137 {
138 $this->format_options["$counter"]["tab"][] = 'blank';
139 }
140 // only if parent is expanded and visible, object is visible
141 if ($object["child"] != $this->root_id and (!in_array($object["parent"],$this->expanded)
142 or !$this->format_options["$parent_index"]["visible"]))
143 {
144 $this->format_options["$counter"]["visible"] = false;
145 }
146
147 // if object exists parent is container
148 if ($object["child"] != $this->root_id)
149 {
150 $this->format_options["$parent_index"]["container"] = true;
151
152 if (in_array($object["parent"],$this->expanded))
153 {
154 $this->format_options["$parent_index"]["tab"][($tab-2)] = 'minus';
155 }
156 else
157 {
158 $this->format_options["$parent_index"]["tab"][($tab-2)] = 'plus';
159 }
160 }
161
162 ++$counter;
163
164 // Recursive
165 $this->setOutput($object["child"],$a_depth);
166 } //foreach
167 } //if
168 } //function
169
177 function formatHeader($tpl, $a_obj_id, $a_option)
178 {
179 global $lng, $ilCtrl;
180
181 $title = $lng->txt("wsp_personal_workspace");
182
183 $tpl->setCurrentBlock("icon");
184 $tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_wsrt.svg"));
185 $tpl->setVariable("TXT_ALT_IMG", $title);
186 $tpl->parseCurrentBlock();
187
188 $tpl->setCurrentBlock("link");
189 $tpl->setVariable("LINK_TARGET", $this->buildLinkTarget($this->root_id, "wsrt"));
190 $tpl->setVariable("TITLE", $title);
191
192 // highlighting
193 $style_class = $this->getNodeStyleClass($this->root_id, "wsrt");
194 if ($style_class != "")
195 {
196 $tpl->setVariable("A_CLASS", ' class="'.$style_class.'" ' );
197 }
198
199 $tpl->parseCurrentBlock();
200 }
201
208 function setExpand($a_node_id)
209 {
210 if ($a_node_id == "")
211 {
212 $a_node_id = $this->root_id;
213 }
214
215 // IF ISN'T SET CREATE SESSION VARIABLE
216 if(!is_array($_SESSION[$this->expand_variable]))
217 {
219 }
220 // IF $_GET["expand"] is positive => expand this node
221 if($a_node_id > 0 && !in_array($a_node_id,$_SESSION[$this->expand_variable]))
222 {
223 array_push($_SESSION[$this->expand_variable],$a_node_id);
224 }
225 // IF $_GET["expand"] is negative => compress this node
226 if($a_node_id < 0)
227 {
228 $key = array_keys($_SESSION[$this->expand_variable],-(int) $a_node_id);
229 unset($_SESSION[$this->expand_variable][$key[0]]);
230 }
231 $this->expanded = $_SESSION[$this->expand_variable];
232 }
237 function buildLinkTarget($a_node_id, $a_type)
238 {
239 global $ilCtrl;
240
241 switch ($a_type)
242 {
243 case "wsrt":
244 $ilCtrl->setParameterByClass("ilobjworkspacerootfoldergui", "wsp_id", $a_node_id);
245 return $ilCtrl->getLinkTargetByClass("ilobjworkspacerootfoldergui", "");
246
247 case "wfld":
248 $ilCtrl->setParameterByClass("ilobjworkspacefoldergui", "wsp_id", $a_node_id);
249 return $ilCtrl->getLinkTargetByClass("ilobjworkspacefoldergui", "");
250
251 default:
252 return;
253 }
254 }
259 function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
260 {
261 return '';
262 }
263
269 function setAllowedTypes($a_types)
270 {
271 $this->allowed_types = $a_types;
272 }
278 function setShowDetails($s_details)
279 {
280 $this->show_details = $s_details;
281 }
282
287 function buildDescription($a_desc, $a_id, $a_type)
288 {
289 if ($this->show_details=='y' && !empty($a_desc))
290 {
291 return $a_desc;
292
293 }
294 else
295 {
296 return "";
297 }
298 }
299
300 function getImageAlt($a_def, $a_type, $a_obj_id)
301 {
302 global $lng;
303
304 return $lng->txt("icon")." ".$lng->txt($a_type);
305 }
306
307 function hasFolders($a_node_id)
308 {
309 return sizeof($this->tree->getChildsByType($a_node_id, "wfld"));
310 }
311
312 function getParentNode($a_node_id)
313 {
314 return $this->tree->getParentId($a_node_id);
315 }
316
317 function getOutput()
318 {
319 global $tpl;
320
321 $html = parent::getOutput();
322 $tpl->setBodyClass("std");
323 return $html;
324 }
325}
326
327?>
global $tpl
Definition: ilias.php:8
$_SESSION["AccountId"]
Class ilExplorer class for explorer view in admin frame.
getNodeStyleClass($a_id, $a_type)
get style class for node
getIndex($a_data)
get index of format_options array from specific ref_id,parent_id @access private
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getOutput()
Creates output recursive method @access public.
buildFrameTarget($a_type, $a_child=0, $a_obj_id=0)
overwritten method from base class buid link target
getImageAlt($a_def, $a_type, $a_obj_id)
get image alt text
setAllowedTypes($a_types)
set the alowed object types @access private
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view,...
buildLinkTarget($a_node_id, $a_type)
overwritten method from base class get link target
formatHeader($tpl, $a_obj_id, $a_option)
overwritten method from base class @access public
__construct($a_target, $a_user_id)
Constructor @access public.
setOutput($a_parent, $a_depth=1)
Overwritten method from class.Explorer.php to avoid checkAccess selects recursive method @access publ...
setShowDetails($s_details)
set details mode @access public
buildDescription($a_desc, $a_id, $a_type)
overwritten method from base class buid decription
setEnableSmallMode($a_enablesmallmode)
Set Enable Small Mode.
Tree handler for personal workspace.
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40