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