Improve user groups listing
This commit is contained in:
parent
95d8df405d
commit
1f6a42ace7
|
|
@ -111,31 +111,28 @@ class UserHelper extends Base
|
|||
|
||||
/**
|
||||
* Get group names for a given user and return an associative array:
|
||||
* ['full_list'] = a comma-separated list of all group-memberships
|
||||
* ['limited_list'] = a comma-separated list limited to N groups depending on value of SHOW_GROUP_MEMBERSHIPS_IN_USERLIST_WITH_LIMIT
|
||||
* ['has_groups'] = boolean TRUE if user is member of at least one group ... else FALSE
|
||||
*
|
||||
* @access public
|
||||
* @param integer $user_id User id
|
||||
* @param integer $userID User id
|
||||
* @return array
|
||||
*/
|
||||
public function getUsersGroupNames($user_id)
|
||||
public function getUsersGroupNames($userID)
|
||||
{
|
||||
$groups_list = array_column($this->groupMemberModel->getGroups($user_id), 'name');
|
||||
$full_list = implode(', ', $groups_list);
|
||||
$groupsList = array_column($this->groupMemberModel->getGroups($userID), 'name');
|
||||
$limitedList = $groupsList;
|
||||
$total = count($groupsList);
|
||||
|
||||
// let's reduce the array to the limit
|
||||
$limited_list = ( SHOW_GROUP_MEMBERSHIPS_IN_USERLIST_WITH_LIMIT == 0 ) ? $groups_list : array_slice($groups_list, 0 , SHOW_GROUP_MEMBERSHIPS_IN_USERLIST_WITH_LIMIT);
|
||||
// if limiting had any effect ... let's add a hint to the list, to inform the user there are more group-memberships for that user
|
||||
$limited_list = ( $groups_list == $limited_list ) ? implode(', ', $limited_list) : implode(', ', $limited_list) . ' ( >> ' . t('hover mouse over group-icon, to show all group-memberships') . ' )';
|
||||
if ($total > 0 && SHOW_GROUP_MEMBERSHIPS_IN_USERLIST_WITH_LIMIT > 0) {
|
||||
$limitedList = array_slice($groupsList, 0 , SHOW_GROUP_MEMBERSHIPS_IN_USERLIST_WITH_LIMIT);
|
||||
}
|
||||
|
||||
$has_groups = (count($groups_list)) ? true : false;
|
||||
|
||||
return array(
|
||||
'full_list' => $full_list,
|
||||
'limited_list' => $limited_list,
|
||||
'has_groups' => $has_groups
|
||||
);
|
||||
return [
|
||||
'full_list' => $groupsList,
|
||||
'limited_list' => $limitedList,
|
||||
'has_groups' => $total > 0,
|
||||
'total' => $total,
|
||||
'not_shown' => $total - count($limitedList),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1416,7 +1416,7 @@ return array(
|
|||
'Change to global tag' => 'Ændre til globalt mærke',
|
||||
'Do you really want to make the tag "%s" global?' => 'Skal mærket "%s" gøres globalt?',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => ':',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
'Do you really want to make the tag "%s" global?' => 'Das Schlagwort "%s" wirklich global machen?',
|
||||
'Enable global tags for this project' => 'Globale Schlagworte für dieses Projekt aktivieren',
|
||||
'Group membership(s):' => 'Gruppen-Mitgliedschaft(en):',
|
||||
'hover mouse over group-icon, to show all group-memberships' => 'Mauszeiger über das Gruppensymbol halten, um alle Gruppenmitgliedschaften anzuzeigen',
|
||||
'%s is a member of the following group(s):' => '%s ist Mitglied in der/den folgenden Gruppe(n):',
|
||||
'%s is a member of the following group(s): %s' => '%s ist Mitglied in der/den folgenden Gruppe(n): %s',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
'Do you really want to make the tag "%s" global?' => 'Voulez-vous vraiment rendre le libellé « %s » global ?',
|
||||
'Enable global tags for this project' => 'Activer les libellés globaux pour ce projet',
|
||||
'Group membership(s):' => 'Membre des groupes :',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
'%s is a member of the following group(s): %s' => '%s est membre des groupes suivants: %s',
|
||||
'%d/%d group(s) shown' => '%d/%d groupe(s) affiché(s)',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
'Do you really want to make the tag "%s" global?' => 'Valóban globálissá szeretné tenni a(z) „%s” címkét?',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
'Do you really want to make the tag "%s" global?' => 'Você realmente deseja transformar a etiqueta "%s" em etiqueta global?',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
'Do you really want to make the tag "%s" global?' => 'Tem a certeza que pretende por a etiqueta "%s" como global?',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
'Do you really want to make the tag "%s" global?' => 'Вы действительно хотите сделать метку "%s" глобальной?',
|
||||
'Enable global tags for this project' => 'Разрешить глобальные метки в этом проекте',
|
||||
'Group membership(s):' => 'Состоит в группах:',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1417,6 +1417,6 @@ return array(
|
|||
// 'Do you really want to make the tag "%s" global?' => '',
|
||||
// 'Enable global tags for this project' => '',
|
||||
// 'Group membership(s):' => '',
|
||||
// 'hover mouse over group-icon, to show all group-memberships' => '',
|
||||
// '%s is a member of the following group(s):' => '',
|
||||
// '%s is a member of the following group(s): %s' => '',
|
||||
// '%d/%d group(s) shown' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,11 +11,16 @@
|
|||
<span><a href="mailto:<?= $this->text->e($user['email']) ?>"><?= $this->text->e($user['email']) ?></a></span>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ( SHOW_GROUP_MEMBERSHIPS_IN_USERLIST ): ?>
|
||||
<?php $users_group_names = $this->user->getUsersGroupNames($user['id']); ?>
|
||||
<?php $groups_list_tooltip = t('%s is a member of the following group(s):', $user['name']) . ' ' . $users_group_names['full_list']; ?>
|
||||
<?php if ($users_group_names['has_groups']): ?>
|
||||
<span><i class="fa fa-fw fa-group aria-hidden="true" title="<?= $groups_list_tooltip ?>"></i> <?= $users_group_names['limited_list'] ?></span>
|
||||
<?php if (SHOW_GROUP_MEMBERSHIPS_IN_USERLIST): ?>
|
||||
<?php $users_groups = $this->user->getUsersGroupNames($user['id']); ?>
|
||||
<?php $groups_list_tooltip = t('%s is a member of the following group(s): %s', $user['name'] ?: $user['username'], implode(', ', $users_groups['full_list'])); ?>
|
||||
<?php if ($users_groups['has_groups']): ?>
|
||||
<span title="<?= $groups_list_tooltip ?>">
|
||||
<i class="fa fa-fw fa-group" aria-hidden="true"></i><?= $this->text->implode(', ', $users_groups['limited_list']) ?>
|
||||
<?php if ($users_groups['not_shown'] > 0): ?>
|
||||
‑ <?= t('%d/%d group(s) shown', $users_groups['not_shown'], $users_groups['total']) ?>
|
||||
<?php endif ?>
|
||||
</span>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue