diff options
Diffstat (limited to 'lib/group')
-rw-r--r-- | lib/group/backend.php | 2 | ||||
-rw-r--r-- | lib/group/database.php | 12 | ||||
-rw-r--r-- | lib/group/interface.php | 2 |
3 files changed, 7 insertions, 9 deletions
diff --git a/lib/group/backend.php b/lib/group/backend.php index ebc078f152a..3f2909caa15 100644 --- a/lib/group/backend.php +++ b/lib/group/backend.php @@ -105,7 +105,7 @@ abstract class OC_Group_Backend implements OC_Group_Interface { * * Returns a list with all groups */ - public function getGroups(){ + public function getGroups($search = '', $limit = 10, $offset = 0) { return array(); } diff --git a/lib/group/database.php b/lib/group/database.php index 2770ec185c4..6314a127438 100644 --- a/lib/group/database.php +++ b/lib/group/database.php @@ -164,15 +164,13 @@ class OC_Group_Database extends OC_Group_Backend { * * Returns a list with all groups */ - public function getGroups(){ - $query = OC_DB::prepare( "SELECT gid FROM `*PREFIX*groups`" ); - $result = $query->execute(); - + public function getGroups($search = '', $limit = 10, $offset = 0) { + $query = OC_DB::prepare('SELECT gid FROM *PREFIX*groups WHERE gid LIKE ? LIMIT '.$limit.' OFFSET '.$offset); + $result = $query->execute(array($search.'%')); $groups = array(); - while( $row = $result->fetchRow()){ - $groups[] = $row["gid"]; + while ($row = $result->fetchRow()) { + $groups[] = $row['gid']; } - return $groups; } diff --git a/lib/group/interface.php b/lib/group/interface.php index 7cca6061e10..6e492e72748 100644 --- a/lib/group/interface.php +++ b/lib/group/interface.php @@ -58,7 +58,7 @@ interface OC_Group_Interface { * * Returns a list with all groups */ - public function getGroups(); + public function getGroups($search = '', $limit = 10, $offset = 0); /** * check if a group exists |