aboutsummaryrefslogtreecommitdiffstats
path: root/settings/users.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-02-19 12:14:46 +0100
committerArthur Schiwon <blizzz@owncloud.com>2014-06-02 12:53:52 +0200
commit1734cc09fd0575b05e7e894b82f01b2ab3df7359 (patch)
tree692e27dd996f2f9b42262bf8fe599a33cc9fb436 /settings/users.php
parent7d3ac194e3a6c407a9ca44117d01d68945042266 (diff)
downloadnextcloud-server-1734cc09fd0575b05e7e894b82f01b2ab3df7359.tar.gz
nextcloud-server-1734cc09fd0575b05e7e894b82f01b2ab3df7359.zip
sort groups by user count
Diffstat (limited to 'settings/users.php')
-rw-r--r--settings/users.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/settings/users.php b/settings/users.php
index d391ff0ca81..6b16e3aff73 100644
--- a/settings/users.php
+++ b/settings/users.php
@@ -18,6 +18,7 @@ OC_App::setActiveNavigationEntry( 'core_users' );
$users = array();
$groups = array();
+$adminGroup = array();
$userManager = \OC_User::getManager();
if (isset($_GET['offset'])) {
@@ -81,22 +82,39 @@ foreach($accessibleusers as $uid => $displayName) {
);
}
+$sortGroupsIndex = 0;
+$sortGroupsKeys = array();
+$sortAdminGroupsIndex = 0;
+$sortAdminGroupsKeys = array();
foreach( $accessiblegroups as $gid ) {
+ $usersInGroup = OC_Group::usersInGroup($gid, '', $limit, $offset);
if (!OC_User::isAdminUser($gid)) {
$groups[] = array(
'id' => str_replace(' ','', $gid ),
'name' => $gid,
- 'useringroup' => OC_Group::usersInGroup($gid, '', $limit, $offset)
+ 'useringroup' => $usersInGroup,
);
+ $sortGroupsKeys[$sortGroupsIndex] = count($usersInGroup);
+ $sortGroupsIndex++;
} else {
$adminGroup[] = array(
'id' => str_replace(' ','', $gid ),
'name' => $gid,
- 'useringroup' => OC_Group::usersInGroup($gid, '', $limit, $offset)
+ 'useringroup' => $usersInGroup
);
+ $sortAdminGroupsKeys[$sortAdminGroupsIndex] = count($usersInGroup);
+ $sortAdminGroupsIndex++;
}
}
+//sorts groups by number of users (descending)
+if(!empty($groups)) {
+ array_multisort($sortGroupsKeys, SORT_DESC, $groups);
+}
+if(!empty($adminGroup)) {
+ array_multisort($sortAdminGroupsKeys, SORT_DESC, $adminGroup);
+}
+
$tmpl = new OC_Template( "settings", "users", "user" );
$tmpl->assign( 'users', $users );
$tmpl->assign( 'groups', $groups );