28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userhome';
42if (!$user->hasRight(
'user',
'user',
'lire') && !$user->admin) {
44 header(
"Location: card.php?id=".$user->id);
51$permissiontoreadgroup =
true;
53 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
58if ($user->socid > 0) {
59 $socid = $user->socid;
66$hookmanager->initHooks(array(
'userhome'));
67if (!isset($form) || !is_object($form)) {
75 require_once DOL_DOCUMENT_ROOT.
'/core/class/infobox.class.php';
78 $boxorder =
GETPOST(
'boxorder',
'aZ09');
79 $boxorder .=
GETPOST(
'boxcombo',
'aZ09');
93$title = $langs->trans(
"MenuUsersAndGroups");
95llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-home');
98print
load_fiche_titre($langs->trans(
"MenuUsersAndGroups"), $resultboxes[
'selectboxlist'],
'user');
102$searchbox =
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
103$searchbox .=
'<input type="hidden" name="token" value="'.newToken().
'">';
105$searchbox .=
'<table class="noborder nohover centpercent">';
106$searchbox .=
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Search").
'</td></tr>';
107$searchbox .=
'<tr><td>';
108$searchbox .= $langs->trans(
"User").
':</td><td><input class="flat inputsearch width200" type="text" name="search_user"></td></tr>';
111if ($permissiontoreadgroup) {
112 $searchbox .=
'<tr><td>';
113 $searchbox .= $langs->trans(
"Group").
':</td><td><input class="flat inputsearch width200" type="text" name="search_group"></td></tr>';
116$searchbox .=
'<tr><td class="center" colspan="2"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
117$searchbox .=
"</table><br>\n";
119$searchbox .=
'</form>';
127$sql =
"SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_soc, u.datec, u.statut";
129$sql .=
", u.ldap_sid";
133$sql .=
", s.nom as name";
134$sql .=
", s.code_client";
136$sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u";
137$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON u.fk_soc = s.rowid";
139$parameters = array();
140$reshook = $hookmanager->executeHooks(
'printUserListWhere', $parameters);
142 $sql .= $hookmanager->resPrint;
144 $sql .=
" WHERE u.entity IN (".getEntity(
'user').
")";
147 $sql .=
" AND u.fk_soc = ".((int) $socid);
149$sql .=
$db->order(
"u.datec",
"DESC");
150$sql .=
$db->plimit($max);
152$resql =
$db->query($sql);
154 $num =
$db->num_rows($resql);
156 $lastcreatedbox .=
'<div class="div-table-responsive-no-min">';
157 $lastcreatedbox .=
'<table class="noborder centpercent">';
158 $lastcreatedbox .=
'<tr class="liste_titre"><td colspan="3" class="valignmiddle">';
159 $lastcreatedbox .=
'<span class="valignmiddle">'.$langs->trans(
"LastUsersCreated", min($num, $max)).
'</span>';
160 $lastcreatedbox .=
'<a class="valignmiddle marginleftonlyshort" href="'.dolBuildUrl(DOL_URL_ROOT.
'/user/list.php', [
'sortfield' =>
'u.datec',
'sortorder' =>
'DESC']).
'" title="'.$langs->trans(
"FullList").
'">';
161 $lastcreatedbox .=
'<span class="badge marginleftonlyshort valignmiddle">...</span>';
162 $lastcreatedbox .=
'</a>';
163 $lastcreatedbox .=
'</td>';
164 $lastcreatedbox .=
'<td class="right" colspan="2">';
166 $lastcreatedbox .=
'</td>';
167 $lastcreatedbox .=
'</tr>'.
"\n";
170 while ($i < $num && $i < $max) {
171 $obj =
$db->fetch_object($resql);
173 $fuserstatic->id = $obj->rowid;
174 $fuserstatic->statut = $obj->statut;
175 $fuserstatic->status = $obj->statut;
176 $fuserstatic->lastname = $obj->lastname;
177 $fuserstatic->firstname = $obj->firstname;
178 $fuserstatic->login = $obj->login;
179 $fuserstatic->photo = $obj->photo;
180 $fuserstatic->admin = $obj->admin;
181 $fuserstatic->email = $obj->email;
182 $fuserstatic->socid = $obj->fk_soc;
184 $companystatic->id = $obj->fk_soc;
185 $companystatic->name = $obj->name;
186 $companystatic->code_client = $obj->code_client;
187 $companystatic->canvas = $obj->canvas;
189 $lastcreatedbox .=
'<tr class="oddeven">';
190 $lastcreatedbox .=
'<td class="nowraponall tdoverflowmax150">';
191 $lastcreatedbox .= $fuserstatic->getNomUrl(-1);
192 if (
isModEnabled(
'multicompany') && $obj->admin && !$obj->entity) {
193 $lastcreatedbox .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
'superadmin');
194 } elseif ($obj->admin) {
195 $lastcreatedbox .=
img_picto($langs->trans(
"AdministratorDesc"),
'admin');
197 $lastcreatedbox .=
"</td>";
198 $lastcreatedbox .=
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).
'">'.
dol_escape_htmltag($obj->login).
'</td>';
201 $texttoshow .= $companystatic->getNomUrl(1);
203 $texttoshow .=
'<span class="opacitymedium">'.$langs->trans(
"InternalUser").
'</span>';
205 if ($obj->ldap_sid) {
206 $texttoshow .=
' <span class="opacitymedium">('.$langs->trans(
"DomainUser").
')</span>';
208 $entity = $obj->entity;
211 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
212 if (empty($entity)) {
213 $entitystring = $langs->trans(
"AllEntities");
215 $mc->getInfo($entity);
216 $entitystring = $mc->label;
219 $texttoshow .= ($entitystring ?
' <span class="opacitymedium">('.$entitystring.
')</span>' :
'');
220 $lastcreatedbox .=
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag(
dol_string_nohtmltag($texttoshow)).
'">';
221 $lastcreatedbox .= $texttoshow;
222 $lastcreatedbox .=
'</td>';
223 $lastcreatedbox .=
'<td class="center nowrap">'.dol_print_date(
$db->jdate($obj->datec),
'dayhour').
'</td>';
224 $lastcreatedbox .=
'<td class="right">';
225 $lastcreatedbox .= $fuserstatic->getLibStatut(3);
226 $lastcreatedbox .=
'</td>';
228 $lastcreatedbox .=
'</tr>';
231 $lastcreatedbox .=
"</table>";
232 $lastcreatedbox .=
"</div><br>";
244if ($permissiontoreadgroup) {
245 $sql =
"SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec";
246 $sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup as g";
248 $sql .=
" WHERE g.entity IS NOT NULL";
250 $sql .=
" WHERE g.entity IN (0, ".((int)
$conf->entity).
")";
252 $sql .=
$db->order(
"g.datec",
"DESC");
253 $sql .=
$db->plimit($max);
255 $resql =
$db->query($sql);
261 $num =
$db->num_rows($resql);
263 $lastgroupbox .=
'<div class="div-table-responsive-no-min">';
264 $lastgroupbox .=
'<table class="noborder centpercent">';
265 $lastgroupbox .=
'<tr class="liste_titre"><td colspan="'.$colspan.
'">';
266 $lastgroupbox .=
'<span class="valignmiddle">'.$langs->trans(
"LastGroupsCreated", ($num ? $num : $max)).
'</span>';
267 $lastgroupbox .=
'<a class="valignmiddle marginleftonlyshort" href="'.DOL_URL_ROOT.
'/user/group/list.php?sortfield=g.datec&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
268 $lastgroupbox .=
'<span class="badge marginleftonlyshort valignmiddle">...</span>';
269 $lastgroupbox .=
'</a>';
271 $lastgroupbox .=
'</td>';
272 $lastgroupbox .=
'<td class="right">';
274 $lastgroupbox .=
'</td>';
275 $lastgroupbox .=
'</tr>';
280 while ($i < $num && (!$max || $i < $max)) {
281 $obj =
$db->fetch_object($resql);
283 $grouptemp->id = $obj->rowid;
284 $grouptemp->name = $obj->name;
285 $grouptemp->note = $obj->note;
287 $lastgroupbox .=
'<tr class="oddeven">';
288 $lastgroupbox .=
'<td>';
289 $lastgroupbox .= $grouptemp->getNomUrl(1);
291 $lastgroupbox .=
img_picto($langs->trans(
"GlobalGroup"),
'superadmin');
293 $lastgroupbox .=
"</td>";
294 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
295 $mc->getInfo($obj->entity);
296 $lastgroupbox .=
'<td>';
297 $lastgroupbox .= $mc->label;
298 $lastgroupbox .=
'</td>';
300 $lastgroupbox .=
'<td class="nowrap right">'.dol_print_date(
$db->jdate($obj->datec),
'dayhour').
'</td>';
301 $lastgroupbox .=
"</tr>";
304 $lastgroupbox .=
"</table>";
305 $lastgroupbox .=
"</div><br>";
314print
'<div class="clearboth"></div>';
315print
'<div class="fichecenter fichecenterbis">';
317$boxlist =
'<div class="twocolumns">';
319$boxlist .=
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
320$boxlist .= $searchbox;
321$boxlist .= $resultboxes[
'boxlista'];
322$boxlist .=
'</div>'.
"\n";
324$boxlist .=
'<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
325$boxlist .= $lastcreatedbox;
326$boxlist .= $lastgroupbox;
327$boxlist .= $resultboxes[
'boxlistb'];
328$boxlist .=
'</div>'.
"\n";
337$parameters = array(
'user' => $user);
338$reshook = $hookmanager->executeHooks(
'dashboardUsersGroups', $parameters,
$object);
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
static saveboxorder($dbs, $zone, $boxorder, $userid=0)
Save order of boxes for area and user.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...