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 = ($user->admin || $user->rights->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';
66 $zone =
GETPOST(
'areacode',
'int');
67 $userid =
GETPOST(
'userid',
'int');
68 $boxorder =
GETPOST(
'boxorder',
'aZ09');
69 $boxorder .=
GETPOST(
'boxcombo',
'aZ09');
79$title = $langs->trans(
"MenuUsersAndGroups");
84print
load_fiche_titre($langs->trans(
"MenuUsersAndGroups"), $resultboxes[
'selectboxlist'],
'user');
88$searchbox =
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
89$searchbox .=
'<input type="hidden" name="token" value="'.newToken().
'">';
91$searchbox .=
'<table class="noborder nohover centpercent">';
92$searchbox .=
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Search").
'</td></tr>';
93$searchbox .=
'<tr><td>';
94$searchbox .= $langs->trans(
"User").
':</td><td><input class="flat inputsearch width200" type="text" name="search_user"></td></tr>';
98 $searchbox .=
'<tr><td>';
99 $searchbox .= $langs->trans(
"Group").
':</td><td><input class="flat inputsearch width200" type="text" name="search_group"></td></tr>';
102$searchbox .=
'<tr><td class="center" colspan="2"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
103$searchbox .=
"</table><br>\n";
105$searchbox .=
'</form>';
113$sql =
"SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_soc, u.datec, u.statut";
115$sql .=
", u.ldap_sid";
119$sql .=
", s.nom as name";
120$sql .=
", s.code_client";
122$sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u";
123$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON u.fk_soc = s.rowid";
125$parameters = array();
126$reshook = $hookmanager->executeHooks(
'printUserListWhere', $parameters);
128 $sql .= $hookmanager->resPrint;
130 $sql .=
" WHERE u.entity IN (".getEntity(
'user').
")";
133 $sql .=
" AND u.fk_soc = ".((int) $socid);
135$sql .= $db->order(
"u.datec",
"DESC");
136$sql .= $db->plimit($max);
138$resql = $db->query($sql);
140 $num = $db->num_rows($resql);
142 $lastcreatedbox .=
'<div class="div-table-responsive-no-min">';
143 $lastcreatedbox .=
'<table class="noborder centpercent">';
144 $lastcreatedbox .=
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"LastUsersCreated", min($num, $max)).
'</td>';
145 $lastcreatedbox .=
'<td class="right" colspan="2"><a class="commonlink" href="'.DOL_URL_ROOT.
'/user/list.php?sortfield=u.datec&sortorder=DESC">'.$langs->trans(
"FullList").
'</td>';
146 $lastcreatedbox .=
'</tr>'.
"\n";
149 while ($i < $num && $i < $max) {
150 $obj = $db->fetch_object($resql);
152 $fuserstatic->id = $obj->rowid;
153 $fuserstatic->statut = $obj->statut;
154 $fuserstatic->lastname = $obj->lastname;
155 $fuserstatic->firstname = $obj->firstname;
156 $fuserstatic->login = $obj->login;
157 $fuserstatic->photo = $obj->photo;
158 $fuserstatic->admin = $obj->admin;
159 $fuserstatic->email = $obj->email;
160 $fuserstatic->socid = $obj->fk_soc;
162 $companystatic->id = $obj->fk_soc;
163 $companystatic->name = $obj->name;
164 $companystatic->code_client = $obj->code_client;
165 $companystatic->canvas = $obj->canvas;
167 $lastcreatedbox .=
'<tr class="oddeven">';
168 $lastcreatedbox .=
'<td class="nowraponall tdoverflowmax150">';
169 $lastcreatedbox .= $fuserstatic->getNomUrl(-1);
170 if (isModEnabled(
'multicompany') && $obj->admin && !$obj->entity) {
171 $lastcreatedbox .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
'redstar');
172 } elseif ($obj->admin) {
173 $lastcreatedbox .=
img_picto($langs->trans(
"AdministratorDesc"),
'star');
175 $lastcreatedbox .=
"</td>";
176 $lastcreatedbox .=
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).
'">'.
dol_escape_htmltag($obj->login).
'</td>';
179 $texttoshow .= $companystatic->getNomUrl(1);
181 $texttoshow .=
'<span class="opacitymedium">'.$langs->trans(
"InternalUser").
'</span>';
183 if ($obj->ldap_sid) {
184 $texttoshow .=
' <span class="opacitymedium">('.$langs->trans(
"DomainUser").
')</span>';
186 $entity = $obj->entity;
189 if (isModEnabled(
'multicompany') && is_object($mc)) {
190 if (empty($entity)) {
191 $entitystring = $langs->trans(
"AllEntities");
193 $mc->getInfo($entity);
194 $entitystring = $mc->label;
197 $texttoshow .= ($entitystring ?
' <span class="opacitymedium">('.$entitystring.
')</span>' :
'');
198 $lastcreatedbox .=
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag(
dol_string_nohtmltag($texttoshow)).
'">';
199 $lastcreatedbox .= $texttoshow;
200 $lastcreatedbox .=
'</td>';
201 $lastcreatedbox .=
'<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec),
'dayhour').
'</td>';
202 $lastcreatedbox .=
'<td class="right">';
203 $lastcreatedbox .= $fuserstatic->getLibStatut(3);
204 $lastcreatedbox .=
'</td>';
206 $lastcreatedbox .=
'</tr>';
209 $lastcreatedbox .=
"</table>";
210 $lastcreatedbox .=
"</div><br>";
225 $sql =
"SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec";
226 $sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup as g";
227 if (isModEnabled(
'multicompany') && $conf->entity == 1 && (
getDolGlobalInt(
'MULTICOMPANY_TRANSVERSE_MODE') || ($user->admin && !$user->entity))) {
228 $sql .=
" WHERE g.entity IS NOT NULL";
230 $sql .=
" WHERE g.entity IN (0, ".$conf->entity.
")";
232 $sql .= $db->order(
"g.datec",
"DESC");
233 $sql .= $db->plimit($max);
235 $resql = $db->query($sql);
238 if (isModEnabled(
'multicompany')) {
241 $num = $db->num_rows($resql);
243 $lastgroupbox .=
'<div class="div-table-responsive-no-min">';
244 $lastgroupbox .=
'<table class="noborder centpercent">';
245 $lastgroupbox .=
'<tr class="liste_titre"><td colspan="'.$colspan.
'">'.$langs->trans(
"LastGroupsCreated", ($num ? $num : $max)).
'</td>';
246 $lastgroupbox .=
'<td class="right"><a class="commonlink" href="'.DOL_URL_ROOT.
'/user/group/list.php?sortfield=g.datec&sortorder=DESC">'.$langs->trans(
"FullList").
'</td>';
247 $lastgroupbox .=
'</tr>';
252 while ($i < $num && (!$max || $i < $max)) {
253 $obj = $db->fetch_object($resql);
255 $grouptemp->id = $obj->rowid;
256 $grouptemp->name = $obj->name;
257 $grouptemp->note = $obj->note;
259 $lastgroupbox .=
'<tr class="oddeven">';
260 $lastgroupbox .=
'<td>';
261 $lastgroupbox .= $grouptemp->getNomUrl(1);
263 $lastgroupbox .=
img_picto($langs->trans(
"GlobalGroup"),
'redstar');
265 $lastgroupbox .=
"</td>";
266 if (isModEnabled(
'multicompany') && is_object($mc)) {
267 $mc->getInfo($obj->entity);
268 $lastgroupbox .=
'<td>';
269 $lastgroupbox .= $mc->label;
270 $lastgroupbox .=
'</td>';
272 $lastgroupbox .=
'<td class="nowrap right">'.dol_print_date($db->jdate($obj->datec),
'dayhour').
'</td>';
273 $lastgroupbox .=
"</tr>";
276 $lastgroupbox .=
"</table>";
277 $lastgroupbox .=
"</div><br>";
286print
'<div class="clearboth"></div>';
287print
'<div class="fichecenter fichecenterbis">';
289$boxlist =
'<div class="twocolumns">';
291$boxlist .=
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
292$boxlist .= $searchbox;
293$boxlist .= $resultboxes[
'boxlista'];
294$boxlist .=
'</div>'.
"\n";
296$boxlist .=
'<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
297$boxlist .= $lastcreatedbox;
298$boxlist .= $lastgroupbox;
299$boxlist .= $resultboxes[
'boxlistb'];
300$boxlist .=
'</div>'.
"\n";
309$parameters = array(
'user' => $user);
310$reshook = $hookmanager->executeHooks(
'dashboardUsersGroups', $parameters, $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($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
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...