diff options
author | Gregor Tätzner <gregor@freenet.de> | 2013-03-07 18:25:31 +0100 |
---|---|---|
committer | Gregor Tätzner <gregor@freenet.de> | 2013-03-07 18:25:31 +0100 |
commit | 25a766a00933ccbe5c24dc4c91bc93587e033abc (patch) | |
tree | 01d1d6ccc42e8657cd18d738fe456c7dad27fde3 /external_api/folder.php | |
parent | 3c87c2be39c609a3d68c133358ab91a40480b745 (diff) |
implement folder modify and delete api calls
Diffstat (limited to 'external_api/folder.php')
-rw-r--r-- | external_api/folder.php | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/external_api/folder.php b/external_api/folder.php index 66e5f3915..68c8ff523 100644 --- a/external_api/folder.php +++ b/external_api/folder.php @@ -13,22 +13,47 @@ class FolderApi { public function getAll() { $folders = $this->bl->getAll(); $serializedFolders = array(); - - //TODO: check the behaviour for nested folders + + //TODO: check the behaviour for nested folders foreach ($folders as $folder) { $serializedFolders[] = $folder->jsonSerialize(); } return new \OC_OCS_Result($serializedFolders); } - + public function create() { - $name = $_POST['name']; $parentId = $_POST['parentid']; - + $this->bl->create($name, $parentId); - + return new \OC_OCS_Result(); } + + public function delete($params) { + $id = $params['folderid']; + if(!is_numeric($id)) + return new \OC_OCS_Result(null,999,'Invalid input! folderid must be an integer'); + + if($this->bl->delete($id)) + return new \OC_OCS_Result(); + else + return new \OC_OCS_Result(null,999,'Could not delete folder'); + } + + public function modify($params) { + $id = $params['folderid']; + if(!is_numeric($id)) + return new \OC_OCS_Result(null,999,'Invalid input! folderid must be an integer'.$id); + + $name = $_POST['name']; + $parentId = $_POST['parentid']; + $opened = $_POST['opened']; + + if($this->bl->modify($id, $name, $parentid, $opened)) + return new \OC_OCS_Result(); + else + return new \OC_OCS_Result(null,999,'Could not modify folder'); + } } |