1
|
|
|
<?php |
2
|
|
|
/* Copyright (C) 2006-2012 Laurent Destailleur <[email protected]> |
3
|
|
|
* Copyright (C) 2010-2017 Regis Houssin <[email protected]> |
4
|
|
|
* Copyright (C) 2015 Alexandre Spangaro <[email protected]> |
5
|
|
|
* |
6
|
|
|
* This program is free software; you can redistribute it and/or modify |
7
|
|
|
* it under the terms of the GNU General Public License as published by |
8
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
9
|
|
|
* (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
* GNU General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU General Public License |
17
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
18
|
|
|
* or see http://www.gnu.org/ |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* \file htdocs/core/lib/usergroups.lib.php |
24
|
|
|
* \brief Ensemble de fonctions de base pour la gestion des utilisaterus et groupes |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Prepare array with list of tabs |
29
|
|
|
* |
30
|
|
|
* @param Object $object Object related to tabs |
31
|
|
|
* @return array Array of tabs to show |
32
|
|
|
*/ |
33
|
|
|
function user_prepare_head($object) |
34
|
|
|
{ |
35
|
|
|
global $langs, $conf, $user, $db; |
36
|
|
|
|
37
|
|
|
$langs->load("users"); |
38
|
|
|
|
39
|
|
|
$canreadperms=true; |
40
|
|
|
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) |
41
|
|
|
{ |
42
|
|
|
$canreadperms=($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms)); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
$h = 0; |
46
|
|
|
$head = array(); |
47
|
|
|
|
48
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id; |
49
|
|
|
$head[$h][1] = $langs->trans("UserCard"); |
50
|
|
|
$head[$h][2] = 'user'; |
51
|
|
|
$h++; |
52
|
|
|
|
53
|
|
|
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
54
|
|
|
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
55
|
|
|
{ |
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
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id; |
64
|
|
|
$head[$h][1] = $langs->trans("UserGUISetup"); |
65
|
|
|
$head[$h][2] = 'guisetup'; |
66
|
|
|
$h++; |
67
|
|
|
|
68
|
|
|
if ($canreadperms) |
69
|
|
|
{ |
70
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id; |
71
|
|
|
$head[$h][1] = $langs->trans("UserRights"). ' <span class="badge">'.($object->nb_rights).'</span>'; |
72
|
|
|
$head[$h][2] = 'rights'; |
73
|
|
|
$h++; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
if (! empty($conf->agenda->enabled)) |
77
|
|
|
{ |
78
|
|
|
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; |
79
|
|
|
$MAXAGENDA=$conf->global->AGENDA_EXT_NB; |
80
|
|
|
|
81
|
|
|
$i=1; |
82
|
|
|
$nbagenda = 0; |
83
|
|
|
while ($i <= $MAXAGENDA) |
84
|
|
|
{ |
85
|
|
|
$key=$i; |
86
|
|
|
$name='AGENDA_EXT_NAME_'.$object->id.'_'.$key; |
87
|
|
|
$src='AGENDA_EXT_SRC_'.$object->id.'_'.$key; |
88
|
|
|
$offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key; |
89
|
|
|
$color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key; |
90
|
|
|
$i++; |
91
|
|
|
|
92
|
|
|
if (! empty($object->conf->$name)) $nbagenda++; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id; |
96
|
|
|
$head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' <span class="badge">'.$nbagenda.'</span>' : ''); |
97
|
|
|
$head[$h][2] = 'extsites'; |
98
|
|
|
$h++; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
if (! empty($conf->clicktodial->enabled)) |
102
|
|
|
{ |
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->societe_id == 0 && ! empty($conf->notification->enabled)) |
111
|
|
|
{ |
112
|
|
|
$nbNote = 0; |
113
|
|
|
$sql = "SELECT COUNT(n.rowid) as nb"; |
114
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; |
115
|
|
|
$sql.= " WHERE fk_user = ".$object->id; |
116
|
|
|
$resql=$db->query($sql); |
117
|
|
|
if ($resql) |
118
|
|
|
{ |
119
|
|
|
$num = $db->num_rows($resql); |
120
|
|
|
$i = 0; |
121
|
|
|
while ($i < $num) |
122
|
|
|
{ |
123
|
|
|
$obj = $db->fetch_object($resql); |
124
|
|
|
$nbNote=$obj->nb; |
125
|
|
|
$i++; |
126
|
|
|
} |
127
|
|
|
} |
128
|
|
|
else { |
129
|
|
|
dol_print_error($db); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id; |
133
|
|
|
$head[$h][1] = $langs->trans("Notifications"); |
134
|
|
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
135
|
|
|
$head[$h][2] = 'notify'; |
136
|
|
|
$h++; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
// Show more tabs from modules |
140
|
|
|
// Entries must be declared in modules descriptor with line |
141
|
|
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
142
|
|
|
// $this->tabs = array('entity:-tabname); to remove a tab |
143
|
|
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'user'); |
144
|
|
|
|
145
|
|
|
if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) |
146
|
|
|
|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))) |
147
|
|
|
{ |
148
|
|
|
// Bank |
149
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id; |
150
|
|
|
$head[$h][1] = $langs->trans("HRAndBank"); |
151
|
|
|
$head[$h][2] = 'bank'; |
152
|
|
|
$h++; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
// Such info on users is visible only by internal user |
156
|
|
|
if (empty($user->societe_id)) |
157
|
|
|
{ |
158
|
|
|
// Notes |
159
|
|
|
$nbNote = 0; |
160
|
|
|
if(!empty($object->note)) $nbNote++; |
161
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; |
162
|
|
|
$head[$h][1] = $langs->trans("Note"); |
163
|
|
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
164
|
|
|
$head[$h][2] = 'note'; |
165
|
|
|
$h++; |
166
|
|
|
|
167
|
|
|
// Attached files |
168
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
169
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
170
|
|
|
$upload_dir = $conf->user->dir_output . "/" . $object->id; |
171
|
|
|
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
172
|
|
|
$nbLinks=Link::count($db, $object->element, $object->id); |
173
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id; |
174
|
|
|
$head[$h][1] = $langs->trans("Documents"); |
175
|
|
|
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
176
|
|
|
$head[$h][2] = 'document'; |
177
|
|
|
$h++; |
178
|
|
|
|
179
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id; |
180
|
|
|
$head[$h][1] = $langs->trans("Info"); |
181
|
|
|
$head[$h][2] = 'info'; |
182
|
|
|
$h++; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove'); |
186
|
|
|
|
187
|
|
|
return $head; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Prepare array with list of tabs |
192
|
|
|
* |
193
|
|
|
* @param Group $object Object group |
194
|
|
|
* @return array Array of tabs |
195
|
|
|
*/ |
196
|
|
|
function group_prepare_head($object) |
197
|
|
|
{ |
198
|
|
|
global $langs, $conf, $user; |
199
|
|
|
|
200
|
|
|
$canreadperms=true; |
201
|
|
|
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) |
202
|
|
|
{ |
203
|
|
|
$canreadperms=($user->admin || $user->rights->user->group_advance->readperms); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
$h = 0; |
207
|
|
|
$head = array(); |
208
|
|
|
|
209
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id; |
210
|
|
|
$head[$h][1] = $langs->trans("GroupCard"); |
211
|
|
|
$head[$h][2] = 'group'; |
212
|
|
|
$h++; |
213
|
|
|
|
214
|
|
|
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
215
|
|
|
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
216
|
|
|
{ |
217
|
|
|
$langs->load("ldap"); |
218
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id; |
219
|
|
|
$head[$h][1] = $langs->trans("LDAPCard"); |
220
|
|
|
$head[$h][2] = 'ldap'; |
221
|
|
|
$h++; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
if ($canreadperms) |
225
|
|
|
{ |
226
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id; |
227
|
|
|
$head[$h][1] = $langs->trans("GroupRights"); |
228
|
|
|
$head[$h][2] = 'rights'; |
229
|
|
|
$h++; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
// Show more tabs from modules |
233
|
|
|
// Entries must be declared in modules descriptor with line |
234
|
|
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
235
|
|
|
// $this->tabs = array('entity:-tabname); to remove a tab |
236
|
|
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'group'); |
237
|
|
|
|
238
|
|
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove'); |
239
|
|
|
|
240
|
|
|
return $head; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* Prepare array with list of tabs |
245
|
|
|
* |
246
|
|
|
* @return array Array of tabs to show |
247
|
|
|
*/ |
248
|
|
|
function user_admin_prepare_head() |
249
|
|
|
{ |
250
|
|
|
global $langs, $conf, $user; |
251
|
|
|
|
252
|
|
|
$langs->load("users"); |
253
|
|
|
$h=0; |
254
|
|
|
|
255
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/admin/user.php'; |
|
|
|
|
256
|
|
|
$head[$h][1] = $langs->trans("Parameters"); |
257
|
|
|
$head[$h][2] = 'card'; |
258
|
|
|
$h++; |
259
|
|
|
|
260
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php'; |
261
|
|
|
$head[$h][1] = $langs->trans("Group"); |
262
|
|
|
$head[$h][2] = 'usergroupcard'; |
263
|
|
|
$h++; |
264
|
|
|
|
265
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php'; |
266
|
|
|
$head[$h][1] = $langs->trans("ExtraFields"); |
267
|
|
|
$head[$h][2] = 'attributes'; |
268
|
|
|
$h++; |
269
|
|
|
|
270
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php'; |
271
|
|
|
$head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups"); |
272
|
|
|
$head[$h][2] = 'attributes_group'; |
273
|
|
|
$h++; |
274
|
|
|
|
275
|
|
|
// Show more tabs from modules |
276
|
|
|
// Entries must be declared in modules descriptor with line |
277
|
|
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
278
|
|
|
// $this->tabs = array('entity:-tabname); to remove a tab |
279
|
|
|
complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin'); |
280
|
|
|
|
281
|
|
|
complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin','remove'); |
282
|
|
|
|
283
|
|
|
return $head; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* Show list of themes. Show all thumbs of themes |
288
|
|
|
* |
289
|
|
|
* @param User|null $fuser User concerned or null for global theme |
290
|
|
|
* @param int $edit 1 to add edit form |
291
|
|
|
* @param boolean $foruserprofile Show for user profile view |
292
|
|
|
* @return void |
293
|
|
|
*/ |
294
|
|
|
function show_theme($fuser,$edit=0,$foruserprofile=false) |
295
|
|
|
{ |
296
|
|
|
global $conf,$langs,$db,$form; |
297
|
|
|
global $bc; |
298
|
|
|
|
299
|
|
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; |
300
|
|
|
|
301
|
|
|
$formother = new FormOther($db); |
302
|
|
|
|
303
|
|
|
$dirthemes=array('/theme'); |
304
|
|
|
if (! empty($conf->modules_parts['theme'])) // Using this feature slow down application |
305
|
|
|
{ |
306
|
|
|
foreach($conf->modules_parts['theme'] as $reldir) |
307
|
|
|
{ |
308
|
|
|
$dirthemes=array_merge($dirthemes,(array) ($reldir.'theme')); |
309
|
|
|
} |
310
|
|
|
} |
311
|
|
|
$dirthemes=array_unique($dirthemes); |
312
|
|
|
// Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme') |
313
|
|
|
|
314
|
|
|
$selected_theme=''; |
315
|
|
|
if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME; |
316
|
|
|
else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:''); |
317
|
|
|
|
318
|
|
|
$hoverdisabled=''; |
319
|
|
|
if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0'); |
320
|
|
|
else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):''); |
321
|
|
|
|
322
|
|
|
$colspan=2; |
323
|
|
|
if ($foruserprofile) $colspan=4; |
324
|
|
|
|
325
|
|
|
$thumbsbyrow=6; |
326
|
|
|
print '<table class="noborder" width="100%">'; |
327
|
|
|
|
328
|
|
|
// Title |
329
|
|
|
if ($foruserprofile) |
330
|
|
|
{ |
331
|
|
|
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>'; |
332
|
|
|
print '<th colspan="2"> </th>'; |
333
|
|
|
print '</tr>'; |
334
|
|
|
|
335
|
|
|
print '<tr>'; |
336
|
|
|
print '<td>'.$langs->trans("DefaultSkin").'</td>'; |
337
|
|
|
print '<td>'.$conf->global->MAIN_THEME.'</td>'; |
338
|
|
|
print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>'; |
339
|
|
|
print '<td> </td>'; |
340
|
|
|
print '</tr>'; |
341
|
|
|
} |
342
|
|
|
else |
343
|
|
|
{ |
344
|
|
|
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>'; |
345
|
|
|
print '<th align="right">'; |
346
|
|
|
$url='https://www.dolistore.com/lang-en/4-skins'; |
347
|
|
|
if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes'; |
348
|
|
|
//if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes'; |
349
|
|
|
print '<a href="'.$url.'" target="_blank">'; |
350
|
|
|
print $langs->trans('DownloadMoreSkins'); |
351
|
|
|
print '</a>'; |
352
|
|
|
print '</th></tr>'; |
353
|
|
|
|
354
|
|
|
print '<tr>'; |
355
|
|
|
print '<td>'.$langs->trans("ThemeDir").'</td>'; |
356
|
|
|
print '<td>'; |
357
|
|
|
foreach($dirthemes as $dirtheme) |
358
|
|
|
{ |
359
|
|
|
echo '"'.$dirtheme.'" '; |
360
|
|
|
} |
361
|
|
|
print '</td>'; |
362
|
|
|
print '</tr>'; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
print '<tr><td colspan="'.$colspan.'">'; |
366
|
|
|
|
367
|
|
|
print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">'; |
368
|
|
|
|
369
|
|
|
$i=0; |
370
|
|
|
foreach($dirthemes as $dir) |
371
|
|
|
{ |
372
|
|
|
//print $dirroot.$dir;exit; |
373
|
|
|
$dirtheme=dol_buildpath($dir,0); // This include loop on $conf->file->dol_document_root |
374
|
|
|
$urltheme=dol_buildpath($dir,1); |
375
|
|
|
|
376
|
|
|
if (is_dir($dirtheme)) |
377
|
|
|
{ |
378
|
|
|
$handle=opendir($dirtheme); |
379
|
|
|
if (is_resource($handle)) |
380
|
|
|
{ |
381
|
|
|
while (($subdir = readdir($handle))!==false) |
382
|
|
|
{ |
383
|
|
|
if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.' |
384
|
|
|
&& substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir)) |
385
|
|
|
{ |
386
|
|
|
// Disable not stable themes (dir ends with _exp or _dev) |
387
|
|
|
if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue; |
388
|
|
|
if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue; |
389
|
|
|
|
390
|
|
|
print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">'; |
391
|
|
|
$file=$dirtheme."/".$subdir."/thumb.png"; |
392
|
|
|
$url=$urltheme."/".$subdir."/thumb.png"; |
393
|
|
|
if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png'; |
394
|
|
|
print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">'; |
395
|
|
|
if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive"); |
396
|
|
|
else $title=$langs->trans("ShowPreview"); |
397
|
|
|
print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">'; |
398
|
|
|
print '</a><br>'; |
399
|
|
|
if ($subdir == $selected_theme) |
400
|
|
|
{ |
401
|
|
|
print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>'; |
402
|
|
|
} |
403
|
|
|
else |
404
|
|
|
{ |
405
|
|
|
print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir; |
406
|
|
|
} |
407
|
|
|
print '</div>'; |
408
|
|
|
|
409
|
|
|
$i++; |
410
|
|
|
} |
411
|
|
|
} |
412
|
|
|
} |
413
|
|
|
} |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
print '</div></td></tr></table>'; |
417
|
|
|
|
418
|
|
|
print '</td></tr>'; |
419
|
|
|
|
420
|
|
|
// TopMenuDisableImages |
421
|
|
|
if ($foruserprofile) |
422
|
|
|
{ |
423
|
|
|
/* |
424
|
|
|
print '<tr class="oddeven">'; |
425
|
|
|
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>'; |
426
|
|
|
print '<td>'.($conf->global->THEME_TOPMENU_DISABLE_IMAGE?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:$langs->trans("Default")).'</td>'; |
427
|
|
|
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_TOPMENU_DISABLE_IMAGE" id="check_THEME_TOPMENU_DISABLE_IMAGE" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TEXTLINK)?" checked":""); |
428
|
|
|
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo |
429
|
|
|
print '> '.$langs->trans("UsePersonalValue").'</td>'; |
430
|
|
|
print '<td>'; |
431
|
|
|
if ($edit) |
432
|
|
|
{ |
433
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),''),'THEME_TOPMENU_DISABLE_IMAGE','formcolor',1).' '; |
434
|
|
|
} |
435
|
|
|
else |
436
|
|
|
{ |
437
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),''); |
438
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
439
|
|
|
else print ''; |
440
|
|
|
} |
441
|
|
|
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
442
|
|
|
print '</td>';*/ |
443
|
|
|
} |
444
|
|
|
else |
445
|
|
|
{ |
446
|
|
|
$default=$langs->trans('No'); |
447
|
|
|
print '<tr class="oddeven">'; |
448
|
|
|
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>'; |
449
|
|
|
print '<td colspan="'.($colspan-1).'">'; |
450
|
|
|
if ($edit) |
451
|
|
|
{ |
452
|
|
|
print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1); |
453
|
|
|
} |
454
|
|
|
else |
455
|
|
|
{ |
456
|
|
|
print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE); |
457
|
|
|
} |
458
|
|
|
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
459
|
|
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
460
|
|
|
print '</td>'; |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
// Background color THEME_ELDY_BACKBODY |
464
|
|
|
if ($foruserprofile) |
465
|
|
|
{ |
466
|
|
|
/* |
467
|
|
|
print '<tr class="oddeven">'; |
468
|
|
|
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
469
|
|
|
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>'; |
470
|
|
|
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":""); |
471
|
|
|
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo |
472
|
|
|
print '> '.$langs->trans("UsePersonalValue").'</td>'; |
473
|
|
|
print '<td>'; |
474
|
|
|
if ($edit) |
475
|
|
|
{ |
476
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; |
477
|
|
|
} |
478
|
|
|
else |
479
|
|
|
{ |
480
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); |
481
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
482
|
|
|
else print ''; |
483
|
|
|
} |
484
|
|
|
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
485
|
|
|
print '</td>';*/ |
486
|
|
|
} |
487
|
|
|
else |
488
|
|
|
{ |
489
|
|
|
print '<tr class="oddeven">'; |
490
|
|
|
print '<td>'.$langs->trans("BackgroundColor").'</td>'; |
491
|
|
|
print '<td colspan="'.($colspan-1).'">'; |
492
|
|
|
//var_dump($conf->global->THEME_ELDY_BACKBODY); |
493
|
|
|
if ($edit) |
494
|
|
|
{ |
495
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' '; |
496
|
|
|
} |
497
|
|
|
else |
498
|
|
|
{ |
499
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''); |
500
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
501
|
|
|
else print $langs->trans("Default"); |
502
|
|
|
} |
503
|
|
|
print ' ('.$langs->trans("Default").': <strong>ffffff</strong>) '; |
504
|
|
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
505
|
|
|
print '</td>'; |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
// TopMenuBackgroundColor |
509
|
|
|
if ($foruserprofile) |
510
|
|
|
{ |
511
|
|
|
/* |
512
|
|
|
print '<tr class="oddeven">'; |
513
|
|
|
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
514
|
|
|
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>'; |
515
|
|
|
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":""); |
516
|
|
|
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo |
517
|
|
|
print '> '.$langs->trans("UsePersonalValue").'</td>'; |
518
|
|
|
print '<td>'; |
519
|
|
|
if ($edit) |
520
|
|
|
{ |
521
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; |
522
|
|
|
} |
523
|
|
|
else |
524
|
|
|
{ |
525
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); |
526
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
527
|
|
|
else print ''; |
528
|
|
|
} |
529
|
|
|
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
530
|
|
|
print '</td>';*/ |
531
|
|
|
} |
532
|
|
|
else |
533
|
|
|
{ |
534
|
|
|
$default='5a6482'; |
535
|
|
|
if ($conf->theme == 'md') $default='5a3278'; |
536
|
|
|
|
537
|
|
|
print '<tr class="oddeven">'; |
538
|
|
|
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
539
|
|
|
print '<td colspan="'.($colspan-1).'">'; |
540
|
|
|
if ($edit) |
541
|
|
|
{ |
542
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; |
543
|
|
|
} |
544
|
|
|
else |
545
|
|
|
{ |
546
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); |
547
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
548
|
|
|
else print $langs->trans("Default"); |
549
|
|
|
} |
550
|
|
|
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
551
|
|
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
552
|
|
|
print '</td>'; |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
// LeftMenuBackgroundColor |
556
|
|
|
if ($foruserprofile) |
557
|
|
|
{ |
558
|
|
|
/* |
559
|
|
|
print '<tr class="oddeven">'; |
560
|
|
|
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
561
|
|
|
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_VERMENU_BACK1:$langs->trans("Default")).'</td>'; |
562
|
|
|
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_VERMENU_BACK1" id="check_THEME_ELDY_VERMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":""); |
563
|
|
|
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo |
564
|
|
|
print '> '.$langs->trans("UsePersonalValue").'</td>'; |
565
|
|
|
print '<td>'; |
566
|
|
|
if ($edit) |
567
|
|
|
{ |
568
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' '; |
569
|
|
|
} |
570
|
|
|
else |
571
|
|
|
{ |
572
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''); |
573
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
574
|
|
|
else print ''; |
575
|
|
|
} |
576
|
|
|
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
577
|
|
|
print '</td>';*/ |
578
|
|
|
} |
579
|
|
|
else |
580
|
|
|
{ |
581
|
|
|
$default='ffffff'; |
582
|
|
|
if ($conf->theme == 'md') $default='ffffff'; |
583
|
|
|
|
584
|
|
|
print '<tr class="oddeven">'; |
585
|
|
|
print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>'; |
586
|
|
|
print '<td colspan="'.($colspan-1).'">'; |
587
|
|
|
if ($edit) |
588
|
|
|
{ |
589
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' '; |
590
|
|
|
} |
591
|
|
|
else |
592
|
|
|
{ |
593
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''); |
594
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
595
|
|
|
else print $langs->trans("Default"); |
596
|
|
|
} |
597
|
|
|
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
598
|
|
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
599
|
|
|
print '</td>'; |
600
|
|
|
} |
601
|
|
|
|
602
|
|
|
// BackgroundTableTitleColor |
603
|
|
|
if ($foruserprofile) |
604
|
|
|
{ |
605
|
|
|
|
606
|
|
|
|
607
|
|
|
} |
608
|
|
|
else |
609
|
|
|
{ |
610
|
|
|
print '<tr class="oddeven">'; |
611
|
|
|
print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>'; |
612
|
|
|
print '<td colspan="'.($colspan-1).'">'; |
613
|
|
|
if ($edit) |
614
|
|
|
{ |
615
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' '; |
616
|
|
|
} |
617
|
|
|
else |
618
|
|
|
{ |
619
|
|
|
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); |
620
|
|
|
} |
621
|
|
|
print ' ('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS |
622
|
|
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
623
|
|
|
print '</td>'; |
624
|
|
|
|
625
|
|
|
print '</tr>'; |
626
|
|
|
} |
627
|
|
|
|
628
|
|
|
// BackgroundTableLineOddColor |
629
|
|
|
if ($foruserprofile) |
630
|
|
|
{ |
631
|
|
|
|
632
|
|
|
} |
633
|
|
|
else |
634
|
|
|
{ |
635
|
|
|
$default='ffffff'; |
636
|
|
|
if ($conf->theme == 'md') $default='ffffff'; |
637
|
|
|
|
638
|
|
|
print '<tr class="oddeven">'; |
639
|
|
|
print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>'; |
640
|
|
|
print '<td colspan="'.($colspan-1).'">'; |
641
|
|
|
if ($edit) |
642
|
|
|
{ |
643
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' '; |
644
|
|
|
} |
645
|
|
|
else |
646
|
|
|
{ |
647
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''); |
648
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
649
|
|
|
else print $langs->trans("Default"); |
650
|
|
|
} |
651
|
|
|
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
652
|
|
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
653
|
|
|
print '</td>'; |
654
|
|
|
} |
655
|
|
|
|
656
|
|
|
// BackgroundTableLineEvenColor |
657
|
|
|
if ($foruserprofile) |
658
|
|
|
{ |
659
|
|
|
|
660
|
|
|
} |
661
|
|
|
else |
662
|
|
|
{ |
663
|
|
|
$default='f8f8f8'; |
664
|
|
|
if ($conf->theme == 'md') $default='f8f8f8'; |
665
|
|
|
|
666
|
|
|
print '<tr class="oddeven">'; |
667
|
|
|
print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>'; |
668
|
|
|
print '<td colspan="'.($colspan-1).'">'; |
669
|
|
|
if ($edit) |
670
|
|
|
{ |
671
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' '; |
672
|
|
|
} |
673
|
|
|
else |
674
|
|
|
{ |
675
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''); |
676
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
677
|
|
|
else print $langs->trans("Default"); |
678
|
|
|
} |
679
|
|
|
print ' ('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
680
|
|
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
681
|
|
|
print '</td>'; |
682
|
|
|
} |
683
|
|
|
|
684
|
|
|
// TextTitleColor |
685
|
|
|
if ($foruserprofile) |
686
|
|
|
{ |
687
|
|
|
|
688
|
|
|
|
689
|
|
|
} |
690
|
|
|
else |
691
|
|
|
{ |
692
|
|
|
print '<tr class="oddeven">'; |
693
|
|
|
print '<td>'.$langs->trans("TextTitleColor").'</td>'; |
694
|
|
|
print '<td colspan="'.($colspan-1).'">'; |
695
|
|
|
if ($edit) |
696
|
|
|
{ |
697
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' '; |
698
|
|
|
} |
699
|
|
|
else |
700
|
|
|
{ |
701
|
|
|
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); |
702
|
|
|
} |
703
|
|
|
print ' ('.$langs->trans("Default").': <strong><span style="color: #3c3c14">3c3c14</span></strong>) '; |
704
|
|
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
705
|
|
|
|
706
|
|
|
print '</td>'; |
707
|
|
|
|
708
|
|
|
print '</tr>'; |
709
|
|
|
} |
710
|
|
|
|
711
|
|
|
// Text LinkColor |
712
|
|
|
if ($foruserprofile) |
713
|
|
|
{ |
714
|
|
|
/* |
715
|
|
|
print '<tr class="oddeven">'; |
716
|
|
|
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
717
|
|
|
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTLINK:$langs->trans("Default")).'</td>'; |
718
|
|
|
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TEXTLINK" id="check_THEME_ELDY_TEXTLINK" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TEXTLINK)?" checked":""); |
719
|
|
|
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo |
720
|
|
|
print '> '.$langs->trans("UsePersonalValue").'</td>'; |
721
|
|
|
print '<td>'; |
722
|
|
|
if ($edit) |
723
|
|
|
{ |
724
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' '; |
725
|
|
|
} |
726
|
|
|
else |
727
|
|
|
{ |
728
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); |
729
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
730
|
|
|
else print ''; |
731
|
|
|
} |
732
|
|
|
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
733
|
|
|
print '</td>';*/ |
734
|
|
|
} |
735
|
|
|
else |
736
|
|
|
{ |
737
|
|
|
print '<tr class="oddeven">'; |
738
|
|
|
print '<td>'.$langs->trans("LinkColor").'</td>'; |
739
|
|
|
print '<td colspan="'.($colspan-1).'">'; |
740
|
|
|
if ($edit) |
741
|
|
|
{ |
742
|
|
|
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' '; |
743
|
|
|
} |
744
|
|
|
else |
745
|
|
|
{ |
746
|
|
|
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); |
747
|
|
|
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
748
|
|
|
else |
749
|
|
|
{ |
750
|
|
|
//print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">'; |
751
|
|
|
//print '<span style="color: #000078">'.$langs->trans("Default").'</span>'; |
752
|
|
|
print $langs->trans("Default"); |
753
|
|
|
} |
754
|
|
|
} |
755
|
|
|
print ' ('.$langs->trans("Default").': <strong><span style="color: #000078">000078</span></strong>) '; |
756
|
|
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
757
|
|
|
print '</td>'; |
758
|
|
|
} |
759
|
|
|
|
760
|
|
|
// Use Hover |
761
|
|
|
if ($foruserprofile) |
762
|
|
|
{ |
763
|
|
|
/* Must first change option to choose color of highlight instead of yes or no. |
764
|
|
|
print '<tr class="oddeven">'; |
765
|
|
|
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>'; |
766
|
|
|
print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>'; |
767
|
|
|
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>'; |
768
|
|
|
print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>'; |
769
|
|
|
print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
770
|
|
|
print '</td>'; |
771
|
|
|
print '</tr>'; |
772
|
|
|
*/ |
773
|
|
|
} |
774
|
|
|
else |
775
|
|
|
{ |
776
|
|
|
print '<tr class="oddeven">'; |
777
|
|
|
print '<td>'.$langs->trans("HighlightLinesColor").'</td>'; |
778
|
|
|
print '<td colspan="'.($colspan-1).'">'; |
779
|
|
|
//print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>'; |
780
|
|
|
//print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
781
|
|
|
if ($edit) |
782
|
|
|
{ |
783
|
|
|
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb'; |
784
|
|
|
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
785
|
|
|
print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' '; |
786
|
|
|
} |
787
|
|
|
else |
788
|
|
|
{ |
789
|
|
|
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb'; |
790
|
|
|
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
791
|
|
|
if ($color) |
792
|
|
|
{ |
793
|
|
|
if ($color != 'edf4fb') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
794
|
|
|
else print $langs->trans("Default"); |
795
|
|
|
} |
796
|
|
|
else print $langs->trans("None"); |
797
|
|
|
} |
798
|
|
|
print ' ('.$langs->trans("Default").': <strong>edf4fb</strong>) '; |
799
|
|
|
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
800
|
|
|
print '</td>'; |
801
|
|
|
print '</tr>'; |
802
|
|
|
} |
803
|
|
|
|
804
|
|
|
print '</table>'; |
805
|
|
|
} |
806
|
|
|
|
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.
Let’s take a look at an example:
As you can see in this example, the array
$myArray
is initialized the first time when the foreach loop is entered. You can also see that the value of thebar
key is only written conditionally; thus, its value might result from a previous iteration.This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.