diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-15 18:16:35 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-15 18:16:35 +0200 |
commit | 8da2aeec783755ebb3d45c52f85260f03f49453d (patch) | |
tree | eb5b43752f16462f9381ac6170beb971532e6a7b /lib/foldermapper.php | |
parent | 4faac81356c070f609d80f473032a7ed5552b98a (diff) |
folders can now only be create on the first level
Diffstat (limited to 'lib/foldermapper.php')
-rw-r--r-- | lib/foldermapper.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/foldermapper.php b/lib/foldermapper.php index af7d9244a..dbdc8582a 100644 --- a/lib/foldermapper.php +++ b/lib/foldermapper.php @@ -29,6 +29,29 @@ class FolderMapper { } /** + * Returns all folders of a user + * @param $userid + * @return + */ + public function getFoldersOfUser($parentid, $userid = null){ + if($userid === null){ + $userid = $this->userid; + } + $folderlist = array(); + $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . + ' WHERE user_id = ? AND parent_id = ?'); + $result = $stmt->execute(array($this->userid, $parentid)); + + while( $row = $result->fetchRow()){ + $folderid = $row['id']; + $folder = new Folder($row['name'], $folderid); + $folderlist[] = $folder; + } + + return $folderlist; + } + + /** * @brief Returns the forest (list of trees) of folders children of $parentid * @param * @returns |