29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
36$langs->loadLangs(array(
'users',
'other'));
38$action =
GETPOST(
'action',
'aZ09');
42$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userdoc';
44if (!isset($id) || empty($id)) {
49$canadduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
50$canreaduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
51$canedituser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
52$candisableuser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete"));
53$canreadgroup = $canreaduser;
54$caneditgroup = $canedituser;
56 $canreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
57 $caneditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write"));
62 $caneditfield = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"write"))
63 || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write")));
64 $caneditpassword = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"password"))
65 || (($user->id != $id) && $user->hasRight(
"user",
"user",
"passsword")));
68$permissiontoadd = $caneditfield;
69$permtoedit = $caneditfield;
73if ($user->socid > 0) {
74 $socid = $user->socid;
78$result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
80if ($user->id != $id && !$canreaduser) {
85$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
86$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
87$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
88$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
89if (empty($page) || $page == -1) {
92$offset = $limit * $page;
99 $sortfield =
"position_name";
102$object =
new User($db);
103if ($id > 0 || !empty($ref)) {
104 $result = $object->fetch($id, $ref,
'', 1);
105 $object->getrights();
108 $upload_dir = $conf->user->dir_output.
"/".$object->id;
112$hookmanager->initHooks(array(
'usercard',
'userdoc',
'globalcard'));
120$parameters = array(
'id'=>$socid);
121$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
126if (empty($reshook)) {
127 include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
135$form =
new Form($db);
138$person_name = !empty($object->firstname) ? $object->lastname.
", ".$object->firstname : $object->lastname;
139$title = $person_name.
" - ".$langs->trans(
'Documents');
147 if (isModEnabled(
'notification')) {
148 $langs->load(
"mails");
155 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
156 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
159 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName($object->getFullName($langs).
'.vcf')).
'" class="refid" rel="noopener">';
160 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
161 $morehtmlref .=
'</a>';
163 $urltovirtualcard =
'/user/virtualcard.php?id='.((int) $object->id);
164 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'nohover');
166 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
168 print
'<div class="fichecenter">';
169 print
'<div class="underbanner clearboth"></div>';
172 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ? SORT_DESC : SORT_ASC), 1);
174 foreach ($filearray as $key => $file) {
175 $totalsize += $file[
'size'];
179 print
'<table class="border tableforfield centpercent">';
182 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
'</td>';
183 if (!empty($object->ldap_sid) && $object->statut == 0) {
184 print
'<td class="error">';
185 print $langs->trans(
"LoginAccountDisableInDolibarr");
190 if (property_exists($object,
'admin')) {
191 if (isModEnabled(
'multicompany') && !empty($object->admin) && empty($object->entity)) {
192 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
193 } elseif (!empty($object->admin)) {
194 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
203 print
'<tr><td>'.$langs->trans(
"NbOfAttachedFiles").
'</td><td>'.count($filearray).
'</td></tr>';
206 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td>'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
213 $modulepart =
'user';
214 $param =
'&id='.$object->id;
215 include DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
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.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formated size.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.