26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
32 $langs->loadLangs(array(
'companies',
'products',
'admin',
'users',
'languages',
'projects',
'members'));
35 $canreaduser = ($user->admin || $user->rights->user->user->lire);
38 $action =
GETPOST(
'action',
'aZ09');
39 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userihm';
44 $caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
45 || (($user->id != $id) && $user->rights->user->user->creer));
50 if ($user->socid > 0) $socid = $user->socid;
51 $feature2 = (($socid && $user->rights->user->self->creer) ?
'' :
'user');
53 $result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
56 $dirtop =
"../core/menus/standard";
57 $dirleft =
"../core/menus/standard";
60 $object =
new User($db);
61 $object->fetch($id,
'',
'', 1);
71 $form =
new Form($db);
75 $hookmanager->initHooks(array(
'usercard',
'userihm',
'globalcard'));
82 $parameters = array(
'id'=>$socid);
83 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
84 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
86 if (empty($reshook)) {
87 if ($action ==
'update' && ($caneditfield || !empty($user->admin))) {
88 if (!$_POST[
"cancel"]) {
91 if (
GETPOST(
"check_MAIN_LANDING_PAGE") ==
"on") {
92 $tabparam[
"MAIN_LANDING_PAGE"] =
GETPOST(
"MAIN_LANDING_PAGE",
'alphanohtml');
94 $tabparam[
"MAIN_LANDING_PAGE"] =
'';
97 if (
GETPOST(
"check_MAIN_LANG_DEFAULT") ==
"on") {
98 $tabparam[
"MAIN_LANG_DEFAULT"] =
GETPOST(
"main_lang_default",
'aZ09');
100 $tabparam[
"MAIN_LANG_DEFAULT"] =
'';
103 if (
GETPOST(
"check_SIZE_LISTE_LIMIT") ==
"on") {
104 $tabparam[
"MAIN_SIZE_LISTE_LIMIT"] =
GETPOST(
"main_size_liste_limit",
'int');
106 $tabparam[
"MAIN_SIZE_LISTE_LIMIT"] =
'';
109 if (
GETPOST(
"check_AGENDA_DEFAULT_VIEW") ==
"on") {
110 $tabparam[
"AGENDA_DEFAULT_VIEW"] =
GETPOST(
"AGENDA_DEFAULT_VIEW",
'aZ09');
112 $tabparam[
"AGENDA_DEFAULT_VIEW"] =
'';
115 if (
GETPOST(
"check_MAIN_THEME") ==
"on") {
116 $tabparam[
"MAIN_THEME"] =
GETPOST(
'main_theme',
'aZ09');
118 $tabparam[
"MAIN_THEME"] =
'';
123 $tabparam[
'THEME_ELDY_TOPMENU_BACK1'] =
'';
125 $tabparam[
'THEME_ELDY_TOPMENU_BACK1'] = join(
',',
131 $tabparam[
'THEME_ELDY_BACKTITLE1'] =
'';
133 $tabparam[
'THEME_ELDY_BACKTITLE1'] = join(
',',
137 if (
GETPOST(
'check_THEME_ELDY_USE_HOVER') ==
'on') {
138 $tabparam[
"THEME_ELDY_USE_HOVER"] = 1;
140 $tabparam[
"THEME_ELDY_USE_HOVER"] = 0;
143 if (
GETPOST(
'check_THEME_ELDY_USE_CHECKED') ==
'on') {
144 $tabparam[
"THEME_ELDY_USE_CHECKED"] = 1;
146 $tabparam[
"THEME_ELDY_USE_CHECKED"] = 0;
149 if (
GETPOST(
'MAIN_OPTIMIZEFORTEXTBROWSER')) {
150 $tabparam[
"MAIN_OPTIMIZEFORTEXTBROWSER"] = 1;
152 $tabparam[
"MAIN_OPTIMIZEFORTEXTBROWSER"] = 0;
155 if (
GETPOST(
'MAIN_OPTIMIZEFORCOLORBLIND')) {
156 $tabparam[
"MAIN_OPTIMIZEFORCOLORBLIND"] =
GETPOST(
'MAIN_OPTIMIZEFORCOLORBLIND',
'aZ09');
158 $tabparam[
"MAIN_OPTIMIZEFORCOLORBLIND"] = 0;
163 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$id);
176 $tmparray = array(
'index.php'=>
'Dashboard');
177 if (!empty($conf->societe->enabled)) $tmparray[
'societe/index.php?mainmenu=companies&leftmenu='] =
'ThirdPartiesArea';
178 if (!empty($conf->projet->enabled)) $tmparray[
'projet/index.php?mainmenu=project&leftmenu='] =
'ProjectsArea';
179 if (!empty($conf->holiday->enabled) || !empty($conf->expensereport->enabled)) $tmparray[
'hrm/index.php?mainmenu=hrm&leftmenu='] =
'HRMArea';
180 if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) $tmparray[
'product/index.php?mainmenu=products&leftmenu='] =
'ProductsAndServicesArea';
181 if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->contrat->enabled)) $tmparray[
'comm/index.php?mainmenu=commercial&leftmenu='] =
'CommercialArea';
182 if (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled)) $tmparray[
'compta/index.php?mainmenu=compta&leftmenu='] =
'AccountancyTreasuryArea';
183 if (!empty($conf->adherent->enabled)) $tmparray[
'adherents/index.php?mainmenu=members&leftmenu='] =
'MembersArea';
184 if (!empty($conf->agenda->enabled)) $tmparray[
'comm/action/index.php?mainmenu=agenda&leftmenu='] =
'Agenda';
188 $title = $langs->trans(
"User");
190 if ($action ==
'edit')
192 print '<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
193 print '<input type="hidden" name="token" value="'.newToken().
'">';
194 print '<input type="hidden" name="action" value="update">';
195 print '<input type="hidden" name="id" value="'.$id.
'">';
199 if ($action ==
'edit')
205 if ($user->rights->user->user->lire || $user->admin) {
206 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
209 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
211 if (!empty($conf->use_javascript_ajax))
225 if (!empty($conf->use_javascript_ajax))
227 print '<script type="text/javascript" language="javascript">
228 jQuery(document).ready(function() {
229 function init_myfunc()
231 if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); }
232 else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); }
234 if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
235 else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
237 if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#main_size_liste_limit").removeAttr(\'disabled\'); }
238 else { jQuery("#main_size_liste_limit").attr(\'disabled\',\'disabled\'); }
240 if (jQuery("#check_AGENDA_DEFAULT_VIEW").prop("checked")) { jQuery("#AGENDA_DEFAULT_VIEW").removeAttr(\'disabled\'); }
241 else { jQuery("#AGENDA_DEFAULT_VIEW").attr(\'disabled\',\'disabled\'); }
243 if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
244 else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
246 if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
247 else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
250 jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); });
251 jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); });
252 jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); });
253 jQuery("#check_AGENDA_DEFAULT_VIEW").click(function() { init_myfunc(); });
254 jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); });
255 jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); });
256 jQuery("#check_THEME_ELDY_BACKTITLE1").click(function() { init_myfunc(); });
264 print '<table class="noborder centpercent tableforfield">';
265 print '<tr class="liste_titre"><td>'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"DefaultValue").
'</td><td> </td><td>'.$langs->trans(
"PersonalValue").
'</td></tr>';
268 print '<tr class="oddeven"><td>'.$langs->trans(
"Language").
'</td>';
271 print $s ? $s.
' ' :
'';
272 print ($conf->global->MAIN_LANG_DEFAULT ==
'auto' ? $langs->trans(
"AutoDetectLang") : $langs->trans(
"Language_".$conf->global->MAIN_LANG_DEFAULT));
274 print
'<td class="nowrap" width="20%"><input class="oddeven" name="check_MAIN_LANG_DEFAULT" id="check_MAIN_LANG_DEFAULT" type="checkbox" '.(!empty($object->conf->MAIN_LANG_DEFAULT) ?
" checked" :
"");
275 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
276 print
'> <label for="check_MAIN_LANG_DEFAULT">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
278 print $formadmin->select_language((!empty($object->conf->MAIN_LANG_DEFAULT) ? $object->conf->MAIN_LANG_DEFAULT :
''),
'main_lang_default', 1, null, 0, 0, (!empty($dolibarr_main_demo)));
282 print
'<tr class="oddeven"><td>'.$langs->trans(
"LandingPage").
'</td>';
284 print (empty($conf->global->MAIN_LANDING_PAGE) ?
'' : $conf->global->MAIN_LANDING_PAGE);
286 print
'<td class="nowrap" width="20%"><input class="oddeven" name="check_MAIN_LANDING_PAGE" id="check_MAIN_LANDING_PAGE" type="checkbox" '.(!empty($object->conf->MAIN_LANDING_PAGE) ?
" checked" :
"");
287 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
288 print
'> <label for="check_MAIN_LANDING_PAGE">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
290 print $form->selectarray(
'MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE :
''), 0, 0, 0,
'', 1);
295 print
'<tr class="oddeven">'.
"\n";
296 print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_VIEW").
'</td>'.
"\n";
297 print
'<td class="center"> </td>'.
"\n";
298 print
'<td class="nowrap" width="20%"><input class="oddeven" name="check_AGENDA_DEFAULT_VIEW" id="check_AGENDA_DEFAULT_VIEW" type="checkbox" '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ?
" checked" :
"");
299 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
300 print
'> <label for="check_AGENDA_DEFAULT_VIEW">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
302 $tmplist = array(
''=>
' ',
'show_list'=>$langs->trans(
"ViewList"),
'show_month'=>$langs->trans(
"ViewCal"),
'show_week'=>$langs->trans(
"ViewWeek"),
'show_day'=>$langs->trans(
"ViewDay"),
'show_peruser'=>$langs->trans(
"ViewPerUser"));
303 print $form->selectarray(
'AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0,
'');
304 print
'</td></tr>'.
"\n";
307 print
'<tr class="oddeven"><td>'.$langs->trans(
"MaxSizeList").
'</td>';
308 print
'<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.
'</td>';
309 print
'<td class="nowrap" width="20%"><input class="oddeven" name="check_SIZE_LISTE_LIMIT" id="check_SIZE_LISTE_LIMIT" type="checkbox" '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ?
" checked" :
"");
310 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
311 print
'> <label for="check_SIZE_LISTE_LIMIT">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
312 print
'<td><input class="flat" name="main_size_liste_limit" id="main_size_liste_limit" size="4" value="'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT :
'').
'"></td></tr>';
314 print
'</table><br>';
317 showSkins($object, (($user->admin || empty($dolibarr_main_demo)) ? 1 : 0),
true);
322 print
'<div class="center">';
323 print
'<input type="submit" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'">';
324 print
' ';
325 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
330 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
332 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
334 print
'<table class="noborder centpercent tableforfield">';
335 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"DefaultValue").
'</td><td> </td><td>'.$langs->trans(
"PersonalValue").
'</td></tr>';
338 print
'<tr class="oddeven"><td>'.$langs->trans(
"Language").
'</td>';
341 print ($s ? $s.
' ' :
'');
342 print (isset($conf->global->MAIN_LANG_DEFAULT) && $conf->global->MAIN_LANG_DEFAULT ==
'auto' ? $langs->trans(
"AutoDetectLang") : $langs->trans(
"Language_".$conf->global->MAIN_LANG_DEFAULT));
344 print
'<td class="nowrap"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_LANG_DEFAULT) ?
" checked" :
"").
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
346 $s = (isset($object->conf->MAIN_LANG_DEFAULT) ?
picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) :
'');
347 print ($s ? $s.
' ' :
'');
348 print (isset($object->conf->MAIN_LANG_DEFAULT) && $object->conf->MAIN_LANG_DEFAULT ==
'auto' ? $langs->trans(
"AutoDetectLang") : (!empty($object->conf->MAIN_LANG_DEFAULT) ? $langs->trans(
"Language_".$object->conf->MAIN_LANG_DEFAULT) :
''));
352 print
'<tr class="oddeven"><td>'.$langs->trans(
"LandingPage").
'</td>';
354 print (empty($conf->global->MAIN_LANDING_PAGE) ?
'' : $conf->global->MAIN_LANDING_PAGE);
356 print
'<td class="nowrap"><input class="oddeven" name="check_MAIN_LANDING_PAGE" disabled id="check_MAIN_LANDING_PAGE" type="checkbox" '.(!empty($object->conf->MAIN_LANDING_PAGE) ?
" checked" :
"");
357 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
358 print
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
360 if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE]))
362 print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
363 }
else print $object->conf->MAIN_LANDING_PAGE;
368 print
'<tr class="oddeven">'.
"\n";
369 print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_VIEW").
'</td>'.
"\n";
370 print
'<td class="center"> </td>'.
"\n";
371 print
'<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ?
" checked" :
"").
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
373 $tmplist = array(
''=>
' ',
'show_list'=>$langs->trans(
"ViewList"),
'show_month'=>$langs->trans(
"ViewCal"),
'show_week'=>$langs->trans(
"ViewWeek"),
'show_day'=>$langs->trans(
"ViewDay"),
'show_peruser'=>$langs->trans(
"ViewPerUser"));
374 if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) print $form->selectarray(
'AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0,
'', 0, 0, 1);
375 print
'</td></tr>'.
"\n";
378 print
'<tr class="oddeven"><td>'.$langs->trans(
"MaxSizeList").
'</td>';
379 print
'<td>'.(!empty($conf->global->MAIN_SIZE_LISTE_LIMIT) ? $conf->global->MAIN_SIZE_LISTE_LIMIT :
' ').
'</td>';
380 print
'<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ?
" checked" :
"").
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
381 print
'<td>'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT :
' ').
'</td></tr>';
383 print
'</table><br>';
392 print
'<div class="tabsAction">';
393 if (empty($user->admin) && !empty($dolibarr_main_demo))
395 print
"<a class=\"butActionRefused classfortooltip\" title=\"".$langs->trans(
"FeatureDisabledInDemo").
"\" href=\"#\">".$langs->trans(
"Modify").
"</a>";
397 if ($caneditfield || !empty($user->admin))
399 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
401 print
"<a class=\"butActionRefused classfortooltip\" title=\"".$langs->trans(
"NotEnoughPermissions").
"\" href=\"#\">".$langs->trans(
"Modify").
"</a>";
408 if ($action ==
'edit')
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
user_prepare_head($object)
Prepare array with list of tabs.
Class to manage Dolibarr users.
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,255).
showSkins($fuser, $edit=0, $foruserprofile=false)
Show list of themes.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=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 Calling this function terminate execution ...
dol_set_user_param($db, $conf, &$user, $tab)
Save personnal parameter.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
picto_from_langcode($codelang, $moreatt= '')
Return img flag of country for a language code or country code.