add badges in user admin
This commit is contained in:
parent
b7208e273d
commit
d91d02f44c
@ -851,6 +851,7 @@ class ExtraFields
|
|||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
|
$count = 0;
|
||||||
if ($this->db->num_rows($resql)) {
|
if ($this->db->num_rows($resql)) {
|
||||||
while ($tab = $this->db->fetch_object($resql)) {
|
while ($tab = $this->db->fetch_object($resql)) {
|
||||||
if ($tab->entity != 0 && $tab->entity != $conf->entity) {
|
if ($tab->entity != 0 && $tab->entity != $conf->entity) {
|
||||||
@ -890,10 +891,12 @@ class ExtraFields
|
|||||||
$this->attributes[$tab->elementtype]['csslist'][$tab->name] = $tab->csslist;
|
$this->attributes[$tab->elementtype]['csslist'][$tab->name] = $tab->csslist;
|
||||||
|
|
||||||
$this->attributes[$tab->elementtype]['loaded'] = 1;
|
$this->attributes[$tab->elementtype]['loaded'] = 1;
|
||||||
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($elementtype) {
|
if ($elementtype) {
|
||||||
$this->attributes[$elementtype]['loaded'] = 1; // If nothing found, we also save tag 'loaded'
|
$this->attributes[$elementtype]['loaded'] = 1; // If nothing found, we also save tag 'loaded'
|
||||||
|
$this->attributes[$elementtype]['count'] = $count;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
|
|||||||
@ -272,7 +272,7 @@ function user_admin_prepare_head()
|
|||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
|
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
|
||||||
$head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Users").")";
|
$head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Users").")";
|
||||||
$nbExtrafields = is_countable($extrafields->attributes['user']['label']) ? count($extrafields->attributes['user']['label']) : 0;
|
$nbExtrafields = $extrafields->attributes['user']['count'];
|
||||||
if ($nbExtrafields > 0) {
|
if ($nbExtrafields > 0) {
|
||||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ function user_admin_prepare_head()
|
|||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
|
$head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
|
||||||
$head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Groups").")";
|
$head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Groups").")";
|
||||||
$nbExtrafields = is_countable($extrafields->attributes['usergroup']['label']) ? count($extrafields->attributes['usergroup']['label']) : 0;
|
$nbExtrafields = $extrafields->attributes['usergroup']['count'];
|
||||||
if ($nbExtrafields > 0) {
|
if ($nbExtrafields > 0) {
|
||||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user