dolibarr 18.0.6
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 Anthony Berton <bertonanthony@gmail.com>
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 (!empty($conf->global->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) && !empty($conf->global->LDAP_SYNCHRO_ACTIVE))
55 && (empty($conf->global->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").(empty($conf->global->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 (empty($conf->global->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') && !empty($user->rights->salaries->read))
145 || (isModEnabled('hrm') && !empty($user->rights->hrm->employee->read))
146 || (isModEnabled('expensereport') && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall))
147 || (isModEnabled('holiday') && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->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 (!empty($conf->global->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) && !empty($conf->global->LDAP_SYNCHRO_ACTIVE))
223 && (empty($conf->global->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 = (isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->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 = (isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->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>'.$conf->global->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 (!empty($conf->global->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[$conf->global->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><td>';
546 if ($edit) {
547 print ajax_constantonoff('MAIN_SHOW_LOGO', array(), null, 0, 0, 1);
548 //print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1);
549 } else {
550 print yn($conf->global->MAIN_SHOW_LOGO);
551 }
552 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"));
553 print '</td>';
554 print '</tr>';
555 /*
556 print '<tr class="oddeven"><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';
557 print "</tr>";*/
558 }
559
560 // BorderTableActive
561 if ($foruserprofile) {
562 } else {
563 print '<tr class="oddeven">';
564 print '<td>'.$langs->trans("UseBorderOnTable").'</td>';
565 print '<td colspan="'.($colspan - 1).'">';
566 if ($edit) {
567 print ajax_constantonoff('THEME_ELDY_USEBORDERONTABLE', array(), null, 0, 0, 1);
568 //print $form->selectyesno('THEME_ELDY_USEBORDERONTABLE', $conf->global->THEME_ELDY_USEBORDERONTABLE, 1);
569 } else {
570 print yn($conf->global->THEME_ELDY_USEBORDERONTABLE);
571 }
572 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"));
573 print '</td>';
574 print '</tr>';
575 }
576
577 // Background color THEME_ELDY_BACKBODY
578 if ($foruserprofile) {
579 /*
580 print '<tr class="oddeven">';
581 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
582 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
583 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":"");
584 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
585 print '> '.$langs->trans("UsePersonalValue").'</td>';
586 print '<td>';
587 if ($edit)
588 {
589 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' ';
590 }
591 else
592 {
593 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
594 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
595 else print '';
596 }
597 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
598 print '</td>';*/
599 } else {
600 print '<tr class="oddeven">';
601 print '<td>'.$langs->trans("BackgroundColor").'</td>';
602 print '<td colspan="'.($colspan - 1).'">';
603 //var_dump($conf->global->THEME_ELDY_BACKBODY);
604 if ($edit) {
605 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKBODY) ? $conf->global->THEME_ELDY_BACKBODY : ''), array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' ';
606 } else {
607 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), '');
608 if ($color) {
609 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
610 } else {
611 print $langs->trans("Default");
612 }
613 }
614 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>ffffff</strong> ';
615 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
616 print '</td>';
617 print '</tr>';
618 }
619
620 // TopMenuBackgroundColor
621 if ($foruserprofile) {
622 /*
623 print '<tr class="oddeven">';
624 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
625 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
626 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":"");
627 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
628 print '> '.$langs->trans("UsePersonalValue").'</td>';
629 print '<td>';
630 if ($edit)
631 {
632 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' ';
633 }
634 else
635 {
636 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
637 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
638 else print '';
639 }
640 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
641 print '</td>';*/
642 } else {
643 $default = (empty($colorbackhmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackhmenu1)));
644
645 print '<tr class="oddeven">';
646 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
647 print '<td colspan="'.($colspan - 1).'">';
648 if ($edit) {
649 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $conf->global->THEME_ELDY_TOPMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' ';
650 } else {
651 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), '');
652 if ($color) {
653 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
654 } else {
655 print $langs->trans("Default");
656 }
657 }
658 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
659 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
660 print '</td>';
661 print '</tr>';
662 }
663
664 // LeftMenuBackgroundColor
665 if ($foruserprofile) {
666 /*
667 print '<tr class="oddeven">';
668 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
669 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_VERMENU_BACK1:$langs->trans("Default")).'</td>';
670 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":"");
671 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
672 print '> '.$langs->trans("UsePersonalValue").'</td>';
673 print '<td>';
674 if ($edit)
675 {
676 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','',1).' ';
677 }
678 else
679 {
680 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),'');
681 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
682 else print '';
683 }
684 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
685 print '</td>';*/
686 } else {
687 $default = (empty($colorbackvmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackvmenu1)));
688
689 print '<tr class="oddeven">';
690 print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
691 print '<td colspan="'.($colspan - 1).'">';
692 if ($edit) {
693 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $conf->global->THEME_ELDY_VERMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' ';
694 } else {
695 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), '');
696 if ($color) {
697 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
698 } else {
699 print $langs->trans("Default");
700 }
701 }
702 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
703 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
704 print '</td>';
705 print '</tr>';
706 }
707
708 // TextTitleColor for title of Pages
709 if ($foruserprofile) {
710 } else {
711 $default = (empty($colortexttitlenotab) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlenotab)));
712
713 print '<tr class="oddeven">';
714 print '<td>'.$langs->trans("TextTitleColor").'</td>';
715 print '<td colspan="'.($colspan - 1).'">';
716 if ($edit) {
717 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $conf->global->THEME_ELDY_TEXTTITLENOTAB : ''), array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' ';
718 } else {
719 print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
720 }
721 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
722 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
723 print '</td>';
724
725 print '</tr>';
726 }
727
728 // BackgroundTableTitleColor
729 if ($foruserprofile) {
730 } else {
731 $default = (empty($colorbacktitle1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacktitle1)));
732
733 print '<tr class="oddeven">';
734 print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
735 print '<td colspan="'.($colspan - 1).'">';
736 if ($edit) {
737 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKTITLE1) ? $conf->global->THEME_ELDY_BACKTITLE1 : ''), array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' ';
738 } else {
739 print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
740 }
741 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> '; // $colorbacktitle1 in CSS
742 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
743 print '</td>';
744
745 print '</tr>';
746 }
747
748 // TextTitleColor
749 if ($foruserprofile) {
750 } else {
751 $default = (empty($colortexttitle) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitle)));
752
753 print '<tr class="oddeven">';
754 print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
755 print '<td colspan="'.($colspan - 1).'">';
756 if ($edit) {
757 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLE) ? $conf->global->THEME_ELDY_TEXTTITLE : ''), array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' ';
758 } else {
759 print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
760 }
761 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
762 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
763 print '</td>';
764
765 print '</tr>';
766 }
767
768 // TextTitleLinkColor
769 if ($foruserprofile) {
770 } else {
771 $default = (empty($colortexttitlelink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlelink)));
772
773 print '<tr class="oddeven">';
774 print '<td>'.$langs->trans("BackgroundTableTitleTextlinkColor").'</td>';
775 print '<td colspan="'.($colspan - 1).'">';
776 if ($edit) {
777 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLELINK) ? $conf->global->THEME_ELDY_TEXTTITLELINK : ''), array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' ';
778 } else {
779 print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default"));
780 }
781 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
782 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
783 print '</span>';
784 print '</td>';
785
786 print '</tr>';
787 }
788
789 // BackgroundTableLineOddColor
790 if ($foruserprofile) {
791 } else {
792 $default = (empty($colorbacklineimpair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklineimpair1)));
793
794 print '<tr class="oddeven">';
795 print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
796 print '<td colspan="'.($colspan - 1).'">';
797 if ($edit) {
798 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklineimpair2').' ';
799 } else {
800 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), '');
801 if ($color) {
802 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
803 } else {
804 print $langs->trans("Default");
805 }
806 }
807 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
808 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
809 print '</td>';
810 print '</tr>';
811 }
812
813 // BackgroundTableLineEvenColor
814 if ($foruserprofile) {
815 } else {
816 $default = (empty($colorbacklinepair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepair1)));
817
818 print '<tr class="oddeven">';
819 print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
820 print '<td colspan="'.($colspan - 1).'">';
821 if ($edit) {
822 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEPAIR1) ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklinepair2').' ';
823 } else {
824 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), '');
825 if ($color) {
826 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
827 } else {
828 print $langs->trans("Default");
829 }
830 }
831 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
832 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
833 print '</td>';
834 print '</tr>';
835 }
836
837 // Text LinkColor
838 if ($foruserprofile) {
839 /*
840 print '<tr class="oddeven">';
841 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
842 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTLINK:$langs->trans("Default")).'</td>';
843 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":"");
844 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
845 print '> '.$langs->trans("UsePersonalValue").'</td>';
846 print '<td>';
847 if ($edit)
848 {
849 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','',1).' ';
850 }
851 else
852 {
853 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
854 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
855 else print '';
856 }
857 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
858 print '</td>';*/
859 } else {
860 $default = (empty($colortextlink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortextlink)));
861
862 print '<tr class="oddeven">';
863 print '<td>'.$langs->trans("LinkColor").'</td>';
864 print '<td colspan="'.($colspan - 1).'">';
865 if ($edit) {
866 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTLINK) ? $conf->global->THEME_ELDY_TEXTLINK : ''), array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' ';
867 } else {
868 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), '');
869 if ($color) {
870 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
871 } else {
872 //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
873 //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
874 print $langs->trans("Default");
875 }
876 }
877 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
878 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
879 print '</td>';
880 print '</tr>';
881 }
882
883 // Use Hover
884 if ($foruserprofile) {
885 /* Must first change option to choose color of highlight instead of yes or no.
886 print '<tr class="oddeven">';
887 print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
888 print '<td><input name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
889 print '<td class="nowrap left" width="20%"><input name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
890 print '<td><input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
891 print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
892 print '</td>';
893 print '</tr>';
894 */
895 } else {
896 $default = (empty($colorbacklinepairhover) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairhover)));
897
898 print '<tr class="oddeven">';
899 print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
900 print '<td colspan="'.($colspan - 1).'">';
901 //print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
902 //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
903 if ($edit) {
904 if (!empty($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '1') {
905 $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
906 } else {
907 $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
908 }
909 print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover').' ';
910 } else {
911 if ($conf->global->THEME_ELDY_USE_HOVER == '1') {
912 $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
913 } else {
914 $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
915 }
916 if ($color) {
917 if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) {
918 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
919 } else {
920 print $langs->trans("Default");
921 }
922 } else {
923 print $langs->trans("Default");
924 }
925 }
926 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
927 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
928 print '</td>';
929 }
930
931 // Use Checked
932 if ($foruserprofile) {
933 /* Must first change option to choose color of highlight instead of yes or no.
934 print '<tr class="oddeven">';
935 print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
936 print '<td><input name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
937 print '<td class="nowrap left" width="20%"><input name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
938 print '<td><input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
939 print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
940 print '</td>';
941 print '</tr>';
942 */
943 } else {
944 $default = (empty($colorbacklinepairchecked) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairchecked)));
945
946 print '<tr class="oddeven">';
947 print '<td>'.$langs->trans("HighlightLinesChecked").'</td>';
948 print '<td colspan="'.($colspan - 1).'">';
949 //print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
950 //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
951 if ($edit) {
952 if (!empty($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '1') {
953 $color = 'e6edf0';
954 } else {
955 $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
956 }
957 print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked').' ';
958 } else {
959 if ($conf->global->THEME_ELDY_USE_CHECKED == '1') {
960 $color = 'e6edf0';
961 } else {
962 $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
963 }
964 if ($color) {
965 if ($color != 'e6edf0') {
966 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
967 } else {
968 print $langs->trans("Default");
969 }
970 } else {
971 print $langs->trans("Default");
972 }
973 }
974 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
975 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
976 print '</td>';
977 print '</tr>';
978 }
979
980 // Btn action
981 if ($foruserprofile) {
982 /*
983 print '<tr class="oddeven">';
984 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
985 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_BTNACTION:$langs->trans("Default")).'</td>';
986 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":"");
987 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
988 print '> '.$langs->trans("UsePersonalValue").'</td>';
989 print '<td>';
990 if ($edit)
991 {
992 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION,array()),''),'THEME_ELDY_BTNACTION','',1).' ';
993 }
994 else
995 {
996 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION,array()),'');
997 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
998 else print '';
999 }
1000 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
1001 print '</td>';*/
1002 } else {
1003 $default = (empty($butactionbg) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($butactionbg)));
1004
1005 print '<tr class="oddeven">';
1006 print '<td>'.$langs->trans("BtnActionColor").'</td>';
1007 print '<td colspan="'.($colspan - 1).'">';
1008 if ($edit) {
1009 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BTNACTION) ? $conf->global->THEME_ELDY_BTNACTION : ''), array()), ''), 'THEME_ELDY_BTNACTION', '', 1, '', '', 'butactionbg').' ';
1010 } else {
1011 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION, array()), '');
1012 if ($color) {
1013 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1014 } else {
1015 //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
1016 //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
1017 print $langs->trans("Default");
1018 }
1019 }
1020 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #'.$default.'">'.$default.'</span></strong> ';
1021 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
1022 print '</td>';
1023 print '</tr>';
1024 }
1025
1026 // Text btn action
1027 if ($foruserprofile) {
1028 /*
1029 print '<tr class="oddeven">';
1030 print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
1031 print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTBTNACTION:$langs->trans("Default")).'</td>';
1032 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":"");
1033 print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
1034 print '> '.$langs->trans("UsePersonalValue").'</td>';
1035 print '<td>';
1036 if ($edit)
1037 {
1038 print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTBTNACTION,array()),''),'THEME_ELDY_TEXTBTNACTION','',1).' ';
1039 }
1040 else
1041 {
1042 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BTNACTION,array()),'');
1043 if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1044 else print '';
1045 }
1046 if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
1047 print '</td>';*/
1048 } else {
1049 $default = (empty($textbutaction) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($textbutaction)));
1050
1051 print '<tr class="oddeven">';
1052 print '<td>'.$langs->trans("TextBtnActionColor").'</td>';
1053 print '<td colspan="'.($colspan - 1).'">';
1054 if ($edit) {
1055 print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTBTNACTION) ? $conf->global->THEME_ELDY_TEXTBTNACTION : ''), array()), ''), 'THEME_ELDY_TEXTBTNACTION', '', 1, '', '', 'textbutaction').' ';
1056 } else {
1057 $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTBTNACTION, array()), '');
1058 if ($color) {
1059 print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
1060 } else {
1061 //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
1062 //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
1063 print $langs->trans("Default");
1064 }
1065 }
1066 print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong><span style="color: #000">'.$default.'</span></strong> ';
1067 print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
1068 print '</td>';
1069 print '</tr>';
1070 }
1071
1072 // Use MAIN_OPTIMIZEFORTEXTBROWSER
1073 if ($foruserprofile) {
1074 //$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
1075 $default = $langs->trans('No');
1076 print '<tr class="oddeven">';
1077 print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
1078 print '<td colspan="'.($colspan - 1).'">';
1079 //print ajax_constantonoff("MAIN_OPTIMIZEFORTEXTBROWSER", array(), null, 0, 0, 1, 0);
1080 if ($edit) {
1081 print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', (isset($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER) ? $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER : 0), 1);
1082 } else {
1083 if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1084 print yn(isset($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER) ? $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER : 0);
1085 } else {
1086 print yn(1);
1087 if (empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1088 print ' ('.$langs->trans("ForcedByGlobalSetup").')';
1089 }
1090 }
1091 }
1092 print ' &nbsp; <span class="opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1093 print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc"));
1094 print '</td>';
1095 print '</tr>';
1096 } else {
1097 //var_dump($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
1098 /*
1099 $default=$langs->trans('No');
1100 print '<tr class="oddeven">';
1101 print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
1102 print '<td colspan="'.($colspan-1).'">';
1103 if ($edit) {
1104 print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER, 1);
1105 } else {
1106 print yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
1107 }
1108 print ' &nbsp; wspan class="opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1109 print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc"));
1110 print '</span>';
1111 print '</td>';
1112 print '</tr>';
1113 */
1114 }
1115
1116
1117 // Use MAIN_OPTIMIZEFORCOLORBLIND
1118 if ($foruserprofile) {
1119 //$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
1120 $default = $langs->trans('No');
1121 print '<tr class="oddeven">';
1122 print '<td>'.$langs->trans("MAIN_OPTIMIZEFORCOLORBLIND").'</td>';
1123 print '<td colspan="'.($colspan - 1).'">';
1124
1125 $colorBlindOptions = array(
1126 0 => $langs->trans('No'),
1127 'flashy' => $langs->trans('Flashy'),
1128 'protanopia' => $langs->trans('Protanopia'),
1129 'deuteranopes' => $langs->trans('Deuteranopes'),
1130 'tritanopes' => $langs->trans('Tritanopes'),
1131 );
1132
1133 if ($edit) {
1134 print $form->selectArray('MAIN_OPTIMIZEFORCOLORBLIND', $colorBlindOptions, (isset($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) ? $fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND : 0), 0);
1135 } else {
1136 if (!empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) && isset($colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND])) {
1137 print $colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND];
1138 } else {
1139 print yn(0);
1140 }
1141 }
1142 print ' &nbsp; <span class="opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
1143 print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORCOLORBLINDDesc"));
1144 print '</td>';
1145 print '</tr>';
1146 } else {
1147 }
1148 print '</table>';
1149 print '</div>';
1150}
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 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).
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.