30 require
'../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/treeview.lib.php';
34 $langs->loadLangs(array(
'users',
'companies',
'hrm',
'salaries'));
38 if ($user->socid > 0) {
39 $socid = $user->socid;
42 $optioncss =
GETPOST(
'optioncss',
'alpha');
43 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userlist';
44 $mode =
GETPOST(
"mode",
'alpha');
49 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
50 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
54 $search_statut =
GETPOST(
'search_statut',
'int');
55 if ($search_statut ==
'' || $search_statut ==
'0') {
59 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
63 if ($contextpage ==
'employeelist') {
67 $userstatic =
new User($db);
70 $canadduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
73 if ($contextpage ==
'employeelist' && $search_employee == 1) {
74 if (!$user->hasRight(
"salaries",
"read")) {
78 if (!$user->hasRight(
"user",
"user",
"read") && empty($user->admin)) {
83 $childids = $user->getAllChildIds(1);
93 $help_url =
'EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios|DE:Modul_Benutzer';
94 if ($contextpage ==
'employeelist' && $search_employee == 1) {
95 $title = $langs->trans(
"Employees");
97 $title = $langs->trans(
"Users");
100 '/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
101 '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js',
103 $arrayofcss = array(
'/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
105 llxHeader(
'', $title,
$help_url,
'', 0, 0, $arrayofjs, $arrayofcss,
'',
'bodyforlist');
109 $user_arbo = $userstatic->get_full_tree(0, ($search_statut !=
'' && $search_statut >= 0) ?
"statut = ".$search_statut :
'');
116 if (!is_array($user_arbo) && $user_arbo < 0) {
120 $fulltree = $user_arbo;
124 $data[] = array(
'rowid'=>0,
'fk_menu'=>-1,
'title'=>
"racine",
'mainmenu'=>
'',
'leftmenu'=>
'',
'fk_mainmenu'=>
'',
'fk_leftmenu'=>
'');
125 foreach ($fulltree as $key => $val) {
126 $userstatic->id = $val[
'id'];
127 $userstatic->ref = $val[
'id'];
128 $userstatic->login = $val[
'login'];
129 $userstatic->firstname = $val[
'firstname'];
130 $userstatic->lastname = $val[
'lastname'];
131 $userstatic->statut = $val[
'statut'];
132 $userstatic->email = $val[
'email'];
133 $userstatic->gender = $val[
'gender'];
134 $userstatic->socid = $val[
'fk_soc'];
135 $userstatic->admin = $val[
'admin'];
136 $userstatic->entity = $val[
'entity'];
137 $userstatic->photo = $val[
'photo'];
139 $entity = $val[
'entity'];
144 if (empty($entity)) {
145 $entitystring = $langs->trans(
"AllEntities");
147 $mc->getInfo($entity);
148 $entitystring = $mc->label;
152 $li = $userstatic->getNomUrl(-1,
'', 0, 1);
153 if (
isModEnabled(
'multicompany') && $userstatic->admin && !$userstatic->entity) {
154 $li .=
img_picto($langs->trans(
"SuperAdministrator"),
'redstar');
155 } elseif ($userstatic->admin) {
156 $li .=
img_picto($langs->trans(
"Administrator"),
'star');
158 $li .=
' <span class="opacitymedium">('.$val[
'login'].($entitystring ?
' - '.$entitystring :
'').
')</span>';
160 $entry =
'<table class="nobordernopadding centpercent"><tr class="trtree"><td class="'.($val[
'statut'] ?
'usertdenabled' :
'usertddisabled').
'">'.$li.
'</td><td align="right" class="'.($val[
'statut'] ?
'usertdenabled' :
'usertddisabled').
'">'.$userstatic->getLibStatut(2).
'</td></tr></table>';
163 'rowid'=>$val[
'rowid'],
164 'fk_menu'=>$val[
'fk_user'],
165 'statut'=>$val[
'statut'],
172 $param =
"&search_statut=".urlencode($search_statut);
173 $param =
"&contextpage=".urlencode($contextpage);
176 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.
'/user/list.php?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
177 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'HierarchicView'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.
'/user/hierarchy.php?mode=hierarchy'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', (($mode ==
'hierarchy') ? 2 : 1), array(
'morecss'=>
'reposition'));
178 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', DOL_URL_ROOT.
'/user/list.php?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
180 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewUser'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/user/card.php?action=create'.($mode ==
'employee' ?
'&employee=1' :
'').
'&leftmenu=',
'', $canadduser);
182 $massactionbutton =
'';
186 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'user', 0, $newcardbutton,
'', $limit, 0, 0, 1);
188 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
189 if ($optioncss !=
'') {
190 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
192 print
'<input type="hidden" name="token" value="'.newToken().
'">';
193 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
194 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
195 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
196 print
'<input type="hidden" name="page" value="'.$page.
'">';
197 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
198 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
200 print
'<div class="div-table-responsive">';
201 print
'<table class="liste nohover centpercent">';
203 print
'<tr class="liste_titre_filter">';
204 print
'<td class="liste_titre"> </td>';
205 print
'<td class="liste_titre"> </td>';
207 print
'<td class="liste_titre right">';
208 print
$form->selectarray(
'search_statut', array(
'-1'=>
'',
'1'=>$langs->trans(
'Enabled')), $search_statut, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth75imp');
210 print
'<td class="liste_titre maxwidthsearch">';
211 $searchpicto =
$form->showFilterAndCheckAddButtons(0);
216 print
'<tr class="liste_titre">';
218 print_liste_field_titre(
'<div id="iddivjstreecontrol"><a href="#">'.
img_picto(
'',
'folder',
'class="paddingright"').
'<span class="hideonsmartphone">'.$langs->trans(
"UndoExpandAll").
'</span></a> | <a href="#">'.
img_picto(
'',
'folder-open',
'class="paddingright"').
'<span class="hideonsmartphone">'.$langs->trans(
"ExpandAll").
'</span></a></div>', $_SERVER[
'PHP_SELF'],
"",
'',
"",
'align="center"');
224 $nbofentries = (count($data) - 1);
226 if ($nbofentries > 0) {
227 print
'<tr><td colspan="3">';
233 print
'<tr class="oddeven">';
234 print
'<td colspan="3">';
235 print
'<table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
236 print
'<td valign="middle">';
237 print $langs->trans(
"NoCategoryYet");
239 print
'<td> </td>';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage Dolibarr users.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0, $moreparam='')
Recursive function to output a tree.