ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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{
18 protected $id = 0;
19
23 protected $path = "";
24
28 protected $parent_id = -1;
29
33 protected $children = array();
34
38 protected $loading_complete = false;
39
43 protected $is_dir = false;
44
48 protected $size = 0;
49
53 protected $modified = 0;
54
58 protected $created = 0;
59
63 protected $icon_path = "";
64
68 protected $mixed;
69
73 public function __construct($path, $id)
74 {
75 $this->setPath($path);
76 $this->setId($id);
77 }
78
82 public function setId($id)
83 {
84 $this->id = $id;
85 }
86
90 public function getId()
91 {
92 return $this->id;
93 }
94
98 public function setLoadingComplete($complete)
99 {
100 $this->loading_complete = $complete;
101 }
102
106 public function getLoadingComplete()
107 {
109 }
110
114 public function setPath($path = "/")
115 {
116 $this->path = ilCloudUtil::normalizePath($path, $this->is_dir);
117 }
118
122 public function getPath()
123 {
124 return $this->path;
125 }
126
130 public function addChild($path)
131 {
132 if (!isset($this->children[$path])) {
133 $this->children[$path] = $path;
134 }
135 }
136
140 public function removeChild($path)
141 {
142 if (isset($this->children[$path])) {
143 unset($this->children[$path]);
144 }
145 }
146
150 public function getChildrenPathes()
151 {
152 if ($this->hasChildren()) {
153 return $this->children;
154 }
155 return null;
156 }
157
161 public function hasChildren()
162 {
163 return (count($this->children) > 0);
164 }
165
166
170 public function setParentId($id)
171 {
172 $this->parent_id = $id;
173 }
174
178 public function getParentId()
179 {
180 return $this->parent_id;
181 }
182
186 public function setIsDir($is_dir)
187 {
188 $this->is_dir = $is_dir;
189 }
190
194 public function getIsDir()
195 {
196 return $this->is_dir;
197 }
198
202 public function setSize($size)
203 {
204 $this->size = $size;
205 }
206
210 public function getSize()
211 {
212 return $this->size;
213 }
214
218 public function setModified($modified)
219 {
220 $this->modified = $modified;
221 }
222
226 public function getModified()
227 {
228 return $this->modified;
229 }
230
234 public function setIconPath($path)
235 {
236 $this->icon_path = $path;
237 }
238
242 public function getIconPath()
243 {
244 return $this->icon_path;
245 }
246
250 public function setMixed($mixed)
251 {
252 $this->mixed = $mixed;
253 }
254
258 public function getMixed()
259 {
260 return $this->mixed;
261 }
262
263
267 public function getJSONEncode()
268 {
269 $node = array();
270 $node["id"] = $this->getId();
271 $node["is_dir"] = $this->getIsDir();
272 $node["path"] = $this->getPath();
273 $node["parent_id"] = $this->getParentId();
274 $node["loading_complete"] = $this->getLoadingComplete();
275 $node["children"] = $this->getChildrenPathes();
276 $node["size"] = $this->getSize();
277
278 return $node;
279 }
280}
An exception for terminatinating execution or to throw for unit testing.
ilCloudFileTree class
static normalizePath($path)