dolibarr 19.0.3
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 *
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 * or see https://www.gnu.org/
21 */
22
23
35function user_prepare_head(User $object)
36{
37 global $langs, $conf, $user, $db;
38
39 $langs->load("users");
40
41 $canreadperms = true;
42 if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
43 $canreadperms = ($user->admin || ($user->id != $object->id && $user->hasRight('user', 'user_advance', 'readperms')) || ($user->id == $object->id && $user->hasRight('user', 'self_advance', 'readperms')));
44 }
45
46 $h = 0;
47 $head = array();
48
49 $head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id;
50 $head[$h][1] = $langs->trans("User");
51 $head[$h][2] = 'user';
52 $h++;
53
54 if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_SYNCHRO_ACTIVE'))
55 && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) {
56 $langs->load("ldap");
57 $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id;
58 $head[$h][1] = $langs->trans("LDAPCard");
59 $head[$h][2] = 'ldap';
60 $h++;
61 }
62
63 if ($canreadperms) {
64 $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
65 $head[$h][1] = $langs->trans("Rights").(!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>' : '');
66 $head[$h][2] = 'rights';
67 $h++;
68 }
69
70 $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
71 $head[$h][1] = $langs->trans("UserGUISetup");
72 $head[$h][2] = 'guisetup';
73 $h++;
74
75 if (isModEnabled('agenda')) {
76 if (!getDolGlobalString('AGENDA_EXT_NB')) {
77 $conf->global->AGENDA_EXT_NB = 5;
78 }
79 $MAXAGENDA = $conf->global->AGENDA_EXT_NB;
80
81 $i = 1;
82 $nbagenda = 0;
83 while ($i <= $MAXAGENDA) {
84 $key = $i;
85 $name = 'AGENDA_EXT_NAME_'.$object->id.'_'.$key;
86 $src = 'AGENDA_EXT_SRC_'.$object->id.'_'.$key;
87 $offsettz = 'AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
88 $color = 'AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
89 $i++;
90
91 if (!empty($object->conf->$name)) {
92 $nbagenda++;
93 }
94 }
95
96 $head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
97 $head[$h][1] = $langs->trans("ExtSites").($nbagenda ? '<span class="badge marginleftonlyshort">'.$nbagenda.'</span>' : '');
98 $head[$h][2] = 'extsites';
99 $h++;
100 }
101
102 if (isModEnabled('clicktodial')) {
103 $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
104 $head[$h][1] = $langs->trans("ClickToDial");
105 $head[$h][2] = 'clicktodial';
106 $h++;
107 }
108
109 // Notifications
110 if ($user->socid == 0 && isModEnabled('notification')) {
111 $nbNote = 0;
112 $sql = "SELECT COUNT(n.rowid) as nb";
113 $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n";
114 $sql .= " WHERE fk_user = ".((int) $object->id);
115 $resql = $db->query($sql);
116 if ($resql) {
117 $num = $db->num_rows($resql);
118 $i = 0;
119 while ($i < $num) {
120 $obj = $db->fetch_object($resql);
121 $nbNote = $obj->nb;
122 $i++;
123 }
124 } else {
125 dol_print_error($db);
126 }
127
128 $langs->load("mails");
129 $head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id;
130 $head[$h][1] = $langs->trans("NotificationsAuto");
131 if ($nbNote > 0) {
132 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
133 }
134 $head[$h][2] = 'notify';
135 $h++;
136 }
137
138 // Show more tabs from modules
139 // Entries must be declared in modules descriptor with line
140 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
141 // $this->tabs = array('entity:-tabname); to remove a tab
142 complete_head_from_modules($conf, $langs, $object, $head, $h, 'user');
143
144 if ((isModEnabled('salaries') && $user->hasRight('salaries', 'read'))
145 || (isModEnabled('hrm') && $user->hasRight('hrm', 'employee', 'read'))
146 || (isModEnabled('expensereport') && $user->hasRight('expensereport', 'lire') && ($user->id == $object->id || $user->hasRight('expensereport', 'readall')))
147 || (isModEnabled('holiday') && $user->hasRight('holiday', 'read') && ($user->id == $object->id || $user->hasRight('holiday', 'readall')))
148 ) {
149 // Bank
150 $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;
151 $head[$h][1] = $langs->trans("HRAndBank");
152 $head[$h][2] = 'bank';
153 $h++;
154 }
155
156 // Such info on users is visible only by internal user
157 if (empty($user->socid)) {
158 // Notes
159 $nbNote = 0;
160 if (!empty($object->note_public)) {
161 $nbNote++;
162 }
163 if (!empty($object->note_private)) {
164 $nbNote++;
165 }
166 $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
167 $head[$h][1] = $langs->trans("Note");
168 if ($nbNote > 0) {
169 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
170 }
171 $head[$h][2] = 'note';
172 $h++;
173
174 // Attached files
175 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
176 require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
177 $upload_dir = $conf->user->dir_output."/".$object->id;
178 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
179 $nbLinks = Link::count($db, $object->element, $object->id);
180 $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
181 $head[$h][1] = $langs->trans("Documents");
182 if (($nbFiles + $nbLinks) > 0) {
183 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
184 }
185 $head[$h][2] = 'document';
186 $h++;
187
188 $head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id;
189 $head[$h][1] = $langs->trans("Info");
190 $head[$h][2] = 'info';
191 $h++;
192 }
193
194 complete_head_from_modules($conf, $langs, $object, $head, $h, 'user', 'remove');
195
196 return $head;
197}
198
205function group_prepare_head($object)
206{
207 global $langs, $conf, $user;
208
209 $canreadperms = true;
210 if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
211 $canreadperms = ($user->admin || $user->rights->user->group_advance->readperms);
212 }
213
214 $h = 0;
215 $head = array();
216
217 $head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id;
218 $head[$h][1] = $langs->trans("Card");
219 $head[$h][2] = 'group';
220 $h++;
221
222 if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_SYNCHRO_ACTIVE'))
223 && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) {
224 $langs->load("ldap");
225 $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id;
226 $head[$h][1] = $langs->trans("LDAPCard");
227 $head[$h][2] = 'ldap';
228 $h++;
229 }
230
231 if ($canreadperms) {
232 $head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id;
233 $head[$h][1] = $langs->trans("GroupRights").'<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>';
234 $head[$h][2] = 'rights';
235 $h++;
236 }
237
238 // Show more tabs from modules
239 // Entries must be declared in modules descriptor with line
240 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
241 // $this->tabs = array('entity:-tabname); to remove a tab
242 complete_head_from_modules($conf, $langs, $object, $head, $h, 'group');
243
244 complete_head_from_modules($conf, $langs, $object, $head, $h, 'group', 'remove');
245
246 return $head;
247}
248
255{
256 global $langs, $conf, $user, $db;
257
258 $extrafields = new ExtraFields($db);
259 $extrafields->fetch_name_optionals_label('user');
260 $extrafields->fetch_name_optionals_label('usergroup');
261
262 $langs->load("users");
263 $h = 0;
264 $head = array();
265
266 $head[$h][0] = DOL_URL_ROOT.'/admin/user.php';
267 $head[$h][1] = $langs->trans("Parameters");
268 $head[$h][2] = 'card';
269 $h++;
270
271 $head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php';
272 $head[$h][1] = $langs->trans("Group");
273 $head[$h][2] = 'usergroupcard';
274 $h++;
275
276 $head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
277 $head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Users").")";
278 $nbExtrafields = $extrafields->attributes['user']['count'];
279 if ($nbExtrafields > 0) {
280 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
281 }
282 $head[$h][2] = 'attributes';
283 $h++;
284
285 $head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
286 $head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Groups").")";
287 $nbExtrafields = $extrafields->attributes['usergroup']['count'];
288 if ($nbExtrafields > 0) {
289 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
290 }
291 $head[$h][2] = 'attributes_group';
292 $h++;
293
294 // Show more tabs from modules
295 // Entries must be declared in modules descriptor with line
296 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
297 // $this->tabs = array('entity:-tabname); to remove a tab
298 complete_head_from_modules($conf, $langs, null, $head, $h, 'useradmin');
299
300 complete_head_from_modules($conf, $langs, null, $head, $h, 'useradmin', 'remove');
301
302 return $head;
303}
304
313function showSkins($fuser, $edit = 0, $foruserprofile = false)
314{
315 global $conf, $langs, $db, $form;
316
317 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
318
319 $formother = new FormOther($db);
320
321 $dirthemes = array('/theme');
322 if (!empty($conf->modules_parts['theme'])) { // Using this feature slow down application
323 foreach ($conf->modules_parts['theme'] as $reldir) {
324 $dirthemes = array_merge($dirthemes, (array) ($reldir.'theme'));
325 }
326 }
327 $dirthemes = array_unique($dirthemes);
328 // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
329
330 $selected_theme = '';
331 if (empty($foruserprofile)) {
332 $selected_theme = $conf->global->MAIN_THEME;
333 } else {
334 $selected_theme = ((is_object($fuser) && !empty($fuser->conf->MAIN_THEME)) ? $fuser->conf->MAIN_THEME : '');
335 }
336
337 $hoverdisabled = '';
338 if (empty($foruserprofile)) {
339 $hoverdisabled = (getDolGlobalString('THEME_ELDY_USE_HOVER') == '0');
340 } else {
341 $hoverdisabled = (is_object($fuser) ? (empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0') : '');
342 }
343
344 $checkeddisabled = '';
345 if (empty($foruserprofile)) {
346 $checkeddisabled = (getDolGlobalString('THEME_ELDY_USE_CHECKED') == '0');
347 } else {
348 $checkeddisabled = (is_object($fuser) ? (empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0') : '');
349 }
350
351 $colspan = 2;
352 if ($foruserprofile) {
353 $colspan = 4;
354 }
355
356 $thumbsbyrow = 6;
357 print '<div class="div-table-responsive-no-min">';
358 print '<table class="noborder centpercent'.($edit ? ' editmodeforshowskin' : '').'">';
359
360 // Title
361 if ($foruserprofile) {
362 print '<tr class="liste_titre"><th class="titlefieldmiddle">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>';
363 print '<th colspan="2">&nbsp;</th>';
364 print '</tr>';
365
366 print '<tr>';
367 print '<td>'.$langs->trans("DefaultSkin").'</td>';
368 print '<td>' . getDolGlobalString('MAIN_THEME').'</td>';
369 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>';
370 print '<td>&nbsp;</td>';
371 print '</tr>';
372 } else {
373 $dirthemestring = '';
374 foreach ($dirthemes as $dirtheme) {
375 $dirthemestring .= '"'.$dirtheme.'" ';
376 }
377
378 print '<tr class="liste_titre"><th class="titlefieldmiddle">';
379 print $form->textwithpicto($langs->trans("DefaultSkin"), $langs->trans("ThemeDir").' : '.$dirthemestring);
380 print '</th>';
381 print '<th class="right">';
382 $url = 'https://www.dolistore.com/9-skins';
383 print '<a href="'.$url.'" target="_blank" rel="noopener noreferrer external">';
384 print $langs->trans('DownloadMoreSkins');
385 print img_picto('', 'globe', 'class="paddingleft"');
386 print '</a>';
387 print '</th></tr>';
388 }
389
390 print '<tr><td colspan="'.$colspan.'" class="center">';
391
392 if (getDolGlobalString('MAIN_FORCETHEME')) {
393 $langs->load("errors");
394 print $langs->trans("WarningThemeForcedTo", $conf->global->MAIN_FORCETHEME);
395 }
396
397 print '<table class="nobordernopadding centpercent"><tr><td><div class="center">';
398
399 $i = 0;
400 foreach ($dirthemes as $dir) {
401 //print $dirroot.$dir;exit;
402 $dirtheme = dol_buildpath($dir, 0); // This include loop on $conf->file->dol_document_root
403 $urltheme = dol_buildpath($dir, 1);
404
405 if (is_dir($dirtheme)) {
406 $handle = opendir($dirtheme);
407 if (is_resource($handle)) {
408 while (($subdir = readdir($handle)) !== false) {
409 if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) != '.'
410 && substr($subdir, 0, 3) != 'CVS' && !preg_match('/common|phones/i', $subdir)) {
411 // Disable not stable themes (dir ends with _exp or _dev)
412 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2 && preg_match('/_dev$/i', $subdir)) {
413 continue;
414 }
415 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1 && preg_match('/_exp$/i', $subdir)) {
416 continue;
417 }
418
419 print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
420 $file = $dirtheme."/".$subdir."/thumb.png";
421 $url = $urltheme."/".$subdir."/thumb.png";
422 if (!file_exists($file)) {
423 $url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
424 }
425 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").'">';
426 if ($subdir == $conf->global->MAIN_THEME) {
427 $title = $langs->trans("ThemeCurrentlyActive");
428 } else {
429 $title = $langs->trans("ShowPreview");
430 }
431 print '<img class="img-skinthumb shadow" src="'.$url.'" alt="'.dol_escape_htmltag($title).'" title="'.dol_escape_htmltag($title).'" style="border: none; margin-bottom: 5px;">';
432 print '</a><br>';
433 if ($subdir == $selected_theme) {
434 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>';
435 } else {
436 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>';
437 }
438 print '</div>';
439
440 $i++;
441 }
442 }
443 }
444 }
445 }
446
447 print '</div></td></tr></table>';
448
449 print '</td></tr>';
450
451 // Set variables of theme
452 $colorbackhmenu1 = '';
453 $colorbackvmenu1 = '';
454 $colortexttitlenotab = '';
455 $colortexttitlelink = '';
456 $colorbacktitle1 = '';
457 $colortexttitle = '';
458 $colorbacklineimpair1 = '';
459 $colorbacklineimpair2 = '';
460 $colorbacklinepair1 = '';
461 $colorbacklinepair2 = '';
462 $colortextlink = '';
463 $colorbacklinepairhover = '';
464 $colorbacklinepairhover = '';
465 $colorbacklinepairchecked = '';
466 $butactionbg = '';
467 $textbutaction = '';
468 // Set the variables with the default value
469 if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php')) {
470 include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
471 }
472
473 // Dark mode
474 if ($foruserprofile) {
475 //Nothing
476 } else {
477 $listofdarkmodes = array(
478 '0' => $langs->trans("AlwaysDisabled"),
479 '1' => $langs->trans("AccordingToBrowser"),
480 '2' => $langs->trans("AlwaysEnabled")
481 );
482 print '<tr class="oddeven">';
483 print '<td>'.$langs->trans("DarkThemeMode").'</td>';
484 print '<td colspan="'.($colspan - 1).'">';
485 if ($edit) {
486 print $form->selectarray('THEME_DARKMODEENABLED', $listofdarkmodes, isset($conf->global->THEME_DARKMODEENABLED) ? $conf->global->THEME_DARKMODEENABLED : 0);
487 } else {
488 print $listofdarkmodes[isset($conf->global->THEME_DARKMODEENABLED) ? $conf->global->THEME_DARKMODEENABLED : 0];
489 }
490 print $form->textwithpicto('', $langs->trans("DoesNotWorkWithAllThemes"));
491 print '</tr>';
492 }
493
494
495 // TopMenuDisableImages
496 if ($foruserprofile) {
497 /*
498 print '<tr class="oddeven">';
499 print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
500 print '<td>'.($conf->global->THEME_TOPMENU_DISABLE_IMAGE?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:$langs->trans("Default")).'</td>';
501 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":"");
502 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
503 print '> '.$langs->trans("UsePersonalValue").'</td>';
504 print '<td>';
505 if ($edit)
506 {
507 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),''),'THEME_TOPMENU_DISABLE_IMAGE','',1).' ';
508 }
509 else
510 {
511 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),'');
512 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
513 else print '';
514 }
515 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
516 print '</td>';*/
517 } else {
518 $listoftopmenumodes = array(
519 '0' => $langs->transnoentitiesnoconv("IconAndText"),
520 '1' => $langs->transnoentitiesnoconv("TextOnly"),
521 '2' => $langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover"),
522 '3' => $langs->transnoentitiesnoconv("IconOnlyTextOnHover"),
523 '4' => $langs->transnoentitiesnoconv("IconOnly"),
524 );
525 print '<tr class="oddeven">';
526 print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
527 print '<td colspan="'.($colspan - 1).'">';
528 if ($edit) {
529 //print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1);
530 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');
531 } else {
532 $listoftopmenumodes[getDolGlobalString('THEME_TOPMENU_DISABLE_IMAGE')];
533 //print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);
534 }
535 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"));
536 print '</td>';
537 print '</tr>';
538 }
539
540 // Show logo
541 if ($foruserprofile) {
542 // Nothing
543 } else {
544 // Show logo
545 print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("EnableShowLogo").'</td>';
546 print '<td colspan="'.($colspan - 1).'" class="valignmiddle">';
547 if ($edit) {
548 print ajax_constantonoff('MAIN_SHOW_LOGO', array(), null, 0, 0, 1);
549 //print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1);
550 } else {
551 print yn($conf->global->MAIN_SHOW_LOGO);
552 }
553 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"), 1, 'help', 'inline-block');
554 print '</td>';
555 print '</tr>';
556 /*
557 print '<tr class="oddeven"><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';
558 print "</tr>";*/
559 }
560
561 // BorderTableActive
562 if ($foruserprofile) {
563 } else {
564 print '<tr class="oddeven">';
565 print '<td>'.$langs->trans("UseBorderOnTable").'</td>';
566 print '<td colspan="'.($colspan - 1).'" class="valignmiddle">';
567 if ($edit) {
568 print ajax_constantonoff('THEME_ELDY_USEBORDERONTABLE', array(), null, 0, 0, 1);
569 //print $form->selectyesno('THEME_ELDY_USEBORDERONTABLE', $conf->global->THEME_ELDY_USEBORDERONTABLE, 1);
570 } else {
571 print yn($conf->global->THEME_ELDY_USEBORDERONTABLE);
572 }
573 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"), 1, 'help', 'inline-block');
574 print '</td>';
575 print '</tr>';
576 }
577
578 // Table line height
579 /* removed. height of column must use padding of td and not lineheight that has bad side effect
580 if ($foruserprofile) {
581 } else {
582 $listoftopmenumodes = array(
583 '0' => $langs->transnoentitiesnoconv("Normal"),
584 '1' => $langs->transnoentitiesnoconv("LargeModern"),
585 );
586 print '<tr class="oddeven">';
587 print '<td>'.$langs->trans("TableLineHeight").'</td>';
588 print '<td colspan="'.($colspan - 1).'" class="valignmiddle">';
589 if ($edit) {
590 //print ajax_constantonoff('THEME_ELDY_USECOMOACTROW', array(), null, 0, 0, 1);
591 print $form->selectarray('THEME_ELDY_USECOMOACTROW', $listoftopmenumodes, getDolGlobalString('THEME_ELDY_USECOMOACTROW'), 0, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300');
592 } else {
593 print $listoftopmenumodes[getDolGlobalString('THEME_ELDY_USECOMOACTROW')];
594 }
595 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"), 1, 'help', 'inline-block');
596 print '</td>';
597 print '</tr>';
598 }
599 */
600
601 // Background color THEME_ELDY_BACKBODY
602 if ($foruserprofile) {
603 /*
604 print '<tr class="oddeven">';
605 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
606 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
607 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":"");
608 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
609 print '> '.$langs->trans("UsePersonalValue").'</td>';
610 print '<td>';
611 if ($edit)
612 {
613 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' ';
614 }
615 else
616 {
617 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
618 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
619 else print '';
620 }
621 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
622 print '</td>';*/
623 } else {
624 $default = 'ffffff';
625 print '<tr class="oddeven">';
626 print '<td>'.$langs->trans("BackgroundColor").'</td>';
627 print '<td colspan="'.($colspan - 1).'">';
628 //var_dump($conf->global->THEME_ELDY_BACKBODY);
629 if ($edit) {
630 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_BACKBODY') ? $conf->global->THEME_ELDY_BACKBODY : ''), array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody', $default).' ';
631 } else {
632 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), '');
633 if ($color) {
634 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
635 } else {
636 print $langs->trans("Default");
637 }
638 }
639 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
640 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
641 print '</td>';
642 print '</tr>';
643 }
644
645 // 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 // 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 // TextTitleColor for title of Pages
734 if ($foruserprofile) {
735 } else {
736 $default = (empty($colortexttitlenotab) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlenotab)));
737
738 print '<tr class="oddeven">';
739 print '<td>'.$langs->trans("TextTitleColor").'</td>';
740 print '<td colspan="'.($colspan - 1).'">';
741 if ($edit) {
742 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TEXTTITLENOTAB') ? $conf->global->THEME_ELDY_TEXTTITLENOTAB : ''), array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab', $default).' ';
743 } else {
744 print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
745 }
746 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
747 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
748 print '</td>';
749
750 print '</tr>';
751 }
752
753 // BackgroundTableTitleColor
754 if ($foruserprofile) {
755 } else {
756 $default = (empty($colorbacktitle1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacktitle1)));
757
758 print '<tr class="oddeven">';
759 print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
760 print '<td colspan="'.($colspan - 1).'">';
761 if ($edit) {
762 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_BACKTITLE1') ? $conf->global->THEME_ELDY_BACKTITLE1 : ''), array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1', $default).' ';
763 } else {
764 print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
765 }
766 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> '; // $colorbacktitle1 in CSS
767 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
768 print '</td>';
769
770 print '</tr>';
771 }
772
773 // TextTitleColor
774 if ($foruserprofile) {
775 } else {
776 $default = (empty($colortexttitle) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitle)));
777
778 print '<tr class="oddeven">';
779 print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
780 print '<td colspan="'.($colspan - 1).'">';
781 if ($edit) {
782 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TEXTTITLE') ? $conf->global->THEME_ELDY_TEXTTITLE : ''), array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle', $default).' ';
783 } else {
784 print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
785 }
786 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
787 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
788 print '</td>';
789
790 print '</tr>';
791 }
792
793 // TextTitleLinkColor
794 if ($foruserprofile) {
795 } else {
796 $default = (empty($colortexttitlelink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlelink)));
797
798 print '<tr class="oddeven">';
799 print '<td>'.$langs->trans("BackgroundTableTitleTextlinkColor").'</td>';
800 print '<td colspan="'.($colspan - 1).'">';
801 if ($edit) {
802 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TEXTTITLELINK') ? $conf->global->THEME_ELDY_TEXTTITLELINK : ''), array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink', $default).' ';
803 } else {
804 print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default"));
805 }
806 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
807 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
808 print '</span>';
809 print '</td>';
810
811 print '</tr>';
812 }
813
814 // BackgroundTableLineOddColor
815 if ($foruserprofile) {
816 } else {
817 $default = (empty($colorbacklineimpair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklineimpair1)));
818
819 print '<tr class="oddeven">';
820 print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
821 print '<td colspan="'.($colspan - 1).'">';
822 if ($edit) {
823 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_LINEIMPAIR1') ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklineimpair2', $default).' ';
824 } else {
825 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), '');
826 if ($color) {
827 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
828 } else {
829 print $langs->trans("Default");
830 }
831 }
832 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
833 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
834 print '</td>';
835 print '</tr>';
836 }
837
838 // BackgroundTableLineEvenColor
839 if ($foruserprofile) {
840 } else {
841 $default = (empty($colorbacklinepair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepair1)));
842
843 print '<tr class="oddeven">';
844 print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
845 print '<td colspan="'.($colspan - 1).'">';
846 if ($edit) {
847 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_LINEPAIR1') ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklinepair2', $default).' ';
848 } else {
849 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), '');
850 if ($color) {
851 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
852 } else {
853 print $langs->trans("Default");
854 }
855 }
856 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
857 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
858 print '</td>';
859 print '</tr>';
860 }
861
862 // Text LinkColor
863 if ($foruserprofile) {
864 /*
865 print '<tr class="oddeven">';
866 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
867 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTLINK:$langs->trans("Default")).'</td>';
868 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":"");
869 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
870 print '> '.$langs->trans("UsePersonalValue").'</td>';
871 print '<td>';
872 if ($edit)
873 {
874 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','',1).' ';
875 }
876 else
877 {
878 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
879 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
880 else print '';
881 }
882 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
883 print '</td>';*/
884 } else {
885 $default = (empty($colortextlink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortextlink)));
886
887 print '<tr class="oddeven">';
888 print '<td>'.$langs->trans("LinkColor").'</td>';
889 print '<td colspan="'.($colspan - 1).'">';
890 if ($edit) {
891 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TEXTLINK') ? $conf->global->THEME_ELDY_TEXTLINK : ''), array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink', $default).' ';
892 } else {
893 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), '');
894 if ($color) {
895 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
896 } else {
897 //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
898 //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
899 print $langs->trans("Default");
900 }
901 }
902 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
903 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
904 print '</td>';
905 print '</tr>';
906 }
907
908 // Use Hover
909 if ($foruserprofile) {
910 /* Must first change option to choose color of highlight instead of yes or no.
911 print '<tr class="oddeven">';
912 print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
913 print '<td><input name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
914 print '<td class="nowrap left" width="20%"><input name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
915 print '<td><input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
916 print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
917 print '</td>';
918 print '</tr>';
919 */
920 } else {
921 $default = (empty($colorbacklinepairhover) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairhover)));
922
923 print '<tr class="oddeven">';
924 print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
925 print '<td colspan="'.($colspan - 1).'">';
926 //print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
927 //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
928 if ($edit) {
929 if (getDolGlobalString('THEME_ELDY_USE_HOVER') == '1') {
930 $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
931 } else {
932 $color = colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_USE_HOVER') ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
933 }
934 print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover', $default).' ';
935 } else {
936 if (getDolGlobalString('THEME_ELDY_USE_HOVER') == '1') {
937 $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
938 } else {
939 $color = colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_USE_HOVER') ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
940 }
941 if ($color) {
942 if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) {
943 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
944 } else {
945 print $langs->trans("Default");
946 }
947 } else {
948 print $langs->trans("Default");
949 }
950 }
951 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
952 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
953 print '</td>';
954 }
955
956 // Use Checked
957 if ($foruserprofile) {
958 /* Must first change option to choose color of highlight instead of yes or no.
959 print '<tr class="oddeven">';
960 print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
961 print '<td><input name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
962 print '<td class="nowrap left" width="20%"><input name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
963 print '<td><input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
964 print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
965 print '</td>';
966 print '</tr>';
967 */
968 } else {
969 $default = (empty($colorbacklinepairchecked) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairchecked)));
970
971 print '<tr class="oddeven">';
972 print '<td>'.$langs->trans("HighlightLinesChecked").'</td>';
973 print '<td colspan="'.($colspan - 1).'">';
974 //print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
975 //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
976 if ($edit) {
977 if (getDolGlobalString('THEME_ELDY_USE_CHECKED') == '1') {
978 $color = 'e6edf0';
979 } else {
980 $color = colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_USE_CHECKED') ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
981 }
982 print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked', $default).' ';
983 } else {
984 if (getDolGlobalString('THEME_ELDY_USE_CHECKED') == '1') {
985 $color = 'e6edf0';
986 } else {
987 $color = colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_USE_CHECKED') ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
988 }
989 if ($color) {
990 if ($color != 'e6edf0') {
991 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
992 } else {
993 print $langs->trans("Default");
994 }
995 } else {
996 print $langs->trans("Default");
997 }
998 }
999 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1000 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
1001 print '</td>';
1002 print '</tr>';
1003 }
1004
1005 // Btn action
1006 if ($foruserprofile) {
1007 /*
1008 print '<tr class="oddeven">';
1009 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
1010 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_BTNACTION:$langs->trans("Default")).'</td>';
1011 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":"");
1012 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
1013 print '> '.$langs->trans("UsePersonalValue").'</td>';
1014 print '<td>';
1015 if ($edit)
1016 {
1017 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION,array()),''),'THEME_ELDY_BTNACTION','',1).' ';
1018 }
1019 else
1020 {
1021 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION,array()),'');
1022 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1023 else print '';
1024 }
1025 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
1026 print '</td>';*/
1027 } else {
1028 $default = (empty($butactionbg) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($butactionbg)));
1029
1030 print '<tr class="oddeven">';
1031 print '<td>'.$langs->trans("BtnActionColor").'</td>';
1032 print '<td colspan="'.($colspan - 1).'">';
1033 if ($edit) {
1034 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_BTNACTION') ? $conf->global->THEME_ELDY_BTNACTION : ''), array()), ''), 'THEME_ELDY_BTNACTION', '', 1, '', '', 'butactionbg', $default).' ';
1035 } else {
1036 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION, array()), '');
1037 if ($color) {
1038 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1039 } else {
1040 //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
1041 //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
1042 print $langs->trans("Default");
1043 }
1044 }
1045 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
1046 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
1047 print '</td>';
1048 print '</tr>';
1049 }
1050
1051 // Text btn action
1052 if ($foruserprofile) {
1053 /*
1054 print '<tr class="oddeven">';
1055 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
1056 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTBTNACTION:$langs->trans("Default")).'</td>';
1057 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":"");
1058 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
1059 print '> '.$langs->trans("UsePersonalValue").'</td>';
1060 print '<td>';
1061 if ($edit)
1062 {
1063 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTBTNACTION,array()),''),'THEME_ELDY_TEXTBTNACTION','',1).' ';
1064 }
1065 else
1066 {
1067 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION,array()),'');
1068 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1069 else print '';
1070 }
1071 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
1072 print '</td>';*/
1073 } else {
1074 $default = (empty($textbutaction) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($textbutaction)));
1075
1076 print '<tr class="oddeven">';
1077 print '<td>'.$langs->trans("TextBtnActionColor").'</td>';
1078 print '<td colspan="'.($colspan - 1).'">';
1079 if ($edit) {
1080 print $formother->selectColor(colorArrayToHex(colorStringToArray((getDolGlobalString('THEME_ELDY_TEXTBTNACTION') ? $conf->global->THEME_ELDY_TEXTBTNACTION : ''), array()), ''), 'THEME_ELDY_TEXTBTNACTION', '', 1, '', '', 'textbutaction', $default).' ';
1081 } else {
1082 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTBTNACTION, array()), '');
1083 if ($color) {
1084 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1085 } else {
1086 //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
1087 //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
1088 print $langs->trans("Default");
1089 }
1090 }
1091 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #000">'.$default.'</span></strong> ';
1092 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
1093 print '</td>';
1094 print '</tr>';
1095 }
1096
1097 // Use MAIN_OPTIMIZEFORTEXTBROWSER
1098 if ($foruserprofile) {
1099 //$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
1100 $default = $langs->trans('No');
1101 print '<tr class="oddeven">';
1102 print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
1103 print '<td colspan="'.($colspan - 1).'">';
1104 //print ajax_constantonoff("MAIN_OPTIMIZEFORTEXTBROWSER", array(), null, 0, 0, 1, 0);
1105 if ($edit) {
1106 print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', (isset($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER) ? $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER : 0), 1);
1107 } else {
1108 if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
1109 print yn(isset($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER) ? $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER : 0);
1110 } else {
1111 print yn(1);
1112 if (empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1113 print ' ('.$langs->trans("ForcedByGlobalSetup").')';
1114 }
1115 }
1116 }
1117 print ' &nbsp; <span class="opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1118 print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc"));
1119 print '</td>';
1120 print '</tr>';
1121 } else {
1122 //var_dump($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
1123 /*
1124 $default=$langs->trans('No');
1125 print '<tr class="oddeven">';
1126 print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
1127 print '<td colspan="'.($colspan-1).'">';
1128 if ($edit) {
1129 print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER, 1);
1130 } else {
1131 print yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
1132 }
1133 print ' &nbsp; wspan class="opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1134 print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc"));
1135 print '</span>';
1136 print '</td>';
1137 print '</tr>';
1138 */
1139 }
1140
1141
1142 // Use MAIN_OPTIMIZEFORCOLORBLIND
1143 if ($foruserprofile) {
1144 //$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
1145 $default = $langs->trans('No');
1146 print '<tr class="oddeven">';
1147 print '<td>'.$langs->trans("MAIN_OPTIMIZEFORCOLORBLIND").'</td>';
1148 print '<td colspan="'.($colspan - 1).'">';
1149
1150 $colorBlindOptions = array(
1151 0 => $langs->trans('No'),
1152 'flashy' => $langs->trans('Flashy'),
1153 'protanopia' => $langs->trans('Protanopia'),
1154 'deuteranopes' => $langs->trans('Deuteranopes'),
1155 'tritanopes' => $langs->trans('Tritanopes'),
1156 );
1157
1158 if ($edit) {
1159 print $form->selectArray('MAIN_OPTIMIZEFORCOLORBLIND', $colorBlindOptions, (isset($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) ? $fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND : 0), 0);
1160 } else {
1161 if (!empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) && isset($colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND])) {
1162 print $colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND];
1163 } else {
1164 print yn(0);
1165 }
1166 }
1167 print ' &nbsp; <span class="opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1168 print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORCOLORBLINDDesc"));
1169 print '</td>';
1170 print '</tr>';
1171 } else {
1172 }
1173 print '</table>';
1174 print '</div>';
1175}
Class to manage standard extra fields.
Classe permettant la generation de composants html autre Only common components are here.
Class to manage Dolibarr users.
dol_dir_list($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:62
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,...
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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_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...
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.