/** * @param ilCloudFileTree $file_tree * @param string $parent_folder * * @throws Exception */ public function addToFileTree(ilCloudFileTree &$file_tree, $parent_folder = "/") { try { $exodFiles = $this->getClient()->listFolder($parent_folder); foreach ($exodFiles as $item) { $size = $item instanceof exodFile ? $size = $item->getSize() : NULL; $is_Dir = $item instanceof exodFolder; $file_tree->addNode($item->getFullPath(), $item->getId(), $is_Dir, strtotime($item->getDateTimeLastModified()), $size); } // $file_tree->clearFileTreeSession(); } catch (Exception $e) { $this->getPluginObject()->getCloudModulObject()->setAuthComplete(false); $this->getPluginObject()->getCloudModulObject()->update(); throw $e; } }
public function addToFileTree(ilCloudFileTree $file_tree, $rel_parent_folder = "/") { try { $parent_folder = ilCloudUtil::joinPaths($file_tree->getRootPath(), $rel_parent_folder); $folder = $this->getServiceObject()->getMetadataWithChildren($parent_folder); if (!$folder["is_dir"]) { throw new ilCloudException(ilCloudException::FOLDER_NOT_EXISTING_ON_SERVICE, $parent_folder); } foreach ($folder["contents"] as $item) { if ($item["path"] != null) { $rel_path = substr($item["path"], strlen($file_tree->getRootPath())); $id = "id_" . sha1($rel_path); $file_tree->addNode($rel_path, $id, $item["is_dir"], strtotime($item["modified"]), $item["size"]); } } $file_tree->setLoadingOfFolderComplete($rel_parent_folder); } catch (Exception $e) { $this->getPluginObject()->getCloudModulObject()->setAuthComplete(false); $this->getPluginObject()->getCloudModulObject()->update(); throw $e; } }