From 4271430e609be252d9b4a69fd7b3590571c14f7c Mon Sep 17 00:00:00 2001 From: Björn Schießle Date: Fri, 25 Jan 2013 11:48:03 +0100 Subject: get all display names from users in a given group --- lib/group.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lib/group.php') diff --git a/lib/group.php b/lib/group.php index ed9482418bd..8ebb698692b 100644 --- a/lib/group.php +++ b/lib/group.php @@ -286,4 +286,33 @@ class OC_Group { } return $users; } + + /** + * @brief get a list of all display names in a group + * @returns array with display names (key) and user ids(value) + */ + public static function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { + $displayNames=array(); + foreach(self::$_usedBackends as $backend) { + $displayNames = array_merge($backend->displayNamesInGroup($gid, $search, $limit, $offset), $displayNames); + } + return $displayNames; + } + + /** + * @brief get a list of all display names in several groups + * @param array $gids + * @param string $search + * @param int $limit + * @param int $offset + * @return array with display names (Key) user ids (value) + */ + public static function displayNamesInGroups($gids, $search = '', $limit = -1, $offset = 0) { + $displayNames = array(); + foreach ($gids as $gid) { + // TODO Need to apply limits to groups as total + $displayNames = array_merge(array_diff(self::displayNamesInGroup($gid, $search, $limit, $offset), $displayNames), $displayNames); + } + return $displayNames; + } } -- cgit v1.2.3