diff options
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 |