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;
62$companystatic =
new Societe($db);
63$fuserstatic =
new User($db);
66$hookmanager->initHooks(array(
'userhome'));
67if (!isset($form) || !is_object($form)) {
68 $form =
new Form($db);
74include DOL_DOCUMENT_ROOT.
'/core/actions_addbox.inc.php';
83$title = $langs->trans(
"MenuUsersAndGroups");
85llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-home');
88print
load_fiche_titre($langs->trans(
"MenuUsersAndGroups"), $resultboxes[
'selectboxlist'],
'user');
92$searchbox =
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
93$searchbox .=
'<input type="hidden" name="token" value="'.newToken().
'">';
95$searchbox .=
'<table class="noborder nohover centpercent">';
96$searchbox .=
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Search").
'</td></tr>';
97$searchbox .=
'<tr><td>';
98$searchbox .= $langs->trans(
"User").
':</td><td><input class="flat inputsearch width200" type="text" name="search_user"></td></tr>';
101if ($permissiontoreadgroup) {
102 $searchbox .=
'<tr><td>';
103 $searchbox .= $langs->trans(
"Group").
':</td><td><input class="flat inputsearch width200" type="text" name="search_group"></td></tr>';
106$searchbox .=
'<tr><td class="center" colspan="2"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
107$searchbox .=
"</table><br>\n";
109$searchbox .=
'</form>';
117$sql =
"SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_soc, u.datec, u.statut";
119$sql .=
", u.ldap_sid";
123$sql .=
", s.nom as name";
124$sql .=
", s.code_client";
126$sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u";
127$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON u.fk_soc = s.rowid";
129$parameters = array();
130$reshook = $hookmanager->executeHooks(
'printUserListWhere', $parameters);
132 $sql .= $hookmanager->resPrint;
134 $sql .=
" WHERE u.entity IN (".getEntity(
'user').
")";
137 $sql .=
" AND u.fk_soc = ".((int) $socid);
139$sql .= $db->order(
"u.datec",
"DESC");
140$sql .= $db->plimit($max);
142$resql = $db->query($sql);
144 $num = $db->num_rows($resql);
146 $lastcreatedbox .=
'<div class="div-table-responsive-no-min">';
147 $lastcreatedbox .=
'<table class="noborder centpercent">';
148 $lastcreatedbox .=
'<tr class="liste_titre"><td colspan="3" class="valignmiddle">';
149 $lastcreatedbox .=
'<span class="valignmiddle">'.$langs->trans(
"LastUsersCreated", min($num, $max)).
'</span>';
150 $lastcreatedbox .=
'<a class="valignmiddle marginleftonlyshort" href="'.dolBuildUrl(DOL_URL_ROOT.
'/user/list.php', [
'sortfield' =>
'u.datec',
'sortorder' =>
'DESC']).
'" title="'.$langs->trans(
"FullList").
'">';
151 $lastcreatedbox .=
'<span class="badge marginleftonlyshort valignmiddle">...</span>';
152 $lastcreatedbox .=
'</a>';
153 $lastcreatedbox .=
'</td>';
154 $lastcreatedbox .=
'<td class="right" colspan="2">';
156 $lastcreatedbox .=
'</td>';
157 $lastcreatedbox .=
'</tr>'.
"\n";
160 while ($i < $num && $i < $max) {
161 $obj = $db->fetch_object($resql);
163 $fuserstatic->id = $obj->rowid;
164 $fuserstatic->status = $obj->statut;
165 $fuserstatic->lastname = $obj->lastname;
166 $fuserstatic->firstname = $obj->firstname;
167 $fuserstatic->login = $obj->login;
168 $fuserstatic->photo = $obj->photo;
169 $fuserstatic->admin = $obj->admin;
170 $fuserstatic->email = $obj->email;
171 $fuserstatic->socid = $obj->fk_soc;
173 $companystatic->id = $obj->fk_soc;
174 $companystatic->name = $obj->name;
175 $companystatic->code_client = $obj->code_client;
176 $companystatic->canvas = $obj->canvas;
178 $lastcreatedbox .=
'<tr class="oddeven">';
179 $lastcreatedbox .=
'<td class="nowraponall tdoverflowmax150">';
180 $lastcreatedbox .= $fuserstatic->getNomUrl(-1);
181 if (
isModEnabled(
'multicompany') && $obj->admin && !$obj->entity) {
182 $lastcreatedbox .= img_picto($langs->trans(
"SuperAdministratorDesc"),
'superadmin');
183 } elseif ($obj->admin) {
184 $lastcreatedbox .= img_picto($langs->trans(
"AdministratorDesc"),
'admin');
186 $lastcreatedbox .=
"</td>";
187 $lastcreatedbox .=
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).
'">'.
dol_escape_htmltag($obj->login).
'</td>';
190 $texttoshow .= $companystatic->getNomUrl(1);
192 $texttoshow .=
'<span class="opacitymedium">'.$langs->trans(
"InternalUser").
'</span>';
194 if ($obj->ldap_sid) {
195 $texttoshow .=
' <span class="opacitymedium">('.$langs->trans(
"DomainUser").
')</span>';
197 $entity = $obj->entity;
200 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
201 if (empty($entity)) {
202 $entitystring = $langs->trans(
"AllEntities");
204 $mc->getInfo($entity);
205 $entitystring = $mc->label;
208 $texttoshow .= ($entitystring ?
' <span class="opacitymedium">('.$entitystring.
')</span>' :
'');
209 $lastcreatedbox .=
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag(
dol_string_nohtmltag($texttoshow)).
'">';
210 $lastcreatedbox .= $texttoshow;
211 $lastcreatedbox .=
'</td>';
212 $lastcreatedbox .=
'<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec),
'dayhour').
'</td>';
213 $lastcreatedbox .=
'<td class="right">';
214 $lastcreatedbox .= $fuserstatic->getLibStatut(3);
215 $lastcreatedbox .=
'</td>';
217 $lastcreatedbox .=
'</tr>';
220 $lastcreatedbox .=
"</table>";
221 $lastcreatedbox .=
"</div><br>";
225 dol_print_error($db);
233if ($permissiontoreadgroup) {
234 $sql =
"SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec";
235 $sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup as g";
237 $sql .=
" WHERE g.entity IS NOT NULL";
239 $sql .=
" WHERE g.entity IN (0, ".((int)
$conf->entity).
")";
241 $sql .= $db->order(
"g.datec",
"DESC");
242 $sql .= $db->plimit($max);
244 $resql = $db->query($sql);
250 $num = $db->num_rows($resql);
252 $lastgroupbox .=
'<div class="div-table-responsive-no-min">';
253 $lastgroupbox .=
'<table class="noborder centpercent">';
254 $lastgroupbox .=
'<tr class="liste_titre"><td colspan="'.$colspan.
'">';
255 $lastgroupbox .=
'<span class="valignmiddle">'.$langs->trans(
"LastGroupsCreated", ($num ? $num : $max)).
'</span>';
256 $lastgroupbox .=
'<a class="valignmiddle marginleftonlyshort" href="'.DOL_URL_ROOT.
'/user/group/list.php?sortfield=g.datec&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
257 $lastgroupbox .=
'<span class="badge marginleftonlyshort valignmiddle">...</span>';
258 $lastgroupbox .=
'</a>';
260 $lastgroupbox .=
'</td>';
261 $lastgroupbox .=
'<td class="right">';
263 $lastgroupbox .=
'</td>';
264 $lastgroupbox .=
'</tr>';
269 while ($i < $num && (!$max || $i < $max)) {
270 $obj = $db->fetch_object($resql);
272 $grouptemp->id = $obj->rowid;
273 $grouptemp->name = $obj->name;
274 $grouptemp->note = $obj->note;
276 $lastgroupbox .=
'<tr class="oddeven">';
277 $lastgroupbox .=
'<td>';
278 $lastgroupbox .= $grouptemp->getNomUrl(1);
280 $lastgroupbox .= img_picto($langs->trans(
"GlobalGroup"),
'superadmin');
282 $lastgroupbox .=
"</td>";
283 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
284 $mc->getInfo($obj->entity);
285 $lastgroupbox .=
'<td>';
286 $lastgroupbox .= $mc->label;
287 $lastgroupbox .=
'</td>';
289 $lastgroupbox .=
'<td class="nowrap right">'.dol_print_date($db->jdate($obj->datec),
'dayhour').
'</td>';
290 $lastgroupbox .=
"</tr>";
293 $lastgroupbox .=
"</table>";
294 $lastgroupbox .=
"</div><br>";
298 dol_print_error($db);
303print
'<div class="clearboth"></div>';
304print
'<div class="fichecenter fichecenterbis">';
306$boxlist =
'<div class="twocolumns">';
308$boxlist .=
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
309$boxlist .= $searchbox;
310$boxlist .= $resultboxes[
'boxlista'];
311$boxlist .=
'</div>'.
"\n";
313$boxlist .=
'<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
314$boxlist .= $lastcreatedbox;
315$boxlist .= $lastgroupbox;
316$boxlist .= $resultboxes[
'boxlistb'];
317$boxlist .=
'</div>'.
"\n";
326$parameters = array(
'user' => $user);
327$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.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)