dolibarr 20.0.0
usergroups.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2010-2017 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
5 * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
6 * Copyright (C) 2021-2023 Anthony Berton <anthony.berton@bb2a.fr>
7 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 * or see https://www.gnu.org/
23 */
24
25
38{
39 global $langs, $conf, $user, $db;
40
41 $langs->load("users");
42
43 $canreadperms = true;
44 if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
45 $canreadperms = ($user->admin || ($user->id != $object->id && $user->hasRight('user', 'user_advance', 'readperms')) || ($user->id == $object->id && $user->hasRight('user', 'self_advance', 'readperms')));
46 }
47
48 $h = 0;
49 $head = array();
50
51 $head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id;
52 $head[$h][1] = $langs->trans("User");
53 $head[$h][2] = 'user';
54 $h++;
55
56 if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_SYNCHRO_ACTIVE'))
57 && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) {
58 $langs->load("ldap");
59 $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id;
60 $head[$h][1] = $langs->trans("LDAPCard");
61 $head[$h][2] = 'ldap';
62 $h++;
63 }
64
65 if ($canreadperms) {
66 $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
67 $head[$h][1] = $langs->trans("Rights").(!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>' : '');
68 $head[$h][2] = 'rights';
69 $h++;
70 }
71
72 $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
73 $head[$h][1] = $langs->trans("UserGUISetup");
74 $head[$h][2] = 'guisetup';
75 $h++;
76
77 if (isModEnabled('agenda')) {
78 if (!getDolGlobalString('AGENDA_EXT_NB')) {
79 $conf->global->AGENDA_EXT_NB = 5;
80 }
81 $MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB');
82
83 $i = 1;
84 $nbagenda = 0;
85 while ($i <= $MAXAGENDA) {
86 $key = $i;
87 $name = 'AGENDA_EXT_NAME_'.$object->id.'_'.$key;
88 $src = 'AGENDA_EXT_SRC_'.$object->id.'_'.$key;
89 $offsettz = 'AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
90 $color = 'AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
91 $i++;
92
93 if (!empty($object->conf->$name)) {
94 $nbagenda++;
95 }
96 }
97
98 $head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
99 $head[$h][1] = $langs->trans("ExtSites").($nbagenda ? '<span class="badge marginleftonlyshort">'.$nbagenda.'</span>' : '');
100 $head[$h][2] = 'extsites';
101 $h++;
102 }
103
104 if (isModEnabled('clicktodial')) {
105 $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
106 $head[$h][1] = $langs->trans("ClickToDial");
107 $head[$h][2] = 'clicktodial';
108 $h++;
109 }
110
111 // Notifications
112 if ($user->socid == 0 && isModEnabled('notification')) {
113 $nbNote = 0;
114 $sql = "SELECT COUNT(n.rowid) as nb";
115 $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n";
116 $sql .= " WHERE fk_user = ".((int) $object->id);
117 $resql = $db->query($sql);
118 if ($resql) {
119 $num = $db->num_rows($resql);
120 $i = 0;
121 while ($i < $num) {
122 $obj = $db->fetch_object($resql);
123 $nbNote = $obj->nb;
124 $i++;
125 }
126 } else {
127 dol_print_error($db);
128 }
129
130 $langs->load("mails");
131 $head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id;
132 $head[$h][1] = $langs->trans("NotificationsAuto");
133 if ($nbNote > 0) {
134 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
135 }
136 $head[$h][2] = 'notify';
137 $h++;
138 }
139
140 // Show more tabs from modules
141 // Entries must be declared in modules descriptor with line
142 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
143 // $this->tabs = array('entity:-tabname); to remove a tab
144 complete_head_from_modules($conf, $langs, $object, $head, $h, 'user');
145
146 if ((isModEnabled('salaries') && $user->hasRight('salaries', 'read'))
147 || (isModEnabled('hrm') && $user->hasRight('hrm', 'employee', 'read'))
148 || (isModEnabled('expensereport') && $user->hasRight('expensereport', 'lire') && ($user->id == $object->id || $user->hasRight('expensereport', 'readall')))
149 || (isModEnabled('holiday') && $user->hasRight('holiday', 'read') && ($user->id == $object->id || $user->hasRight('holiday', 'readall')))
150 ) {
151 // Bank
152 $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;
153 $head[$h][1] = $langs->trans("HRAndBank");
154 $head[$h][2] = 'bank';
155 $h++;
156 }
157
158 // Such info on users is visible only by internal user
159 if (empty($user->socid)) {
160 // Notes
161 $nbNote = 0;
162 if (!empty($object->note_public)) {
163 $nbNote++;
164 }
165 if (!empty($object->note_private)) {
166 $nbNote++;
167 }
168 $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
169 $head[$h][1] = $langs->trans("Note");
170 if ($nbNote > 0) {
171 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
172 }
173 $head[$h][2] = 'note';
174 $h++;
175
176 // Attached files
177 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
178 require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
179 $upload_dir = $conf->user->dir_output."/".$object->id;
180 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
181 $nbLinks = Link::count($db, $object->element, $object->id);
182 $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
183 $head[$h][1] = $langs->trans("Documents");
184 if (($nbFiles + $nbLinks) > 0) {
185 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
186 }
187 $head[$h][2] = 'document';
188 $h++;
189
190 $head[$h][0] = DOL_URL_ROOT.'/user/agenda.php?id='.$object->id;
191 $head[$h][1] = $langs->trans("Events");
192 if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
193 $nbEvent = 0;
194 // Enable caching of thirdparty count actioncomm
195 require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
196 $cachekey = 'count_events_user_'.$object->id;
197 $dataretrieved = dol_getcache($cachekey);
198 if (!is_null($dataretrieved)) {
199 $nbEvent = $dataretrieved;
200 } else {
201 $sql = "SELECT COUNT(ac.id) as nb";
202 $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as ac";
203 $sql .= " WHERE ac.fk_user_action = ".((int) $object->id);
204 $sql .= " AND ac.entity IN (".getEntity('agenda').")";
205 $resql = $db->query($sql);
206 if ($resql) {
207 $obj = $db->fetch_object($resql);
208 $nbEvent = $obj->nb;
209 } else {
210 dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
211 }
212 dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
213 }
214
215 $head[$h][1] .= '/';
216 $head[$h][1] .= $langs->trans("Agenda");
217 if ($nbEvent > 0) {
218 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
219 }
220 }
221 $head[$h][2] = 'info';
222 $h++;
223 }
224
225 complete_head_from_modules($conf, $langs, $object, $head, $h, 'user', 'remove');
226
227 return $head;
228}
229
237{
238 global $langs, $conf, $user;
239
240 $canreadperms = true;
241 if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
242 $canreadperms = ($user->admin || $user->hasRight('user', 'group_advance', 'readperms'));
243 }
244
245 $h = 0;
246 $head = array();
247
248 $head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id;
249 $head[$h][1] = $langs->trans("Card");
250 $head[$h][2] = 'group';
251 $h++;
252
253 if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_SYNCHRO_ACTIVE'))
254 && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) {
255 $langs->load("ldap");
256 $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id;
257 $head[$h][1] = $langs->trans("LDAPCard");
258 $head[$h][2] = 'ldap';
259 $h++;
260 }
261
262 if ($canreadperms) {
263 $head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id;
264 $head[$h][1] = $langs->trans("GroupRights").'<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>';
265 $head[$h][2] = 'rights';
266 $h++;
267 }
268
269 // Show more tabs from modules
270 // Entries must be declared in modules descriptor with line
271 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
272 // $this->tabs = array('entity:-tabname); to remove a tab
273 complete_head_from_modules($conf, $langs, $object, $head, $h, 'group');
274
275 complete_head_from_modules($conf, $langs, $object, $head, $h, 'group', 'remove');
276
277 return $head;
278}
279
286{
287 global $langs, $conf, $user, $db;
288
289 $extrafields = new ExtraFields($db);
290 $extrafields->fetch_name_optionals_label('user');
291 $extrafields->fetch_name_optionals_label('usergroup');
292
293 $langs->load("users");
294 $h = 0;
295 $head = array();
296
297 $head[$h][0] = DOL_URL_ROOT.'/admin/user.php';
298 $head[$h][1] = $langs->trans("Parameters");
299 $head[$h][2] = 'card';
300 $h++;
301
302 $head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php';
303 $head[$h][1] = $langs->trans("Group");
304 $head[$h][2] = 'usergroupcard';
305 $h++;
306
307 $head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
308 $head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Users").")";
309 $nbExtrafields = $extrafields->attributes['user']['count'];
310 if ($nbExtrafields > 0) {
311 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
312 }
313 $head[$h][2] = 'attributes';
314 $h++;
315
316 $head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
317 $head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Groups").")";
318 $nbExtrafields = $extrafields->attributes['usergroup']['count'];
319 if ($nbExtrafields > 0) {
320 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
321 }
322 $head[$h][2] = 'attributes_group';
323 $h++;
324
325 // Show more tabs from modules
326 // Entries must be declared in modules descriptor with line
327 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
328 // $this->tabs = array('entity:-tabname); to remove a tab
329 complete_head_from_modules($conf, $langs, null, $head, $h, 'useradmin');
330
331 complete_head_from_modules($conf, $langs, null, $head, $h, 'useradmin', 'remove');
332
333 return $head;
334}
335
344function showSkins($fuser, $edit = 0, $foruserprofile = false)
345{
346 global $conf, $langs, $db, $form;
347
348 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
349
350 $formother = new FormOther($db);
351
352 $dirthemes = array('/theme');
353 if (!empty($conf->modules_parts['theme'])) { // Using this feature slow down application
354 foreach ($conf->modules_parts['theme'] as $reldir) {
355 $dirthemes = array_merge($dirthemes, (array) ($reldir.'theme'));
356 }
357 }
358 $dirthemes = array_unique($dirthemes);
359 // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
360
361 $selected_theme = '';
362 if (empty($foruserprofile)) {
363 $selected_theme = getDolGlobalString('MAIN_THEME');
364 } else {
365 $selected_theme = ((is_object($fuser) && !empty($fuser->conf->MAIN_THEME)) ? $fuser->conf->MAIN_THEME : '');
366 }
367
368 $hoverdisabled = '';
369 if (empty($foruserprofile)) {
370 $hoverdisabled = (getDolGlobalString('THEME_ELDY_USE_HOVER') == '0');
371 } else {
372 $hoverdisabled = (is_object($fuser) ? (empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0') : '');
373 }
374
375 $checkeddisabled = '';
376 if (empty($foruserprofile)) {
377 $checkeddisabled = (getDolGlobalString('THEME_ELDY_USE_CHECKED') == '0');
378 } else {
379 $checkeddisabled = (is_object($fuser) ? (empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0') : '');
380 }
381
382 $colspan = 2;
383 if ($foruserprofile) {
384 $colspan = 4;
385 }
386
387 $thumbsbyrow = 6;
388 print '<div class="div-table-responsive-no-min">';
389 print '<table class="noborder centpercent'.($edit ? ' editmodeforshowskin' : '').'">';
390
391 // Title
392 if ($foruserprofile) {
393 print '<tr class="liste_titre"><th class="titlefieldmiddle">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>';
394 print '<th colspan="2">&nbsp;</th>';
395 print '</tr>';
396
397 print '<tr>';
398 print '<td>'.$langs->trans("DefaultSkin").'</td>';
399 print '<td>' . getDolGlobalString('MAIN_THEME').'</td>';
400 print '<td class="nowrap left"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit ? '' : ' disabled').' type="checkbox" '.($selected_theme ? " checked" : "").'> <label for="check_MAIN_THEME">'.$langs->trans("UsePersonalValue").'</label></td>';
401 print '<td>&nbsp;</td>';
402 print '</tr>';
403 } else {
404 $dirthemestring = '';
405 foreach ($dirthemes as $dirtheme) {
406 $dirthemestring .= '"'.$dirtheme.'" ';
407 }
408
409 print '<tr class="liste_titre"><th class="titlefieldmiddle">';
410 print $form->textwithpicto($langs->trans("DefaultSkin"), $langs->trans("ThemeDir").' : '.$dirthemestring);
411 print '</th>';
412 print '<th class="right">';
413 $url = 'https://www.dolistore.com/9-skins';
414 print '<a href="'.$url.'" target="_blank" rel="noopener noreferrer external">';
415 print $langs->trans('DownloadMoreSkins');
416 print img_picto('', 'globe', 'class="paddingleft"');
417 print '</a>';
418 print '</th></tr>';
419 }
420
421 print '<tr><td colspan="'.$colspan.'" class="center">';
422
423 if (getDolGlobalString('MAIN_FORCETHEME')) {
424 $langs->load("errors");
425 print $langs->trans("WarningThemeForcedTo", getDolGlobalString('MAIN_FORCETHEME'));
426 }
427
428 print '<table class="nobordernopadding centpercent"><tr><td><div class="center">';
429
430 $i = 0;
431 foreach ($dirthemes as $dir) {
432 //print $dirroot.$dir;exit;
433 $dirtheme = dol_buildpath($dir, 0); // This include loop on $conf->file->dol_document_root
434 $urltheme = dol_buildpath($dir, 1);
435
436 if (is_dir($dirtheme)) {
437 $handle = opendir($dirtheme);
438 if (is_resource($handle)) {
439 while (($subdir = readdir($handle)) !== false) {
440 if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) != '.'
441 && substr($subdir, 0, 3) != 'CVS' && !preg_match('/common|phones/i', $subdir)) {
442 // Disable not stable themes (dir ends with _exp or _dev)
443 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2 && preg_match('/_dev$/i', $subdir)) {
444 continue;
445 }
446 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1 && preg_match('/_exp$/i', $subdir)) {
447 continue;
448 }
449
450 print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
451 $file = $dirtheme."/".$subdir."/thumb.png";
452 $url = $urltheme."/".$subdir."/thumb.png";
453 if (!file_exists($file)) {
454 $url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
455 }
456 print '<a href="'.$_SERVER["PHP_SELF"].($edit ? '?action=edit&token='.newToken().'&mode=template&theme=' : '?theme=').$subdir.(GETPOST('optioncss', 'alpha', 1) ? '&optioncss='.GETPOST('optioncss', 'alpha', 1) : '').($fuser ? '&id='.$fuser->id : '').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
457 if ($subdir == $conf->global->MAIN_THEME) {
458 $title = $langs->trans("ThemeCurrentlyActive");
459 } else {
460 $title = $langs->trans("ShowPreview");
461 }
462 print '<img class="img-skinthumb shadow" src="'.$url.'" alt="'.dol_escape_htmltag($title).'" title="'.dol_escape_htmltag($title).'" style="border: none; margin-bottom: 5px;">';
463 print '</a><br>';
464 if ($subdir == $selected_theme) {
465 print '<input '.($edit ? '' : 'disabled').' type="radio" class="themethumbs" style="border: 0px;" id="main_theme'.$subdir.'" checked name="main_theme" value="'.$subdir.'"><label for="main_theme'.$subdir.'"> <b>'.$subdir.'</b></label>';
466 } else {
467 print '<input '.($edit ? '' : 'disabled').' type="radio" class="themethumbs" style="border: 0px;" id="main_theme'.$subdir.'" name="main_theme" value="'.$subdir.'"><label for="main_theme'.$subdir.'"> '.$subdir.'</label>';
468 }
469 print '</div>';
470
471 $i++;
472 }
473 }
474 }
475 }
476 }
477
478 print '</div></td></tr></table>';
479
480 print '</td></tr>';
481
482 // Set variables of theme
483 $colorbackhmenu1 = '';
484 $colorbackvmenu1 = '';
485 $colortexttitlenotab = '';
486 $colortexttitlelink = '';
487 $colorbacktitle1 = '';
488 $colortexttitle = '';
489 $colorbacklineimpair1 = '';
490 $colorbacklineimpair2 = '';
491 $colorbacklinepair1 = '';
492 $colorbacklinepair2 = '';
493 $colortextlink = '';
494 $colorbacklinepairhover = '';
495 $colorbacklinepairchecked = '';
496 $butactionbg = '';
497 $textbutaction = '';
498 // Set the variables with the default value
499 if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php')) {
500 include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
501 }
502
503 // Dark mode
504 if ($foruserprofile) {
505 //Nothing
506 } else {
507 $listofdarkmodes = array(
508 $langs->trans("AlwaysDisabled"),
509 $langs->trans("AccordingToBrowser"),
510 $langs->trans("AlwaysEnabled")
511 );
512 print '<tr class="oddeven">';
513 print '<td>'.$langs->trans("DarkThemeMode").'</td>';
514 print '<td colspan="'.($colspan - 1).'">';
515 if ($edit) {
516 print $form->selectarray('THEME_DARKMODEENABLED', $listofdarkmodes, getDolGlobalInt('THEME_DARKMODEENABLED'));
517 } else {
518 print $listofdarkmodes[getDolGlobalInt('THEME_DARKMODEENABLED')];
519 }
520 print $form->textwithpicto('', $langs->trans("DoesNotWorkWithAllThemes"));
521 print '</tr>';
522 }
523
524
525 // TopMenuDisableImages
526 if ($foruserprofile) {
527 /*
528 print '<tr class="oddeven">';
529 print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
530 print '<td>'.(getDolGlobalString('THEME_TOPMENU_DISABLE_IMAGE',$langs->trans("Default")).'</td>';
531 print '<td class="left" class="nowrap" width="20%"><input name="check_THEME_TOPMENU_DISABLE_IMAGE" id="check_THEME_TOPMENU_DISABLE_IMAGE" type="checkbox" '.(!empty($object->conf->THEME_ELDY_TEXTLINK)?" checked":"");
532 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
533 print '> '.$langs->trans("UsePersonalValue").'</td>';
534 print '<td>';
535 if ($edit)
536 {
537 print $formother->selectColor(colorArrayToHex(colorStringToArray(getDolGlobalString('THEME_TOPMENU_DISABLE_IMAGE'),array()),''),'THEME_TOPMENU_DISABLE_IMAGE','',1).' ';
538 }
539 else
540 {
541 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),'');
542 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
543 else print '';
544 }
545 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
546 print '</td>';*/
547 } else {
548 $listoftopmenumodes = array(
549 $langs->transnoentitiesnoconv("IconAndText"),
550 $langs->transnoentitiesnoconv("TextOnly"),
551 $langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover"),
552 $langs->transnoentitiesnoconv("IconOnlyTextOnHover"),
553 $langs->transnoentitiesnoconv("IconOnly"),
554 );
555 print '<tr class="oddeven">';
556 print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
557 print '<td colspan="'.($colspan - 1).'">';
558 if ($edit) {
559 //print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1);
560 print $form->selectarray('THEME_TOPMENU_DISABLE_IMAGE', $listoftopmenumodes, isset($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? $conf->global->THEME_TOPMENU_DISABLE_IMAGE : 0, 0, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth500');
561 } else {
562 print $listoftopmenumodes[getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE')];
563 //print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);
564 }
565 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"));
566 print '</td>';
567 print '</tr>';
568 }
569
570 // Show logo
571 if ($foruserprofile) {
572 // Nothing
573 } else {
574 // Show logo
575 print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("EnableShowLogo").'</td>';
576 print '<td colspan="'.($colspan - 1).'" class="valignmiddle">';
577 if ($edit) {
578 print ajax_constantonoff('MAIN_SHOW_LOGO', array(), null, 0, 0, 1);
579 //print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1);
580 } else {
581 print yn(getDolGlobalString('MAIN_SHOW_LOGO'));
582 }
583 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"), 1, 'help', 'inline-block');
584 print '</td>';
585 print '</tr>';
586 }
587
588 // Main menu color on pictos
589 if ($foruserprofile) {
590 // Nothing
591 } else {
592 // Show logo
593 print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("THEME_MENU_COLORLOGO").'</td>';
594 print '<td colspan="'.($colspan - 1).'" class="valignmiddle">';
595 if ($edit) {
596 print ajax_constantonoff('THEME_MENU_COLORLOGO', array(), null, 0, 0, 1);
597 } else {
598 print yn(getDolGlobalString('THEME_MENU_COLORLOGO'));
599 }
600 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"), 1, 'help', 'inline-block');
601 print '</td>';
602 print '</tr>';
603 }
604
605 // Use border on tables
606 if ($foruserprofile) {
607 } else {
608 print '<tr class="oddeven">';
609 print '<td>'.$langs->trans("UseBorderOnTable").'</td>';
610 print '<td colspan="'.($colspan - 1).'" class="valignmiddle">';
611 if ($edit) {
612 print ajax_constantonoff('THEME_ELDY_USEBORDERONTABLE', array(), null, 0, 0, 1);
613 //print $form->selectyesno('THEME_ELDY_USEBORDERONTABLE', $conf->global->THEME_ELDY_USEBORDERONTABLE, 1);
614 } else {
615 print yn(getDolGlobalString('THEME_ELDY_USEBORDERONTABLE'));
616 }
617 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"), 1, 'help', 'inline-block');
618 print '</td>';
619 print '</tr>';
620 }
621
622 // Table line height
623 /* removed. height of column must use padding of td and not lineheight that has bad side effect
624 if ($foruserprofile) {
625 } else {
626 $listoftopmenumodes = array(
627 '0' => $langs->transnoentitiesnoconv("Normal"),
628 '1' => $langs->transnoentitiesnoconv("LargeModern"),
629 );
630 print '<tr class="oddeven">';
631 print '<td>'.$langs->trans("TableLineHeight").'</td>';
632 print '<td colspan="'.($colspan - 1).'" class="valignmiddle">';
633 if ($edit) {
634 //print ajax_constantonoff('THEME_ELDY_USECOMOACTROW', array(), null, 0, 0, 1);
635 print $form->selectarray('THEME_ELDY_USECOMOACTROW', $listoftopmenumodes, getDolGlobalString('THEME_ELDY_USECOMOACTROW'), 0, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300');
636 } else {
637 print $listoftopmenumodes[getDolGlobalString('THEME_ELDY_USECOMOACTROW')];
638 }
639 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"), 1, 'help', 'inline-block');
640 print '</td>';
641 print '</tr>';
642 }
643 */
644
645 // Background color for top menu - TopMenuBackgroundColor
646 if ($foruserprofile) {
647 /*
648 print '<tr class="oddeven">';
649 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
650 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
651 print '<td class="nowrap left" width="20%"><input name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(!empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
652 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
653 print '> '.$langs->trans("UsePersonalValue").'</td>';
654 print '<td>';
655 if ($edit)
656 {
657 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' ';
658 }
659 else
660 {
661 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
662 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
663 else print '';
664 }
665 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
666 print '</td>';*/
667 } else {
668 $default = (empty($colorbackhmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackhmenu1)));
669
670 print '<tr class="oddeven">';
671 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
672 print '<td colspan="'.($colspan - 1).'">';
673 if ($edit) {
674 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TOPMENU_BACK1') ? $conf->global->THEME_ELDY_TOPMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1', $default).' ';
675 } else {
676 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), '');
677 if ($color) {
678 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
679 } else {
680 print $langs->trans("Default");
681 }
682 }
683 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
684 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
685 print '</td>';
686 print '</tr>';
687 }
688
689 // Background color for left menu - LeftMenuBackgroundColor
690 if ($foruserprofile) {
691 /*
692 print '<tr class="oddeven">';
693 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
694 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_VERMENU_BACK1:$langs->trans("Default")).'</td>';
695 print '<td class="nowrap left" width="20%"><input name="check_THEME_ELDY_VERMENU_BACK1" id="check_THEME_ELDY_VERMENU_BACK1" type="checkbox" '.(!empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
696 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
697 print '> '.$langs->trans("UsePersonalValue").'</td>';
698 print '<td>';
699 if ($edit)
700 {
701 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','',1).' ';
702 }
703 else
704 {
705 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),'');
706 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
707 else print '';
708 }
709 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
710 print '</td>';*/
711 } else {
712 $default = (empty($colorbackvmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackvmenu1)));
713
714 print '<tr class="oddeven">';
715 print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
716 print '<td colspan="'.($colspan - 1).'">';
717 if ($edit) {
718 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_VERMENU_BACK1') ? $conf->global->THEME_ELDY_VERMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1', $default).' ';
719 } else {
720 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), '');
721 if ($color) {
722 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
723 } else {
724 print $langs->trans("Default");
725 }
726 }
727 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
728 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
729 print '</td>';
730 print '</tr>';
731 }
732
733 // Background color for main area THEME_ELDY_BACKBODY
734 if ($foruserprofile) {
735 /*
736 print '<tr class="oddeven">';
737 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
738 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
739 print '<td class="nowrap left" width="20%"><input name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(!empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
740 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
741 print '> '.$langs->trans("UsePersonalValue").'</td>';
742 print '<td>';
743 if ($edit) {
744 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' ';
745 } else {
746 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
747 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
748 else print '';
749 }
750 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
751 print '</td>';*/
752 } else {
753 $default = 'ffffff';
754 print '<tr class="oddeven">';
755 print '<td>'.$langs->trans("BackgroundColor").'</td>';
756 print '<td colspan="'.($colspan - 1).'">';
757 //var_dump($conf->global->THEME_ELDY_BACKBODY);
758 if ($edit) {
759 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_BACKBODY') ? $conf->global->THEME_ELDY_BACKBODY : ''), array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody', $default).' ';
760 } else {
761 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), '');
762 if ($color) {
763 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
764 } else {
765 print $langs->trans("Default");
766 }
767 }
768 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
769 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
770 print '</td>';
771 print '</tr>';
772 }
773
774 // TextTitleColor for title of Pages
775 if ($foruserprofile) {
776 } else {
777 $default = (empty($colortexttitlenotab) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlenotab)));
778
779 print '<tr class="oddeven">';
780 print '<td>'.$langs->trans("TextTitleColor").'</td>';
781 print '<td colspan="'.($colspan - 1).'">';
782 if ($edit) {
783 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TEXTTITLENOTAB') ? $conf->global->THEME_ELDY_TEXTTITLENOTAB : ''), array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab', $default).' ';
784 } else {
785 print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
786 }
787 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
788 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
789 print '</td>';
790
791 print '</tr>';
792 }
793
794 // BackgroundTableTitleColor
795 if ($foruserprofile) {
796 } else {
797 $default = (empty($colorbacktitle1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacktitle1)));
798
799 print '<tr class="oddeven">';
800 print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
801 print '<td colspan="'.($colspan - 1).'">';
802 if ($edit) {
803 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_BACKTITLE1') ? $conf->global->THEME_ELDY_BACKTITLE1 : ''), array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1', $default).' ';
804 } else {
805 print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
806 }
807 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> '; // $colorbacktitle1 in CSS
808 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
809 print '</td>';
810
811 print '</tr>';
812 }
813
814 // TextTitleColor
815 if ($foruserprofile) {
816 } else {
817 $default = (empty($colortexttitle) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitle)));
818
819 print '<tr class="oddeven">';
820 print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
821 print '<td colspan="'.($colspan - 1).'">';
822 if ($edit) {
823 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TEXTTITLE') ? $conf->global->THEME_ELDY_TEXTTITLE : ''), array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle', $default).' ';
824 } else {
825 print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
826 }
827 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
828 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
829 print '</td>';
830
831 print '</tr>';
832 }
833
834 // TextTitleLinkColor
835 if ($foruserprofile) {
836 } else {
837 $default = (empty($colortexttitlelink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlelink)));
838
839 print '<tr class="oddeven">';
840 print '<td>'.$langs->trans("BackgroundTableTitleTextlinkColor").'</td>';
841 print '<td colspan="'.($colspan - 1).'">';
842 if ($edit) {
843 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TEXTTITLELINK') ? $conf->global->THEME_ELDY_TEXTTITLELINK : ''), array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink', $default).' ';
844 } else {
845 print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default"));
846 }
847 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
848 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
849 print '</span>';
850 print '</td>';
851
852 print '</tr>';
853 }
854
855 // BackgroundTableLineOddColor
856 if ($foruserprofile) {
857 } else {
858 $default = (empty($colorbacklineimpair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklineimpair1)));
859
860 print '<tr class="oddeven">';
861 print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
862 print '<td colspan="'.($colspan - 1).'">';
863 if ($edit) {
864 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_LINEIMPAIR1') ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklineimpair2', $default).' ';
865 } else {
866 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), '');
867 if ($color) {
868 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
869 } else {
870 print $langs->trans("Default");
871 }
872 }
873 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
874 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
875 print '</td>';
876 print '</tr>';
877 }
878
879 // BackgroundTableLineEvenColor
880 if ($foruserprofile) {
881 } else {
882 $default = (empty($colorbacklinepair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepair1)));
883
884 print '<tr class="oddeven">';
885 print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
886 print '<td colspan="'.($colspan - 1).'">';
887 if ($edit) {
888 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_LINEPAIR1') ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklinepair2', $default).' ';
889 } else {
890 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), '');
891 if ($color) {
892 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
893 } else {
894 print $langs->trans("Default");
895 }
896 }
897 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
898 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
899 print '</td>';
900 print '</tr>';
901 }
902
903 // Text LinkColor
904 if ($foruserprofile) {
905 /*
906 print '<tr class="oddeven">';
907 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
908 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTLINK:$langs->trans("Default")).'</td>';
909 print '<td class="nowrap left" width="20%"><input name="check_THEME_ELDY_TEXTLINK" id="check_THEME_ELDY_TEXTLINK" type="checkbox" '.(!empty($object->conf->THEME_ELDY_TEXTLINK)?" checked":"");
910 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
911 print '> '.$langs->trans("UsePersonalValue").'</td>';
912 print '<td>';
913 if ($edit)
914 {
915 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','',1).' ';
916 }
917 else
918 {
919 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
920 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
921 else print '';
922 }
923 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
924 print '</td>';*/
925 } else {
926 $default = (empty($colortextlink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortextlink)));
927
928 print '<tr class="oddeven">';
929 print '<td>'.$langs->trans("LinkColor").'</td>';
930 print '<td colspan="'.($colspan - 1).'">';
931 if ($edit) {
932 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TEXTLINK') ? $conf->global->THEME_ELDY_TEXTLINK : ''), array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink', $default).' ';
933 } else {
934 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), '');
935 if ($color) {
936 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
937 } else {
938 //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
939 //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
940 print $langs->trans("Default");
941 }
942 }
943 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
944 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
945 print '</td>';
946 print '</tr>';
947 }
948
949 // Use Hover
950 if ($foruserprofile) {
951 /* Must first change option to choose color of highlight instead of yes or no.
952 print '<tr class="oddeven">';
953 print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
954 print '<td><input name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
955 print '<td class="nowrap left" width="20%"><input name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
956 print '<td><input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
957 print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
958 print '</td>';
959 print '</tr>';
960 */
961 } else {
962 $default = (empty($colorbacklinepairhover) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairhover)));
963
964 print '<tr class="oddeven">';
965 print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
966 print '<td colspan="'.($colspan - 1).'">';
967 //print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
968 //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
969 if ($edit) {
970 if (getDolGlobalString('THEME_ELDY_USE_HOVER') == '1') {
971 $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
972 } else {
973 $color = colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_USE_HOVER') ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
974 }
975 print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover', $default).' ';
976 } else {
977 if (getDolGlobalString('THEME_ELDY_USE_HOVER') == '1') {
978 $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
979 } else {
980 $color = colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_USE_HOVER') ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
981 }
982 if ($color) {
983 if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) {
984 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
985 } else {
986 print $langs->trans("Default");
987 }
988 } else {
989 print $langs->trans("Default");
990 }
991 }
992 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
993 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
994 print '</td>';
995 }
996
997 // Use Checked
998 if ($foruserprofile) {
999 /* Must first change option to choose color of highlight instead of yes or no.
1000 print '<tr class="oddeven">';
1001 print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
1002 print '<td><input name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
1003 print '<td class="nowrap left" width="20%"><input name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
1004 print '<td><input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
1005 print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
1006 print '</td>';
1007 print '</tr>';
1008 */
1009 } else {
1010 $default = (empty($colorbacklinepairchecked) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairchecked)));
1011
1012 print '<tr class="oddeven">';
1013 print '<td>'.$langs->trans("HighlightLinesChecked").'</td>';
1014 print '<td colspan="'.($colspan - 1).'">';
1015 //print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
1016 //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
1017 if ($edit) {
1018 if (getDolGlobalString('THEME_ELDY_USE_CHECKED') == '1') {
1019 $color = 'e6edf0';
1020 } else {
1021 $color = colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_USE_CHECKED') ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
1022 }
1023 print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked', $default).' ';
1024 } else {
1025 if (getDolGlobalString('THEME_ELDY_USE_CHECKED') == '1') {
1026 $color = 'e6edf0';
1027 } else {
1028 $color = colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_USE_CHECKED') ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
1029 }
1030 if ($color) {
1031 if ($color != 'e6edf0') {
1032 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1033 } else {
1034 print $langs->trans("Default");
1035 }
1036 } else {
1037 print $langs->trans("Default");
1038 }
1039 }
1040 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1041 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
1042 print '</td>';
1043 print '</tr>';
1044 }
1045
1046 // Btn action
1047 if ($foruserprofile) {
1048 /*
1049 print '<tr class="oddeven">';
1050 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
1051 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_BTNACTION:$langs->trans("Default")).'</td>';
1052 print '<td class="nowrap left" width="20%"><input name="check_THEME_ELDY_BTNACTION" id="check_THEME_ELDY_BTNACTION" type="checkbox" '.(!empty($object->conf->THEME_ELDY_BTNACTION)?" checked":"");
1053 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
1054 print '> '.$langs->trans("UsePersonalValue").'</td>';
1055 print '<td>';
1056 if ($edit)
1057 {
1058 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION,array()),''),'THEME_ELDY_BTNACTION','',1).' ';
1059 }
1060 else
1061 {
1062 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION,array()),'');
1063 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1064 else print '';
1065 }
1066 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
1067 print '</td>';*/
1068 } else {
1069 $default = (empty($butactionbg) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($butactionbg)));
1070
1071 print '<tr class="oddeven">';
1072 print '<td>'.$langs->trans("BtnActionColor").'</td>';
1073 print '<td colspan="'.($colspan - 1).'">';
1074 if ($edit) {
1075 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_BTNACTION') ? $conf->global->THEME_ELDY_BTNACTION : ''), array()), ''), 'THEME_ELDY_BTNACTION', '', 1, '', '', 'butactionbg', $default).' ';
1076 } else {
1077 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION, array()), '');
1078 if ($color) {
1079 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1080 } else {
1081 //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
1082 //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
1083 print $langs->trans("Default");
1084 }
1085 }
1086 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
1087 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
1088 print '</td>';
1089 print '</tr>';
1090 }
1091
1092 // Text btn action
1093 if ($foruserprofile) {
1094 /*
1095 print '<tr class="oddeven">';
1096 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
1097 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTBTNACTION:$langs->trans("Default")).'</td>';
1098 print '<td class="nowrap left" width="20%"><input name="check_THEME_ELDY_TEXTBTNACTION" id="check_THEME_ELDY_TEXTBTNACTION" type="checkbox" '.(!empty($object->conf->THEME_ELDY_TEXTBTNACTION)?" checked":"");
1099 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
1100 print '> '.$langs->trans("UsePersonalValue").'</td>';
1101 print '<td>';
1102 if ($edit)
1103 {
1104 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTBTNACTION,array()),''),'THEME_ELDY_TEXTBTNACTION','',1).' ';
1105 }
1106 else
1107 {
1108 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION,array()),'');
1109 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1110 else print '';
1111 }
1112 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
1113 print '</td>';*/
1114 } else {
1115 $default = (empty($textbutaction) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($textbutaction)));
1116
1117 print '<tr class="oddeven">';
1118 print '<td>'.$langs->trans("TextBtnActionColor").'</td>';
1119 print '<td colspan="'.($colspan - 1).'">';
1120 if ($edit) {
1121 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TEXTBTNACTION') ? $conf->global->THEME_ELDY_TEXTBTNACTION : ''), array()), ''), 'THEME_ELDY_TEXTBTNACTION', '', 1, '', '', 'textbutaction', $default).' ';
1122 } else {
1123 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTBTNACTION, array()), '');
1124 if ($color) {
1125 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1126 } else {
1127 //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
1128 //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
1129 print $langs->trans("Default");
1130 }
1131 }
1132 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #000">'.$default.'</span></strong> ';
1133 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
1134 print '</td>';
1135 print '</tr>';
1136 }
1137
1138 // Use MAIN_OPTIMIZEFORTEXTBROWSER
1139 if ($foruserprofile) {
1140 //$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
1141 $default = $langs->trans('No');
1142 print '<tr class="oddeven">';
1143 print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
1144 print '<td colspan="'.($colspan - 1).'">';
1145 //print ajax_constantonoff("MAIN_OPTIMIZEFORTEXTBROWSER", array(), null, 0, 0, 1, 0);
1146 if ($edit) {
1147 print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', (isset($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER) ? $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER : 0), 1);
1148 } else {
1149 if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
1150 print yn(isset($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER) ? $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER : 0);
1151 } else {
1152 print yn(1);
1153 if (empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1154 print ' ('.$langs->trans("ForcedByGlobalSetup").')';
1155 }
1156 }
1157 }
1158 print ' &nbsp; <span class="opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1159 print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc"));
1160 print '</td>';
1161 print '</tr>';
1162 } else {
1163 //var_dump($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
1164 /*
1165 $default=$langs->trans('No');
1166 print '<tr class="oddeven">';
1167 print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
1168 print '<td colspan="'.($colspan-1).'">';
1169 if ($edit) {
1170 print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER, 1);
1171 } else {
1172 print yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
1173 }
1174 print ' &nbsp; wspan class="opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1175 print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc"));
1176 print '</span>';
1177 print '</td>';
1178 print '</tr>';
1179 */
1180 }
1181
1182
1183 // Use MAIN_OPTIMIZEFORCOLORBLIND
1184 if ($foruserprofile) {
1185 //$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
1186 $default = $langs->trans('No');
1187 print '<tr class="oddeven">';
1188 print '<td>'.$langs->trans("MAIN_OPTIMIZEFORCOLORBLIND").'</td>';
1189 print '<td colspan="'.($colspan - 1).'">';
1190
1191 $colorBlindOptions = array(
1192 0 => $langs->trans('No'),
1193 'flashy' => $langs->trans('Flashy'),
1194 'protanopia' => $langs->trans('Protanopia'),
1195 'deuteranopes' => $langs->trans('Deuteranopes'),
1196 'tritanopes' => $langs->trans('Tritanopes'),
1197 );
1198
1199 if ($edit) {
1200 print $form->selectArray('MAIN_OPTIMIZEFORCOLORBLIND', $colorBlindOptions, (isset($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) ? $fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND : 0), 0);
1201 } else {
1202 if (!empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) && isset($colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND])) {
1203 print $colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND];
1204 } else {
1205 print yn(0);
1206 }
1207 }
1208 print ' &nbsp; <span class="opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1209 print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORCOLORBLINDDesc"));
1210 print '</td>';
1211 print '</tr>';
1212 } else {
1213 }
1214 print '</table>';
1215 print '</div>';
1216}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
Class to manage standard extra fields.
Class permettant la generation de composants html autre Only common components are here.
Class to manage Dolibarr users.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:63
colorArrayToHex($arraycolor, $colorifnotfound='888888')
Convert an array with RGB value into hex RGB value.
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
dol_setcache($memoryid, $data, $expire=0)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid)
Read a memory area shared by all users, all sessions on server.
user_prepare_head(User $object)
Prepare array with list of tabs.
user_admin_prepare_head()
Prepare array with list of tabs.
showSkins($fuser, $edit=0, $foruserprofile=false)
Show list of themes.
group_prepare_head($object)
Prepare array with list of tabs.