26require
'../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
30$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userhome';
32if (!$user->hasRight(
'user',
'user',
'lire') && !$user->admin) {
34 header(
"Location: card.php?id=".$user->id);
43 $canreadperms = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
48if ($user->socid > 0) {
49 $socid = $user->socid;
52$companystatic =
new Societe($db);
53$fuserstatic =
new User($db);
56$hookmanager->initHooks(array(
'userhome'));
57if (!isset($form) || !is_object($form)) {
58 $form =
new Form($db);
65 require_once DOL_DOCUMENT_ROOT.
'/core/class/infobox.class.php';
68 $boxorder =
GETPOST(
'boxorder',
'aZ09');
69 $boxorder .=
GETPOST(
'boxcombo',
'aZ09');
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>';
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="'.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->statut = $obj->statut;
165 $fuserstatic->status = $obj->statut;
166 $fuserstatic->lastname = $obj->lastname;
167 $fuserstatic->firstname = $obj->firstname;
168 $fuserstatic->login = $obj->login;
169 $fuserstatic->photo = $obj->photo;
170 $fuserstatic->admin = $obj->admin;
171 $fuserstatic->email = $obj->email;
172 $fuserstatic->socid = $obj->fk_soc;
174 $companystatic->id = $obj->fk_soc;
175 $companystatic->name = $obj->name;
176 $companystatic->code_client = $obj->code_client;
177 $companystatic->canvas = $obj->canvas;
179 $lastcreatedbox .=
'<tr class="oddeven">';
180 $lastcreatedbox .=
'<td class="nowraponall tdoverflowmax150">';
181 $lastcreatedbox .= $fuserstatic->getNomUrl(-1);
182 if (isModEnabled(
'multicompany') && $obj->admin && !$obj->entity) {
183 $lastcreatedbox .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
'redstar');
184 } elseif ($obj->admin) {
185 $lastcreatedbox .=
img_picto($langs->trans(
"AdministratorDesc"),
'star');
187 $lastcreatedbox .=
"</td>";
188 $lastcreatedbox .=
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).
'">'.
dol_escape_htmltag($obj->login).
'</td>';
191 $texttoshow .= $companystatic->getNomUrl(1);
193 $texttoshow .=
'<span class="opacitymedium">'.$langs->trans(
"InternalUser").
'</span>';
195 if ($obj->ldap_sid) {
196 $texttoshow .=
' <span class="opacitymedium">('.$langs->trans(
"DomainUser").
')</span>';
198 $entity = $obj->entity;
201 if (isModEnabled(
'multicompany') && is_object($mc)) {
202 if (empty($entity)) {
203 $entitystring = $langs->trans(
"AllEntities");
205 $mc->getInfo($entity);
206 $entitystring = $mc->label;
209 $texttoshow .= ($entitystring ?
' <span class="opacitymedium">('.$entitystring.
')</span>' :
'');
210 $lastcreatedbox .=
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag(
dol_string_nohtmltag($texttoshow)).
'">';
211 $lastcreatedbox .= $texttoshow;
212 $lastcreatedbox .=
'</td>';
213 $lastcreatedbox .=
'<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec),
'dayhour').
'</td>';
214 $lastcreatedbox .=
'<td class="right">';
215 $lastcreatedbox .= $fuserstatic->getLibStatut(3);
216 $lastcreatedbox .=
'</td>';
218 $lastcreatedbox .=
'</tr>';
221 $lastcreatedbox .=
"</table>";
222 $lastcreatedbox .=
"</div><br>";
235 $sql =
"SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec";
236 $sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup as g";
237 if (isModEnabled(
'multicompany') && $conf->entity == 1 && (
getDolGlobalInt(
'MULTICOMPANY_TRANSVERSE_MODE') || ($user->admin && !$user->entity))) {
238 $sql .=
" WHERE g.entity IS NOT NULL";
240 $sql .=
" WHERE g.entity IN (0, ".$conf->entity.
")";
242 $sql .= $db->order(
"g.datec",
"DESC");
243 $sql .= $db->plimit($max);
245 $resql = $db->query($sql);
248 if (isModEnabled(
'multicompany')) {
251 $num = $db->num_rows($resql);
253 $lastgroupbox .=
'<div class="div-table-responsive-no-min">';
254 $lastgroupbox .=
'<table class="noborder centpercent">';
255 $lastgroupbox .=
'<tr class="liste_titre"><td colspan="'.$colspan.
'">';
256 $lastgroupbox .=
'<span class="valignmiddle">'.$langs->trans(
"LastGroupsCreated", ($num ? $num : $max)).
'</span>';
257 $lastgroupbox .=
'<a class="valignmiddle marginleftonlyshort" href="'.DOL_URL_ROOT.
'/user/group/list.php?sortfield=g.datec&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
258 $lastgroupbox .=
'<span class="badge marginleftonlyshort valignmiddle">...</span>';
259 $lastgroupbox .=
'</a>';
261 $lastgroupbox .=
'</td>';
262 $lastgroupbox .=
'<td class="right">';
264 $lastgroupbox .=
'</td>';
265 $lastgroupbox .=
'</tr>';
270 while ($i < $num && (!$max || $i < $max)) {
271 $obj = $db->fetch_object($resql);
273 $grouptemp->id = $obj->rowid;
274 $grouptemp->name = $obj->name;
275 $grouptemp->note = $obj->note;
277 $lastgroupbox .=
'<tr class="oddeven">';
278 $lastgroupbox .=
'<td>';
279 $lastgroupbox .= $grouptemp->getNomUrl(1);
281 $lastgroupbox .=
img_picto($langs->trans(
"GlobalGroup"),
'redstar');
283 $lastgroupbox .=
"</td>";
284 if (isModEnabled(
'multicompany') && is_object($mc)) {
285 $mc->getInfo($obj->entity);
286 $lastgroupbox .=
'<td>';
287 $lastgroupbox .= $mc->label;
288 $lastgroupbox .=
'</td>';
290 $lastgroupbox .=
'<td class="nowrap right">'.dol_print_date($db->jdate($obj->datec),
'dayhour').
'</td>';
291 $lastgroupbox .=
"</tr>";
294 $lastgroupbox .=
"</table>";
295 $lastgroupbox .=
"</div><br>";
304print
'<div class="clearboth"></div>';
305print
'<div class="fichecenter fichecenterbis">';
307$boxlist =
'<div class="twocolumns">';
309$boxlist .=
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
310$boxlist .= $searchbox;
311$boxlist .= $resultboxes[
'boxlista'];
312$boxlist .=
'</div>'.
"\n";
314$boxlist .=
'<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
315$boxlist .= $lastcreatedbox;
316$boxlist .= $lastgroupbox;
317$boxlist .= $resultboxes[
'boxlistb'];
318$boxlist .=
'</div>'.
"\n";
327$parameters = array(
'user' => $user);
328$reshook = $hookmanager->executeHooks(
'dashboardUsersGroups', $parameters,
$object);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...