dolibarr  7.0.0-beta
usergroups.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2010-2017 Regis Houssin <regis.houssin@capnetworks.com>
4  * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
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 
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  if ($canreadperms)
64  {
65  $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
66  $head[$h][1] = $langs->trans("Rights"). ' <span class="badge">'.($object->nb_rights).'</span>';
67  $head[$h][2] = 'rights';
68  $h++;
69  }
70 
71  $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
72  $head[$h][1] = $langs->trans("UserGUISetup");
73  $head[$h][2] = 'guisetup';
74  $h++;
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 
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"). ' <span class="badge">'.($object->nb_rights).'</span>';
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 
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 
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">&nbsp;</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>&nbsp;</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 ' &nbsp; ('.$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 ' &nbsp; ('.$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 ' &nbsp; ('.$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='f0f0f0';
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 ' &nbsp; ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
598  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
599  print '</td>';
600  }
601 
602  // TextTitleColor
603  if ($foruserprofile)
604  {
605 
606 
607  }
608  else
609  {
610  print '<tr class="oddeven">';
611  print '<td>'.$langs->trans("TextTitleColor").'</td>';
612  print '<td colspan="'.($colspan-1).'">';
613  if ($edit)
614  {
615  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' ';
616  }
617  else
618  {
619  print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
620  }
621  print ' &nbsp; ('.$langs->trans("Default").': <strong><span style="color: #643c14">643c14</span></strong>) ';
622  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
623 
624  print '</td>';
625 
626  print '</tr>';
627  }
628 
629  // BackgroundTableTitleColor
630  if ($foruserprofile)
631  {
632 
633 
634  }
635  else
636  {
637  print '<tr class="oddeven">';
638  print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
639  print '<td colspan="'.($colspan-1).'">';
640  if ($edit)
641  {
642  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' ';
643  }
644  else
645  {
646  print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
647  }
648  print ' &nbsp; ('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS
649  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
650  print '</td>';
651 
652  print '</tr>';
653  }
654 
655  // BackgroundTableLineOddColor
656  if ($foruserprofile)
657  {
658 
659  }
660  else
661  {
662  $default='ffffff';
663  if ($conf->theme == 'md') $default='ffffff';
664 
665  print '<tr class="oddeven">';
666  print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
667  print '<td colspan="'.($colspan-1).'">';
668  if ($edit)
669  {
670  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' ';
671  }
672  else
673  {
674  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),'');
675  if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
676  else print $langs->trans("Default");
677  }
678  print ' &nbsp; ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
679  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
680  print '</td>';
681  }
682 
683  // BackgroundTableLineEvenColor
684  if ($foruserprofile)
685  {
686 
687  }
688  else
689  {
690  $default='f8f8f8';
691  if ($conf->theme == 'md') $default='f8f8f8';
692 
693  print '<tr class="oddeven">';
694  print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
695  print '<td colspan="'.($colspan-1).'">';
696  if ($edit)
697  {
698  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' ';
699  }
700  else
701  {
702  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),'');
703  if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
704  else print $langs->trans("Default");
705  }
706  print ' &nbsp; ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
707  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
708  print '</td>';
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 ' &nbsp; ('.$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 ' &nbsp; ('.$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 ' &nbsp; ('.$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 ' &nbsp; ('.$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 }
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
user_prepare_head($object)
Prepare array with list of tabs.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add')
Complete or removed entries into a head array (used to build tabs).
show_theme($fuser, $edit=0, $foruserprofile=false)
Show list of themes.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
if(empty($reshook)) $form
View.
Definition: perms.php:103
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,255).
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="")
Scan a directory and return a list of files/directories.
Definition: files.lib.php:58
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
Classe permettant la generation de composants html autre Only common components are here...
group_prepare_head($object)
Prepare array with list of tabs.
print
Draft customers invoices.
Definition: index.php:91
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->societe->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1013
colorArrayToHex($arraycolor, $colorifnotfound='888888')
Convert an array with RGB value into hex RGB value.
user_admin_prepare_head()
Prepare array with list of tabs.