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