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