ILIAS  release_4-4 Revision
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  {
134  $this->children[$path] = $path;
135  }
136 
137  }
138 
142  public function removeChild($path)
143  {
144  if (isset($this->children[$path]))
145  {
146  unset($this->children[$path]);
147  }
148 
149  }
150 
154  public function getChildrenPathes()
155  {
156  if ($this->hasChildren())
157  {
158  return $this->children;
159  }
160  return null;
161 
162  }
163 
167  public function hasChildren()
168  {
169  return (count($this->children) > 0);
170  }
171 
172 
176  public function setParentId($id)
177  {
178  $this->parent_id = $id;
179  }
180 
184  public function getParentId()
185  {
186  return $this->parent_id;
187  }
188 
192  public function setIsDir($is_dir)
193  {
194  $this->is_dir = $is_dir;
195  }
196 
200  public function getIsDir()
201  {
202  return $this->is_dir;
203  }
204 
208  public function setSize($size)
209  {
210  $this->size = $size;
211  }
212 
216  public function getSize()
217  {
218  return $this->size;
219  }
220 
224  public function setModified($modified)
225  {
226  $this->modified = $modified;
227  }
228 
232  public function getModified()
233  {
234  return $this->modified;
235  }
236 
240  public function setIconPath($path)
241  {
242  $this->icon_path = $path;
243  }
244 
248  public function getIconPath()
249  {
250  return $this->icon_path;
251  }
252 
256  public function setMixed($mixed)
257  {
258  $this->mixed = $mixed;
259  }
260 
264  public function getMixed()
265  {
266  return $this->mixed;
267  }
268 
269 
273  public function getJSONEncode()
274  {
275  $node = array();
276  $node["id"] = $this->getId();
277  $node["is_dir"] = $this->getIsDir();
278  $node["path"] = $this->getPath();
279  $node["parent_id"] = $this->getParentId();
280  $node["loading_complete"] = $this->getLoadingComplete();
281  $node["children"] = $this->getChildrenPathes();
282  $node["size"] = $this->getSize();
283 
284  return $node;
285  }
286 }
287 
288 ?>
static normalizePath($path)
ilCloudFileTree class