New - Show list of users in user category card
This commit is contained in:
parent
22824026ef
commit
2f951c0441
@ -144,6 +144,13 @@ if ($id > 0 && $removeelem > 0)
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'project';
|
||||
}
|
||||
elseif ($type == Categorie::TYPE_USER && $user->rights->user->user->creer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$tmpobject = new User($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'user';
|
||||
}
|
||||
|
||||
$result = $object->del_type($tmpobject, $elementtype);
|
||||
if ($result < 0) dol_print_error('', $object->error);
|
||||
@ -834,6 +841,53 @@ if ($type == Categorie::TYPE_PROJECT)
|
||||
}
|
||||
}
|
||||
|
||||
// List of users
|
||||
if ($type == Categorie::TYPE_USER)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
$users = $object->getObjectsInCateg("user");
|
||||
if ($users < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Users").' <span class="badge">'.count($users).'</span></td></tr>'."\n";
|
||||
|
||||
if (count($users) > 0)
|
||||
{
|
||||
// Use "$userentry" here, because "$user" is the current user
|
||||
foreach ($users as $key => $userentry)
|
||||
{
|
||||
print "\t".'<tr class="oddeven">'."\n";
|
||||
print '<td class="nowrap" valign="top">';
|
||||
print $userentry->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
print '<td class="tdtop">'.$userentry->job."</td>\n";
|
||||
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($user->rights->user->user->creer)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$type."&removeelem=".$userentry->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink');
|
||||
print "</a>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoUsers").'</td></tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user