27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userhome';
41if (!$user->hasRight(
'user',
'user',
'lire') && !$user->admin) {
43 header(
"Location: card.php?id=".$user->id);
50$permissiontoreadgroup =
true;
52 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
57if ($user->socid > 0) {
58 $socid = $user->socid;
61$companystatic =
new Societe($db);
62$fuserstatic =
new User($db);
65$hookmanager->initHooks(array(
'userhome'));
66if (!isset($form) || !is_object($form)) {
67 $form =
new Form($db);
74 require_once DOL_DOCUMENT_ROOT.
'/core/class/infobox.class.php';
77 $boxorder =
GETPOST(
'boxorder',
'aZ09');
78 $boxorder .=
GETPOST(
'boxcombo',
'aZ09');
92$title = $langs->trans(
"MenuUsersAndGroups");
94llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-home');
97print
load_fiche_titre($langs->trans(
"MenuUsersAndGroups"), $resultboxes[
'selectboxlist'],
'user');
101$searchbox =
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
102$searchbox .=
'<input type="hidden" name="token" value="'.newToken().
'">';
104$searchbox .=
'<table class="noborder nohover centpercent">';
105$searchbox .=
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Search").
'</td></tr>';
106$searchbox .=
'<tr><td>';
107$searchbox .= $langs->trans(
"User").
':</td><td><input class="flat inputsearch width200" type="text" name="search_user"></td></tr>';
110if ($permissiontoreadgroup) {
111 $searchbox .=
'<tr><td>';
112 $searchbox .= $langs->trans(
"Group").
':</td><td><input class="flat inputsearch width200" type="text" name="search_group"></td></tr>';
115$searchbox .=
'<tr><td class="center" colspan="2"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
116$searchbox .=
"</table><br>\n";
118$searchbox .=
'</form>';
126$sql =
"SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_soc, u.datec, u.statut";
128$sql .=
", u.ldap_sid";
132$sql .=
", s.nom as name";
133$sql .=
", s.code_client";
135$sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u";
136$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON u.fk_soc = s.rowid";
138$parameters = array();
139$reshook = $hookmanager->executeHooks(
'printUserListWhere', $parameters);
141 $sql .= $hookmanager->resPrint;
143 $sql .=
" WHERE u.entity IN (".getEntity(
'user').
")";
146 $sql .=
" AND u.fk_soc = ".((int) $socid);
148$sql .= $db->order(
"u.datec",
"DESC");
149$sql .= $db->plimit($max);
151$resql = $db->query($sql);
153 $num = $db->num_rows($resql);
155 $lastcreatedbox .=
'<div class="div-table-responsive-no-min">';
156 $lastcreatedbox .=
'<table class="noborder centpercent">';
157 $lastcreatedbox .=
'<tr class="liste_titre"><td colspan="3" class="valignmiddle">';
158 $lastcreatedbox .=
'<span class="valignmiddle">'.$langs->trans(
"LastUsersCreated", min($num, $max)).
'</span>';
159 $lastcreatedbox .=
'<a class="valignmiddle marginleftonlyshort" href="'.DOL_URL_ROOT.
'/user/list.php?sortfield=u.datec&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
160 $lastcreatedbox .=
'<span class="badge marginleftonlyshort valignmiddle">...</span>';
161 $lastcreatedbox .=
'</a>';
162 $lastcreatedbox .=
'</td>';
163 $lastcreatedbox .=
'<td class="right" colspan="2">';
165 $lastcreatedbox .=
'</td>';
166 $lastcreatedbox .=
'</tr>'.
"\n";
169 while ($i < $num && $i < $max) {
170 $obj = $db->fetch_object($resql);
172 $fuserstatic->id = $obj->rowid;
173 $fuserstatic->statut = $obj->statut;
174 $fuserstatic->status = $obj->statut;
175 $fuserstatic->lastname = $obj->lastname;
176 $fuserstatic->firstname = $obj->firstname;
177 $fuserstatic->login = $obj->login;
178 $fuserstatic->photo = $obj->photo;
179 $fuserstatic->admin = $obj->admin;
180 $fuserstatic->email = $obj->email;
181 $fuserstatic->socid = $obj->fk_soc;
183 $companystatic->id = $obj->fk_soc;
184 $companystatic->name = $obj->name;
185 $companystatic->code_client = $obj->code_client;
186 $companystatic->canvas = $obj->canvas;
188 $lastcreatedbox .=
'<tr class="oddeven">';
189 $lastcreatedbox .=
'<td class="nowraponall tdoverflowmax150">';
190 $lastcreatedbox .= $fuserstatic->getNomUrl(-1);
191 if (isModEnabled(
'multicompany') && $obj->admin && !$obj->entity) {
192 $lastcreatedbox .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
'redstar');
193 } elseif ($obj->admin) {
194 $lastcreatedbox .=
img_picto($langs->trans(
"AdministratorDesc"),
'star');
196 $lastcreatedbox .=
"</td>";
197 $lastcreatedbox .=
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).
'">'.
dol_escape_htmltag($obj->login).
'</td>';
200 $texttoshow .= $companystatic->getNomUrl(1);
202 $texttoshow .=
'<span class="opacitymedium">'.$langs->trans(
"InternalUser").
'</span>';
204 if ($obj->ldap_sid) {
205 $texttoshow .=
' <span class="opacitymedium">('.$langs->trans(
"DomainUser").
')</span>';
207 $entity = $obj->entity;
210 if (isModEnabled(
'multicompany') && is_object($mc)) {
211 if (empty($entity)) {
212 $entitystring = $langs->trans(
"AllEntities");
214 $mc->getInfo($entity);
215 $entitystring = $mc->label;
218 $texttoshow .= ($entitystring ?
' <span class="opacitymedium">('.$entitystring.
')</span>' :
'');
219 $lastcreatedbox .=
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag(
dol_string_nohtmltag($texttoshow)).
'">';
220 $lastcreatedbox .= $texttoshow;
221 $lastcreatedbox .=
'</td>';
222 $lastcreatedbox .=
'<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec),
'dayhour').
'</td>';
223 $lastcreatedbox .=
'<td class="right">';
224 $lastcreatedbox .= $fuserstatic->getLibStatut(3);
225 $lastcreatedbox .=
'</td>';
227 $lastcreatedbox .=
'</tr>';
230 $lastcreatedbox .=
"</table>";
231 $lastcreatedbox .=
"</div><br>";
243if ($permissiontoreadgroup) {
244 $sql =
"SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec";
245 $sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup as g";
246 if (isModEnabled(
'multicompany') &&
$conf->entity == 1 && (
getDolGlobalInt(
'MULTICOMPANY_TRANSVERSE_MODE') || ($user->admin && !$user->entity))) {
247 $sql .=
" WHERE g.entity IS NOT NULL";
249 $sql .=
" WHERE g.entity IN (0, ".$conf->entity.
")";
251 $sql .= $db->order(
"g.datec",
"DESC");
252 $sql .= $db->plimit($max);
254 $resql = $db->query($sql);
257 if (isModEnabled(
'multicompany')) {
260 $num = $db->num_rows($resql);
262 $lastgroupbox .=
'<div class="div-table-responsive-no-min">';
263 $lastgroupbox .=
'<table class="noborder centpercent">';
264 $lastgroupbox .=
'<tr class="liste_titre"><td colspan="'.$colspan.
'">';
265 $lastgroupbox .=
'<span class="valignmiddle">'.$langs->trans(
"LastGroupsCreated", ($num ? $num : $max)).
'</span>';
266 $lastgroupbox .=
'<a class="valignmiddle marginleftonlyshort" href="'.DOL_URL_ROOT.
'/user/group/list.php?sortfield=g.datec&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
267 $lastgroupbox .=
'<span class="badge marginleftonlyshort valignmiddle">...</span>';
268 $lastgroupbox .=
'</a>';
270 $lastgroupbox .=
'</td>';
271 $lastgroupbox .=
'<td class="right">';
273 $lastgroupbox .=
'</td>';
274 $lastgroupbox .=
'</tr>';
279 while ($i < $num && (!$max || $i < $max)) {
280 $obj = $db->fetch_object($resql);
282 $grouptemp->id = $obj->rowid;
283 $grouptemp->name = $obj->name;
284 $grouptemp->note = $obj->note;
286 $lastgroupbox .=
'<tr class="oddeven">';
287 $lastgroupbox .=
'<td>';
288 $lastgroupbox .= $grouptemp->getNomUrl(1);
290 $lastgroupbox .=
img_picto($langs->trans(
"GlobalGroup"),
'redstar');
292 $lastgroupbox .=
"</td>";
293 if (isModEnabled(
'multicompany') && is_object($mc)) {
294 $mc->getInfo($obj->entity);
295 $lastgroupbox .=
'<td>';
296 $lastgroupbox .= $mc->label;
297 $lastgroupbox .=
'</td>';
299 $lastgroupbox .=
'<td class="nowrap right">'.dol_print_date($db->jdate($obj->datec),
'dayhour').
'</td>';
300 $lastgroupbox .=
"</tr>";
303 $lastgroupbox .=
"</table>";
304 $lastgroupbox .=
"</div><br>";
313print
'<div class="clearboth"></div>';
314print
'<div class="fichecenter fichecenterbis">';
316$boxlist =
'<div class="twocolumns">';
318$boxlist .=
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
319$boxlist .= $searchbox;
320$boxlist .= $resultboxes[
'boxlista'];
321$boxlist .=
'</div>'.
"\n";
323$boxlist .=
'<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
324$boxlist .= $lastcreatedbox;
325$boxlist .= $lastgroupbox;
326$boxlist .= $resultboxes[
'boxlistb'];
327$boxlist .=
'</div>'.
"\n";
336$parameters = array(
'user' => $user);
337$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($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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
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.
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 a 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...