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