dolibarr 20.0.2
param_ihm.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2010-2015 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro.com>
5 * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
6 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
27// Load Dolibarr environment
28require '../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
32
33// Load translation files required by page
34$langs->loadLangs(array('companies', 'products', 'admin', 'users', 'languages', 'projects', 'members'));
35
36// Defini si peux lire/modifier permissions
37$canreaduser = ($user->admin || $user->hasRight("user", "user", "read"));
38
39$id = GETPOSTINT('id');
40$action = GETPOST('action', 'aZ09');
41$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'userihm'; // To manage different context of search
42
43if (!isset($id) || empty($id)) {
45}
46
47if ($id) {
48 // $user est le user qui edite, $id est l'id de l'utilisateur edite
49 $caneditfield = ((($user->id == $id) && $user->hasRight("user", "self", "write"))
50 || (($user->id != $id) && $user->hasRight("user", "user", "write")));
51}
52
53// Security check
54$socid = 0;
55if ($user->socid > 0) {
56 $socid = $user->socid;
57}
58$feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user');
59
60$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
61if ($user->id != $id && !$canreaduser) {
63}
64
65$dirtop = "../core/menus/standard";
66$dirleft = "../core/menus/standard";
67
68// Charge utilisateur edite
69$object = new User($db);
70$object->fetch($id, '', '', 1);
71$object->getrights();
72
73// Liste des zone de recherche permanentes supportees
74/* deprecated
75$searchform=array("main_searchform_societe","main_searchform_contact","main_searchform_produitservice");
76$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE);
77$searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"));
78*/
79
80$form = new Form($db);
81$formadmin = new FormAdmin($db);
82
83// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
84$hookmanager->initHooks(array('usercard', 'userihm', 'globalcard'));
85
86
87/*
88 * Actions
89 */
90
91$parameters = array('id'=>$socid);
92$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
93if ($reshook < 0) {
94 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
95}
96
97if (empty($reshook)) {
98 if ($action == 'update' && ($caneditfield || !empty($user->admin))) {
99 if (!GETPOST("cancel")) {
100 $tabparam = array();
101
102 if (GETPOST("check_MAIN_LANDING_PAGE") == "on") {
103 $tabparam["MAIN_LANDING_PAGE"] = GETPOST("MAIN_LANDING_PAGE", 'alphanohtml');
104 } else {
105 $tabparam["MAIN_LANDING_PAGE"] = '';
106 }
107
108 if (GETPOST("check_MAIN_LANG_DEFAULT") == "on") {
109 $tabparam["MAIN_LANG_DEFAULT"] = GETPOST("main_lang_default", 'aZ09');
110 } else {
111 $tabparam["MAIN_LANG_DEFAULT"] = '';
112 }
113
114 if (GETPOST("check_MAIN_SIZE_LISTE_LIMIT") == "on") {
115 $tabparam["MAIN_SIZE_LISTE_LIMIT"] = GETPOSTINT("MAIN_SIZE_LISTE_LIMIT");
116 } else {
117 $tabparam["MAIN_SIZE_LISTE_LIMIT"] = '';
118 }
119
120 if (GETPOST("check_MAIN_SIZE_SHORTLIST_LIMIT") == "on") {
121 $tabparam["MAIN_SIZE_SHORTLIST_LIMIT"] = GETPOSTINT("MAIN_SIZE_SHORTLIST_LIMIT");
122 } else {
123 $tabparam["MAIN_SIZE_SHORTLIST_LIMIT"] = '';
124 }
125
126 if (GETPOST("check_AGENDA_DEFAULT_VIEW") == "on") {
127 $tabparam["AGENDA_DEFAULT_VIEW"] = GETPOST("AGENDA_DEFAULT_VIEW", 'aZ09');
128 } else {
129 $tabparam["AGENDA_DEFAULT_VIEW"] = '';
130 }
131
132 if (GETPOST("check_MAIN_THEME") == "on") {
133 $tabparam["MAIN_THEME"] = GETPOST('main_theme', 'aZ09');
134 } else {
135 $tabparam["MAIN_THEME"] = '';
136 }
137
138 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1', 'alphanohtml'), array()))));
139 if ($val == '') {
140 $tabparam['THEME_ELDY_TOPMENU_BACK1'] = '';
141 } else {
142 $tabparam['THEME_ELDY_TOPMENU_BACK1'] = implode(
143 ',',
144 colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1', 'alphanohtml'), array())
145 );
146 }
147
148 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array()))));
149 if ($val == '') {
150 $tabparam['THEME_ELDY_BACKTITLE1'] = '';
151 } else {
152 $tabparam['THEME_ELDY_BACKTITLE1'] = implode(
153 ',',
154 colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array())
155 );
156 }
157
158 if (GETPOST('check_THEME_ELDY_USE_HOVER') == 'on') {
159 $tabparam["THEME_ELDY_USE_HOVER"] = 1;
160 } else {
161 $tabparam["THEME_ELDY_USE_HOVER"] = 0;
162 }
163
164 if (GETPOST('check_THEME_ELDY_USE_CHECKED') == 'on') {
165 $tabparam["THEME_ELDY_USE_CHECKED"] = 1;
166 } else {
167 $tabparam["THEME_ELDY_USE_CHECKED"] = 0;
168 }
169
170 if (GETPOST('MAIN_OPTIMIZEFORTEXTBROWSER')) {
171 $tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 1;
172 } else {
173 $tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 0;
174 }
175
176 if (GETPOST('MAIN_OPTIMIZEFORCOLORBLIND')) {
177 $tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = GETPOST('MAIN_OPTIMIZEFORCOLORBLIND', 'aZ09');
178 } else {
179 $tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = 0;
180 }
181
182 $result = dol_set_user_param($db, $conf, $object, $tabparam);
183
184 // Clear cache of widgets (because we may have modified the length of cached widget lists)
185 include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
186 $cachedir = DOL_DATA_ROOT.'/users/temp/widgets';
187 dol_delete_dir_recursive($cachedir);
188
189 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
190 exit;
191 }
192 }
193}
194
195
196/*
197 * View
198 */
199
200$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
201$title = $person_name." - ".$langs->trans('Card');
202$help_url = '';
203
204llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-user page-card_param_ihm');
205
206// List of possible landing pages
207$tmparray = array();
208$tmparray['index.php'] = array('label'=>'Dashboard', 'picto'=>'graph');
209if (isModEnabled("societe")) {
210 $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = array('label'=>'ThirdPartiesArea', 'picto'=>'company');
211}
212if (isModEnabled('project')) {
213 $tmparray['projet/index.php?mainmenu=project&leftmenu='] = array('label'=>'ProjectsArea', 'picto'=>'project');
214 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
215 $tmparray['projet/list.php?mainmenu=project&leftmenu=&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead'] = array('label'=>'ListOpenLeads', 'picto'=>'project');
216 }
217}
218if (isModEnabled('holiday') || isModEnabled('expensereport')) {
219 $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = array('label'=>'HRMArea', 'picto'=>'user'); // TODO Complete list with first level of menus
220}
221if (isModEnabled("product") || isModEnabled("service")) {
222 $tmparray['product/index.php?mainmenu=products&leftmenu='] = array('label'=>'ProductsAndServicesArea', 'picto'=>'product');
223}
224if (isModEnabled("propal") || isModEnabled('order') || isModEnabled('intervention') || isModEnabled('contract')) {
225 $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = array('label'=>'CommercialArea', 'picto'=>'commercial');
226}
227if (isModEnabled('invoice')) {
228 $tmparray['compta/index.php?mainmenu=billing&leftmenu='] = array('label'=>'InvoicesArea', 'picto'=>'bill');
229}
230if (isModEnabled('comptabilite') || isModEnabled('accounting')) {
231 $tmparray['compta/index.php?mainmenu=accountancy&leftmenu='] = array('label'=>'AccountancyTreasuryArea', 'picto'=>'bill');
232}
233if (isModEnabled('member')) {
234 $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = array('label'=>'MembersArea', 'picto'=>'member');
235}
236if (isModEnabled('agenda')) {
237 $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = array('label'=>'Agenda', 'picto'=>'action');
238}
239if (isModEnabled('ticket')) {
240 $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = array('label'=>'Tickets', 'picto'=>'ticket');
241}
242// add bookmarks to available landing pages
243if (!getDolGlobalString('MAIN_NO_BOOKMARKS_FOR_LANDING_PAGES')) {
244 $sql = "SELECT b.rowid, b.fk_user, b.url, b.title";
245 $sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b";
246 $sql .= " WHERE b.entity IN (".getEntity('bookmark').")";
247 $sql .= " AND b.url NOT LIKE 'http%'";
248 if (!$object->admin) {
249 $sql .= " AND (b.fk_user = ".((int) $object->id)." OR b.fk_user is NULL OR b.fk_user = 0)";
250 }
251 $resql = $db->query($sql);
252 if ($resql) {
253 $i = 0;
254 $num_rows = $db->num_rows($resql);
255 if ($num_rows > 0) {
256 $tmparray['sep'.$i] = array(
257 'data-html'=>'<span class="opacitymedium">--- '.$langs->trans("Bookmarks").'</span>',
258 'label'=>'--- '.$langs->trans("Bookmarks"),
259 'picto' => '',
260 );
261 while ($i < $num_rows) {
262 $obj = $db->fetch_object($resql);
263
264 $landing_url = str_replace(DOL_URL_ROOT, '', $obj->url);
265 $tmparray[$landing_url] = array('label'=>$obj->title, 'picto'=>'generic');
266 $i++;
267 }
268 }
269 }
270}
271
272// Hook for insertion new items in the List of possible landing pages
273$reshook = $hookmanager->executeHooks('addToLandingPageList', $tmparray, $object);
274if ($reshook < 0) {
275 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
276} elseif ($reshook > 0) {
277 $tmparray = $hookmanager->resArray;
278} elseif ($reshook == 0) {
279 $tmparray = array_merge($tmparray, $hookmanager->resArray);
280}
281
282foreach ($tmparray as $key => $val) {
283 $tmparray[$key]['data-html'] = img_picto($langs->trans($val['label']), empty($val['picto']) ? 'generic' : $val['picto'], 'class="pictofixedwidth"').$langs->trans($val['label']);
284 $tmparray[$key]['label'] = $langs->trans($val['label']);
285}
286
287$head = user_prepare_head($object);
288
289$title = $langs->trans("User");
290
291if ($action == 'edit') {
292 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
293 print '<input type="hidden" name="token" value="'.newToken().'">';
294 print '<input type="hidden" name="action" value="update">';
295 print '<input type="hidden" name="id" value="'.$id.'">';
296}
297
298
299if ($action == 'edit') {
300 print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user');
301
302 $linkback = '';
303
304 if ($user->hasRight("user", "user", "read") || $user->admin) {
305 $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
306 }
307
308 dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin);
309
310 print '<div class="underbanner clearboth"></div>';
311
312 print dol_get_fiche_end();
313
314
315 if (!empty($conf->use_javascript_ajax)) {
316 print '<script type="text/javascript">
317 jQuery(document).ready(function() {
318 function init_myfunc()
319 {
320 if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); }
321 else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); }
322
323 if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
324 else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
325
326 if (jQuery("#check_MAIN_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#MAIN_SIZE_LISTE_LIMIT").removeAttr(\'disabled\'); }
327 else { jQuery("#MAIN_SIZE_LISTE_LIMIT").attr(\'disabled\',\'disabled\'); }
328
329 if (jQuery("#check_MAIN_SIZE_SHORTLIST_LIMIT").prop("checked")) { jQuery("#MAIN_SIZE_SHORTLIST_LIMIT").removeAttr(\'disabled\'); }
330 else { jQuery("#MAIN_SIZE_SHORTLIST_LIMIT").attr(\'disabled\',\'disabled\'); }
331
332 if (jQuery("#check_AGENDA_DEFAULT_VIEW").prop("checked")) { jQuery("#AGENDA_DEFAULT_VIEW").removeAttr(\'disabled\'); }
333 else { jQuery("#AGENDA_DEFAULT_VIEW").attr(\'disabled\',\'disabled\'); }
334
335 if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
336 else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
337
338 if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
339 else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
340 }
341 init_myfunc();
342 jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); });
343 jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); });
344 jQuery("#check_MAIN_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); });
345 jQuery("#check_MAIN_SIZE_SHORTLIST_LIMIT").click(function() { init_myfunc(); });
346 jQuery("#check_AGENDA_DEFAULT_VIEW").click(function() { init_myfunc(); });
347 jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); });
348 jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); });
349 jQuery("#check_THEME_ELDY_BACKTITLE1").click(function() { init_myfunc(); });
350 });
351 </script>';
352 }
353
354
355 clearstatcache();
356
357 print '<table class="noborder centpercent">';
358 print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("DefaultValue").'</td><td>&nbsp;</td><td>'.$langs->trans("PersonalValue").'</td></tr>';
359
360 // Language by default
361 print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("Language").'</td>';
362 print '<td>';
363 $s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
364 print $s ? $s.' ' : '';
365 print(getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT')));
366 print '</td>';
367 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" : "");
368 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
369 print '> <label for="check_MAIN_LANG_DEFAULT">'.$langs->trans("UsePersonalValue").'</label></td>';
370 print '<td>';
371 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)));
372 print '</td></tr>';
373
374 // Landing page
375 print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
376 print '<td>';
377 print(!getDolGlobalString('MAIN_LANDING_PAGE') ? '' : $conf->global->MAIN_LANDING_PAGE);
378 print '</td>';
379 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" : "");
380 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
381 print '> <label for="check_MAIN_LANDING_PAGE">'.$langs->trans("UsePersonalValue").'</label></td>';
382 print '<td>';
383 print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE : ''), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth250');
384 //print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0);
385 print '</td></tr>';
386
387 // Landing page for Agenda - AGENDA_DEFAULT_VIEW
388 print '<tr class="oddeven">'."\n";
389 print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
390 print '<td class="center">&nbsp;</td>'."\n";
391 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" : "");
392 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
393 print '> <label for="check_AGENDA_DEFAULT_VIEW">'.$langs->trans("UsePersonalValue").'</label></td>';
394 print '<td>'."\n";
395 $tmplist = array(''=>'&nbsp;', '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"));
396 print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, (isset($object->conf->AGENDA_DEFAULT_VIEW) ? $object->conf->AGENDA_DEFAULT_VIEW : ''), 0, 0, 0, '');
397 print '</td></tr>'."\n";
398
399 // Max size of lists
400 print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
401 print '<td>' . getDolGlobalString('MAIN_SIZE_LISTE_LIMIT').'</td>';
402 print '<td class="nowrap" width="20%"><input class="oddeven" name="check_MAIN_SIZE_LISTE_LIMIT" id="check_MAIN_SIZE_LISTE_LIMIT" type="checkbox" '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : "");
403 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
404 print '> <label for="check_MAIN_SIZE_LISTE_LIMIT">'.$langs->trans("UsePersonalValue").'</label></td>';
405 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>';
406
407 // Max size of lists
408 print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeShortList").'</td>';
409 print '<td>' . getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT').'</td>';
410 print '<td class="nowrap" width="20%"><input class="oddeven" name="check_MAIN_SIZE_SHORTLIST_LIMIT" id="check_MAIN_SIZE_SHORTLIST_LIMIT" type="checkbox" '.(!empty($object->conf->MAIN_SIZE_SHORTLIST_LIMIT) ? " checked" : "");
411 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
412 print '> <label for="check_MAIN_SIZE_SHORTLIST_LIMIT">'.$langs->trans("UsePersonalValue").'</label></td>';
413 print '<td><input class="flat" name="MAIN_SIZE_SHORTLIST_LIMIT" id="MAIN_SIZE_SHORTLIST_LIMIT" size="4" value="'.(!empty($object->conf->MAIN_SIZE_SHORTLIST_LIMIT) ? $object->conf->MAIN_SIZE_SHORTLIST_LIMIT : '').'"></td></tr>';
414
415 print '</table><br>';
416
417 // Theme
418 showSkins($object, (($user->admin || empty($dolibarr_main_demo)) ? 1 : 0), true);
419
420
421 print $form->buttonsSaveCancel();
422} else {
423 print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user');
424
425 $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
426
427 $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">';
428 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
429 $morehtmlref .= '</a>';
430
431 $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
432 $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->transnoentitiesnoconv("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
433
434 dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
435
436 print '<div class="fichecenter">';
437
438 print '<div class="underbanner clearboth"></div>';
439 print '<table class="border centpercent tableforfield">';
440
441 // Login
442 print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
443 if (!empty($object->ldap_sid) && $object->statut == 0) {
444 print '<td class="error">';
445 print $langs->trans("LoginAccountDisableInDolibarr");
446 print '</td>';
447 } else {
448 print '<td>';
449 $addadmin = '';
450 if (property_exists($object, 'admin')) {
451 if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
452 $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
453 } elseif (!empty($object->admin)) {
454 $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
455 }
456 }
457 print showValueWithClipboardCPButton($object->login).$addadmin;
458 print '</td>';
459 }
460 print '</tr>'."\n";
461
462 print '</table>';
463
464 print '</div>';
465
466 print dol_get_fiche_end();
467
468
469 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
470 print '<table class="noborder centpercent">';
471 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("DefaultValue").'</td><td>&nbsp;</td><td>'.$langs->trans("PersonalValue").'</td></tr>';
472
473 // Language
474 print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td>';
475 print '<td>';
476 $s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
477 print($s ? $s.' ' : '');
478 print(getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT')));
479 print '</td>';
480 print '<td class="nowrap"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_LANG_DEFAULT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
481 print '<td>';
482 $s = (isset($object->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) : '');
483 print($s ? $s.' ' : '');
484 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) : ''));
485 print '</td></tr>';
486
487 // Landing page
488 print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
489 print '<td>';
490 print(!getDolGlobalString('MAIN_LANDING_PAGE') ? '' : $conf->global->MAIN_LANDING_PAGE);
491 print '</td>';
492 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" : "");
493 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
494 print '> '.$langs->trans("UsePersonalValue").'</td>';
495 print '<td class="tdoverflowmax300">';
496 if (!empty($object->conf->MAIN_LANDING_PAGE)) {
497 $urltoshow = '';
498 if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
499 if (is_array($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
500 $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]['label']);
501 } else {
502 $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
503 }
504 } else {
505 $urltoshow = $object->conf->MAIN_LANDING_PAGE;
506 }
507 print '<a href="'.DOL_URL_ROOT.'/'.$object->conf->MAIN_LANDING_PAGE.'" target="_blank" rel="noopener">';
508 $s = '';
509 if (isset($tmparray[$object->conf->MAIN_LANDING_PAGE]['picto']) && !empty($tmparray[$object->conf->MAIN_LANDING_PAGE]['picto'])) {
510 $s = img_picto($urltoshow, $tmparray[$object->conf->MAIN_LANDING_PAGE]['picto'], 'class="pictofixedwidth"');
511 }
512 if (empty($s)) {
513 print img_picto($urltoshow, 'globe', 'class="pictofixedwidth"');
514 } else {
515 print $s;
516 }
517 print $urltoshow;
518 print '</a>';
519 }
520 print '</td></tr>';
521
522 // Landing page for Agenda - AGENDA_DEFAULT_VIEW
523 print '<tr class="oddeven">'."\n";
524 print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
525 print '<td class="center">&nbsp;</td>'."\n";
526 print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
527 print '<td>'."\n";
528 $tmplist = array(''=>'&nbsp;', '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"));
529 if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) {
530 print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1);
531 }
532 print '</td></tr>'."\n";
533
534 // Max size for lists
535 print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
536 print '<td>'.getDolGlobalString('MAIN_SIZE_LISTE_LIMIT', '&nbsp;').'</td>';
537 print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
538 print '<td>'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT : '&nbsp;').'</td></tr>';
539
540 // Max size for lists
541 print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeShortList").'</td>';
542 print '<td>'.getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT', '&nbsp;').'</td>';
543 print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_SIZE_SHORTLIST_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
544 print '<td>'.(!empty($object->conf->MAIN_SIZE_SHORTLIST_LIMIT) ? $object->conf->MAIN_SIZE_SHORTLIST_LIMIT : '&nbsp;').'</td></tr>';
545
546 print '</table>';
547 print '</div>';
548 print '<br>';
549
550
551 // Skin
552 showSkins($object, 0, true);
553
554
555 print '<div class="tabsAction">';
556 if (empty($user->admin) && !empty($dolibarr_main_demo)) {
557 print '<a class="butActionRefused classfortooltip" title="'.$langs->trans("FeatureDisabledInDemo").'" href="#">'.$langs->trans("Modify").'</a>';
558 } else {
559 if ($caneditfield || !empty($user->admin)) { // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
560 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
561 } else {
562 print '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Modify").'</a>';
563 }
564 }
565
566 print '</div>';
567}
568
569if ($action == 'edit') {
570 print '</form>';
571}
572
573// End of page
574llxFooter();
575$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to generate html code for admin pages.
Class to manage generation of HTML components Only common components must be here.
Class to manage Dolibarr users.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
dol_set_user_param($db, $conf, &$user, $tab)
Save personal parameter.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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_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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
conf($dolibarr_main_document_root)
Load conf file (file must exists)
Definition inc.php:420
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.
showSkins($fuser, $edit=0, $foruserprofile=false)
Show list of themes.