ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilCloudFileNode.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
14{
15
19 protected $id = 0;
23 protected $path = "";
27 protected $parent_id = -1;
31 protected $children = array();
35 protected $loading_complete = false;
39 protected $is_dir = false;
43 protected $size = 0;
47 protected $modified = 0;
51 protected $created = 0;
55 protected $icon_path = "";
59 protected $mixed;
60
61
65 public function __construct($path, $id)
66 {
67 $this->setPath($path);
68 $this->setId($id);
69 }
70
71
75 public function setId($id)
76 {
77 $this->id = $id;
78 }
79
80
84 public function getId()
85 {
86 return $this->id;
87 }
88
89
93 public function setLoadingComplete($complete)
94 {
95 $this->loading_complete = $complete;
96 }
97
98
102 public function getLoadingComplete()
103 {
105 }
106
107
111 public function setPath($path = "/")
112 {
113 $this->path = ilCloudUtil::normalizePath($path, $this->is_dir);
114 }
115
116
120 public function getPath()
121 {
122 return $this->path;
123 }
124
125
129 public function addChild($path)
130 {
131 if (!isset($this->children[$path])) {
132 $this->children[$path] = $path;
133 }
134 }
135
136
140 public function removeChild($path)
141 {
142 if (isset($this->children[$path])) {
143 unset($this->children[$path]);
144 }
145 }
146
147
151 public function getChildrenPathes()
152 {
153 if ($this->hasChildren()) {
154 return $this->children;
155 }
156
157 return null;
158 }
159
160
164 public function hasChildren()
165 {
166 return (count($this->children) > 0);
167 }
168
169
173 public function setParentId($id)
174 {
175 $this->parent_id = $id;
176 }
177
178
182 public function getParentId()
183 {
184 return $this->parent_id;
185 }
186
187
191 public function setIsDir($is_dir)
192 {
193 $this->is_dir = $is_dir;
194 }
195
196
200 public function getIsDir()
201 {
202 return $this->is_dir;
203 }
204
205
209 public function setSize($size)
210 {
211 $this->size = $size;
212 }
213
214
218 public function getSize()
219 {
220 return $this->size;
221 }
222
223
227 public function setModified($modified)
228 {
229 $this->modified = $modified;
230 }
231
232
236 public function getModified()
237 {
238 return $this->modified;
239 }
240
241
245 public function setIconPath($path)
246 {
247 $this->icon_path = $path;
248 }
249
250
254 public function getIconPath()
255 {
256 return $this->icon_path;
257 }
258
259
263 public function setMixed($mixed)
264 {
265 $this->mixed = $mixed;
266 }
267
268
272 public function getMixed()
273 {
274 return $this->mixed;
275 }
276
277
281 public function getJSONEncode()
282 {
283 $node = array();
284 $node["id"] = $this->getId();
285 $node["is_dir"] = $this->getIsDir();
286 $node["path"] = $this->getPath();
287 $node["parent_id"] = $this->getParentId();
288 $node["loading_complete"] = $this->getLoadingComplete();
289 $node["children"] = $this->getChildrenPathes();
290 $node["size"] = $this->getSize();
291
292 return $node;
293 }
294}
An exception for terminatinating execution or to throw for unit testing.
ilCloudFileTree class
static normalizePath($path)