4 include_once(
"./Modules/Cloud/exceptions/class.ilCloudException.php");
5 include_once(
"class.ilCloudFileNode.php");
6 include_once(
"class.ilCloudConnector.php");
7 include_once(
"class.ilCloudUtil.php");
156 $this->item_list[$node->getPath()] = $node;
157 $this->id_to_path_map[$node->getId()] = $node->getPath();
158 $node->setIsDir($is_dir);
185 $node->setParentId($node_parent->getId());
186 $node_parent->addChild($node->getPath());
189 $node->setSize(
$size);
190 $node->setModified($modified);
220 $nodeFromId->setPath(
$path);
228 $node->setParentId($node_parent->getId());
229 $node_parent->addChild($node->getPath());
232 $node->setSize(
$size);
233 $node->setModified($modified);
246 $parent->removeChild(
$path);
247 unset($this->item_list[$node->getPath()]);
248 unset($this->id_to_path_map[$node->getId()]);
266 return $this->item_list[
$path];
269 foreach (array_keys($this->item_list) as $item) {
270 if (strtolower($item) == strtolower($path)) {
271 return $this->item_list[$item];
284 return $this->item_list[$this->id_to_path_map[
$id]];
297 $node->setLoadingComplete(
true);
311 if (!$node->getLoadingComplete()) {
331 if (!$service->addToFileTreeWithId($this, $node->getId())) {
332 $service->addToFileTree($this, $node->getPath());
353 if ($folder_name == null) {
364 $current_node->setLoadingComplete(
false);
369 $new_folder_id = $service->createFolderById(
$id, $folder_name);
372 if (is_null($new_folder_id) || !$new_folder_id) {
374 $service->createFolder(
$path, $this);
404 $max_file_size = $plugin->getMaxFileSize();
406 if ($max_file_size >= filesize($tmp_name) / (1024 * 1024)) {
409 $current_node->setLoadingComplete(
false);
414 if (!$service->putFileById($tmp_name, $file_name, $current_node->getId(), $this)) {
415 $service->putFile($tmp_name, $file_name, $current_node->getPath(), $this);
439 if (!$service->deleteItemById($item_node->getId())) {
440 $service->deleteItem($item_node->getPath(), $this);
463 if (!$service->getFileById($node->getId())) {
464 $service->getFile($node->getPath(), $this);
477 $_SESSION[
'ilCloudFileTree'] = serialize($this);
485 if (isset(
$_SESSION[
'ilCloudFileTree'])) {
486 return unserialize(
$_SESSION[
'ilCloudFileTree']);
507 if ($node1->getIsDir() != $node2->getIsDir()) {
508 return $node2->getIsDir() ? +1 : -1;
510 $nameNode1 = strtolower(basename($node1->getPath()));
511 $nameNode2 = strtolower(basename($node2->getPath()));
512 return ($nameNode1 > $nameNode2) ? +1 : -1;
522 usort($children, array(
"ilCloudFileTree",
"orderListAlphabet"));
533 $list[$node->getId()] = $node->getJSONEncode();
const PATH_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION
uploadFileToService($current_id, $tmp_name, $file_name)
getNodeFromPath($path="/")
if(isset($_REQUEST['delete'])) $list
updateFileTree($current_path)
addNode($path, $id, $is_Dir, $modified=null, $size=0)
addIdBasedNode($path, $id, $parent_id, $is_Dir, $modified=null, $size=0)
Add node that relies on id's.
setServiceName($service_name)
addFolderToService($id, $folder_name)
static getFileTreeFromSession()
orderListAlphabet($path1, $path2)
static clearFileTreeSession()
const ADD_ITEMS_FROM_SERVICE_FAILED
const ID_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION
setLoadingOfFolderComplete($path)
$id_to_path_map
Only for better performance.
createNode($path="/", $id, $is_dir=false)
const FOLDER_CREATION_FAILED
static getPluginClass($service_name, $obj_id)
static joinPaths($path1, $path2)
getSortedListOfChildren(ilCloudFileNode $node)
const ID_ALREADY_EXISTS_IN_FILE_TREE_IN_SESSION
static getServiceClass($service_name, $obj_id, $connect=true)
addItemsFromService($folder_id)
__construct($root_path="/", $root_id="root", $id, $service_name)
static normalizePath($path)
const FOLDER_ALREADY_EXISTING_ON_SERVICE
const UPLOAD_FAILED_MAX_FILESIZE
setCaseSensitive($case_sensitive)