dolibarr 21.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 Frédéric France <frederic.france@free.fr>
7 * Copyright (C) 2024 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
58if ($id) {
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 print dol_get_fiche_end();
331
332
333 if (!empty($conf->use_javascript_ajax)) {
334 print '<script type="text/javascript">
335 jQuery(document).ready(function() {
336 function init_myfunc()
337 {
338 if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); }
339 else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); }
340
341 if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
342 else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
343
344 if (jQuery("#check_MAIN_CHECKBOX_LEFT_COLUMN").prop("checked")) { jQuery("#MAIN_CHECKBOX_LEFT_COLUMN").removeAttr(\'disabled\');}
345 else { jQuery("#MAIN_CHECKBOX_LEFT_COLUMN").attr(\'disabled\',\'disabled\');}
346
347 if (jQuery("#check_MAIN_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#MAIN_SIZE_LISTE_LIMIT").removeAttr(\'disabled\'); }
348 else { jQuery("#MAIN_SIZE_LISTE_LIMIT").attr(\'disabled\',\'disabled\'); }
349
350 if (jQuery("#check_MAIN_SIZE_SHORTLIST_LIMIT").prop("checked")) { jQuery("#MAIN_SIZE_SHORTLIST_LIMIT").removeAttr(\'disabled\'); }
351 else { jQuery("#MAIN_SIZE_SHORTLIST_LIMIT").attr(\'disabled\',\'disabled\'); }
352
353 if (jQuery("#check_AGENDA_DEFAULT_VIEW").prop("checked")) { jQuery("#AGENDA_DEFAULT_VIEW").removeAttr(\'disabled\'); }
354 else { jQuery("#AGENDA_DEFAULT_VIEW").attr(\'disabled\',\'disabled\'); }
355
356 if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
357 else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
358
359 if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
360 else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
361 }
362 init_myfunc();
363 jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); });
364 jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); });
365 jQuery("#check_MAIN_CHECKBOX_LEFT_COLUMN").click(function() { init_myfunc(); });
366 jQuery("#check_MAIN_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); });
367 jQuery("#check_MAIN_SIZE_SHORTLIST_LIMIT").click(function() { init_myfunc(); });
368 jQuery("#check_AGENDA_DEFAULT_VIEW").click(function() { init_myfunc(); });
369 jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); });
370 jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); });
371 jQuery("#check_THEME_ELDY_BACKTITLE1").click(function() { init_myfunc(); });
372 });
373 </script>';
374 }
375
376
377 clearstatcache();
378
379 print '<table class="noborder centpercent">';
380 print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("DefaultValue").'</td><td>&nbsp;</td><td>'.$langs->trans("PersonalValue").'</td></tr>';
381
382 // Language by default
383 print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("Language").'</td>';
384 print '<td>';
385 $s = picto_from_langcode(getDolGlobalString('MAIN_LANG_DEFAULT'));
386 print $s ? $s.' ' : '';
387 print(getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $form->textwithpicto($langs->trans("Automatic"), $langs->trans("AutoDetectLang")) : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT')));
388 print '</td>';
389 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" : "");
390 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
391 print '> <label for="check_MAIN_LANG_DEFAULT">'.$langs->trans("UsePersonalValue").'</label></td>';
392 print '<td>';
393 print $formadmin->select_language((!empty($object->conf->MAIN_LANG_DEFAULT) ? $object->conf->MAIN_LANG_DEFAULT : ''), 'main_lang_default', 1, array(), 0, 0, (!empty($dolibarr_main_demo)));
394 print '</td></tr>';
395
396 // Landing page
397 print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
398 print '<td>';
399 print(!getDolGlobalString('MAIN_LANDING_PAGE') ? '' : $conf->global->MAIN_LANDING_PAGE);
400 print '</td>';
401 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" : "");
402 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
403 print '> <label for="check_MAIN_LANDING_PAGE">'.$langs->trans("UsePersonalValue").'</label></td>';
404 print '<td>';
405 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');
406 //print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0);
407 print '</td></tr>';
408
409 // Landing page for Agenda - AGENDA_DEFAULT_VIEW
410 print '<tr class="oddeven">'."\n";
411 print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
412 print '<td class="center">&nbsp;</td>'."\n";
413 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" : "");
414 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
415 print '> <label for="check_AGENDA_DEFAULT_VIEW">'.$langs->trans("UsePersonalValue").'</label></td>';
416 print '<td>'."\n";
417 $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"));
418 print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, (isset($object->conf->AGENDA_DEFAULT_VIEW) ? $object->conf->AGENDA_DEFAULT_VIEW : ''), 0, 0, 0, '');
419 print '</td></tr>'."\n";
420
421 // Checkbox left menu
422 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_CHECKBOX_LEFT_COLUMN").'</td>';
423 print '<td>'.(getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN') ? $langs->trans("Yes") : $langs->trans("No")).'</td>';
424 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" : "");
425 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
426 print '> <label for="check_MAIN_CHECKBOX_LEFT_COLUMN">'.$langs->trans("UsePersonalValue").'</label></td>';
427 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>';
428
429 // Max size of lists
430 print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
431 $mainsizelistelimit = getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT');
432 print '<td>'.($mainsizelistelimit > 0 ? getDolGlobalString('MAIN_SIZE_LISTE_LIMIT') : '<span class="">'.$langs->trans("Automatic").'</span>').'</td>';
433 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" : "");
434 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
435 print '> <label for="check_MAIN_SIZE_LISTE_LIMIT">'.$langs->trans("UsePersonalValue").'</label></td>';
436 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>';
437
438 // Max size of short lists
439 print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeShortList").'</td>';
440 print '<td>' . getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT').'</td>';
441 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" : "");
442 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
443 print '> <label for="check_MAIN_SIZE_SHORTLIST_LIMIT">'.$langs->trans("UsePersonalValue").'</label></td>';
444 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>';
445
446 print '</table><br>';
447
448 // Theme
449 showSkins($object, (($user->admin || empty($dolibarr_main_demo)) ? 1 : 0), true);
450
451
452 print $form->buttonsSaveCancel();
453} else {
454 print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user');
455
456 $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
457
458 $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">';
459 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
460 $morehtmlref .= '</a>';
461
462 $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
463 $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->transnoentitiesnoconv("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
464
465 dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
466
467 print '<div class="fichecenter">';
468
469 print '<div class="underbanner clearboth"></div>';
470 print '<table class="border centpercent tableforfield">';
471
472 // Login
473 print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
474 if (!empty($object->ldap_sid) && $object->statut == 0) {
475 print '<td class="error">';
476 print $langs->trans("LoginAccountDisableInDolibarr");
477 print '</td>';
478 } else {
479 print '<td>';
480 $addadmin = '';
481 if (property_exists($object, 'admin')) {
482 if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
483 $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
484 } elseif (!empty($object->admin)) {
485 $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
486 }
487 }
488 print showValueWithClipboardCPButton($object->login).$addadmin;
489 print '</td>';
490 }
491 print '</tr>'."\n";
492
493 print '</table>';
494
495 print '</div>';
496
497 print dol_get_fiche_end();
498
499
500 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
501 print '<table class="noborder centpercent">';
502 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>';
503
504 // Language
505 print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td>';
506 print '<td>';
507 $s = picto_from_langcode(getDolGlobalString('MAIN_LANG_DEFAULT'));
508 print($s ? $s.' ' : '');
509 print(getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $form->textwithpicto($langs->trans("Automatic"), $langs->trans("AutoDetectLang")) : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT')));
510 print '</td>';
511 print '<td class="nowrap"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_LANG_DEFAULT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
512 print '<td>';
513 $s = (isset($object->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) : '');
514 print($s ? $s.' ' : '');
515 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) : ''));
516 print '</td></tr>';
517
518 // Landing page
519 print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
520 print '<td>';
521 print(!getDolGlobalString('MAIN_LANDING_PAGE') ? '' : $conf->global->MAIN_LANDING_PAGE);
522 print '</td>';
523 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" : "");
524 print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
525 print '> '.$langs->trans("UsePersonalValue").'</td>';
526 print '<td class="tdoverflowmax300">';
527 if (!empty($object->conf->MAIN_LANDING_PAGE)) {
528 $urltoshow = '';
529 if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
530 if (is_array($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
531 $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]['label']);
532 } else {
533 $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
534 }
535 } else {
536 $urltoshow = $object->conf->MAIN_LANDING_PAGE;
537 }
538 print '<a href="'.DOL_URL_ROOT.'/'.$object->conf->MAIN_LANDING_PAGE.'" target="_blank" rel="noopener">';
539 $s = '';
540 if (isset($tmparray[$object->conf->MAIN_LANDING_PAGE]['picto']) && !empty($tmparray[$object->conf->MAIN_LANDING_PAGE]['picto'])) {
541 $s = img_picto($urltoshow, $tmparray[$object->conf->MAIN_LANDING_PAGE]['picto'], 'class="pictofixedwidth"');
542 }
543 if (empty($s)) {
544 print img_picto($urltoshow, 'globe', 'class="pictofixedwidth"');
545 } else {
546 print $s;
547 }
548 print $urltoshow;
549 print '</a>';
550 }
551 print '</td></tr>';
552
553 // Landing page for Agenda - AGENDA_DEFAULT_VIEW
554 print '<tr class="oddeven">'."\n";
555 print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
556 print '<td class="center">&nbsp;</td>'."\n";
557 print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
558 print '<td>'."\n";
559 $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"));
560 if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) {
561 print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1);
562 }
563 print '</td></tr>'."\n";
564
565 // Checkbox left menu
566 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_CHECKBOX_LEFT_COLUMN").'</td>';
567 print '<td>'.(getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN') ? $langs->trans("Yes") : $langs->trans("No")).'</td>';
568 print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(isset($object->conf->MAIN_CHECKBOX_LEFT_COLUMN) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
569 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>';
570
571 // Max size for lists
572 print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
573 $mainsizelistelimit = getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT');
574 print '<td>'.($mainsizelistelimit > 0 ? getDolGlobalString('MAIN_SIZE_LISTE_LIMIT') : '<span class="">'.$langs->trans("Automatic").'</span>').'</td>';
575 print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
576 print '<td>'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT : '&nbsp;').'</td></tr>';
577
578 // Max size for short lists
579 print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeShortList").'</td>';
580 print '<td>'.getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT', '&nbsp;').'</td>';
581 print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_SIZE_SHORTLIST_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
582 print '<td>'.(!empty($object->conf->MAIN_SIZE_SHORTLIST_LIMIT) ? $object->conf->MAIN_SIZE_SHORTLIST_LIMIT : '&nbsp;').'</td></tr>';
583
584 print '</table>';
585 print '</div>';
586 print '<br>';
587
588
589 // Skin
590 showSkins($object, 0, true);
591
592
593 print '<div class="tabsAction">';
594 if (empty($user->admin) && !empty($dolibarr_main_demo)) {
595 print '<a class="butActionRefused classfortooltip" title="'.$langs->trans("FeatureDisabledInDemo").'" href="#">'.$langs->trans("Modify").'</a>';
596 } else {
597 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
598 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
599 } else {
600 print '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Modify").'</a>';
601 }
602 }
603
604 print '</div>';
605}
606
607if ($action == 'edit') {
608 print '</form>';
609}
610
611// End of page
612llxFooter();
613$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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:71
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.
llxFooter()
Footer empty.
Definition document.php:107
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.
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)
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.
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)
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:420
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.