dolibarr  9.0.0
usergroups.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2010-2017 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
5  * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  * or see http://www.gnu.org/
20  */
21 
22 
34 function user_prepare_head($object)
35 {
36  global $langs, $conf, $user, $db;
37 
38  $langs->load("users");
39 
40  $canreadperms=true;
41  if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
42  {
43  $canreadperms=($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms));
44  }
45 
46  $h = 0;
47  $head = array();
48 
49  $head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id;
50  $head[$h][1] = $langs->trans("UserCard");
51  $head[$h][2] = 'user';
52  $h++;
53 
54  if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
55  && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
56  {
57  $langs->load("ldap");
58  $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id;
59  $head[$h][1] = $langs->trans("LDAPCard");
60  $head[$h][2] = 'ldap';
61  $h++;
62  }
63 
64  if ($canreadperms)
65  {
66  $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
67  $head[$h][1] = $langs->trans("Rights"). ' <span class="badge">'.($object->nb_rights).'</span>';
68  $head[$h][2] = 'rights';
69  $h++;
70  }
71 
72  $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
73  $head[$h][1] = $langs->trans("UserGUISetup");
74  $head[$h][2] = 'guisetup';
75  $h++;
76 
77  if (! empty($conf->agenda->enabled))
78  {
79  if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
80  $MAXAGENDA=$conf->global->AGENDA_EXT_NB;
81 
82  $i=1;
83  $nbagenda = 0;
84  while ($i <= $MAXAGENDA)
85  {
86  $key=$i;
87  $name='AGENDA_EXT_NAME_'.$object->id.'_'.$key;
88  $src='AGENDA_EXT_SRC_'.$object->id.'_'.$key;
89  $offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
90  $color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
91  $i++;
92 
93  if (! empty($object->conf->$name)) $nbagenda++;
94  }
95 
96  $head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
97  $head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' <span class="badge">'.$nbagenda.'</span>' : '');
98  $head[$h][2] = 'extsites';
99  $h++;
100  }
101 
102  if (! empty($conf->clicktodial->enabled))
103  {
104  $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
105  $head[$h][1] = $langs->trans("ClickToDial");
106  $head[$h][2] = 'clicktodial';
107  $h++;
108  }
109 
110  // Notifications
111  if ($user->societe_id == 0 && ! empty($conf->notification->enabled))
112  {
113  $nbNote = 0;
114  $sql = "SELECT COUNT(n.rowid) as nb";
115  $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
116  $sql.= " WHERE fk_user = ".$object->id;
117  $resql=$db->query($sql);
118  if ($resql)
119  {
120  $num = $db->num_rows($resql);
121  $i = 0;
122  while ($i < $num)
123  {
124  $obj = $db->fetch_object($resql);
125  $nbNote=$obj->nb;
126  $i++;
127  }
128  }
129  else {
130  dol_print_error($db);
131  }
132 
133  $head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id;
134  $head[$h][1] = $langs->trans("Notifications");
135  if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
136  $head[$h][2] = 'notify';
137  $h++;
138  }
139 
140  // Show more tabs from modules
141  // Entries must be declared in modules descriptor with line
142  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
143  // $this->tabs = array('entity:-tabname); to remove a tab
144  complete_head_from_modules($conf,$langs,$object,$head,$h,'user');
145 
146  if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
147  || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))
148  || (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id)
149  || (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id )
150  )
151  {
152  // Bank
153  $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;
154  $head[$h][1] = $langs->trans("HRAndBank");
155  $head[$h][2] = 'bank';
156  $h++;
157  }
158 
159  // Such info on users is visible only by internal user
160  if (empty($user->societe_id))
161  {
162  // Notes
163  $nbNote = 0;
164  if(!empty($object->note)) $nbNote++;
165  $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
166  $head[$h][1] = $langs->trans("Note");
167  if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
168  $head[$h][2] = 'note';
169  $h++;
170 
171  // Attached files
172  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
173  require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
174  $upload_dir = $conf->user->dir_output . "/" . $object->id;
175  $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
176  $nbLinks=Link::count($db, $object->element, $object->id);
177  $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
178  $head[$h][1] = $langs->trans("Documents");
179  if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
180  $head[$h][2] = 'document';
181  $h++;
182 
183  $head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id;
184  $head[$h][1] = $langs->trans("Info");
185  $head[$h][2] = 'info';
186  $h++;
187  }
188 
189  complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove');
190 
191  return $head;
192 }
193 
200 function group_prepare_head($object)
201 {
202  global $langs, $conf, $user;
203 
204  $canreadperms=true;
205  if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
206  {
207  $canreadperms=($user->admin || $user->rights->user->group_advance->readperms);
208  }
209 
210  $h = 0;
211  $head = array();
212 
213  $head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id;
214  $head[$h][1] = $langs->trans("GroupCard");
215  $head[$h][2] = 'group';
216  $h++;
217 
218  if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE))
219  && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
220  {
221  $langs->load("ldap");
222  $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id;
223  $head[$h][1] = $langs->trans("LDAPCard");
224  $head[$h][2] = 'ldap';
225  $h++;
226  }
227 
228  if ($canreadperms)
229  {
230  $head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id;
231  $head[$h][1] = $langs->trans("GroupRights"). ' <span class="badge">'.($object->nb_rights).'</span>';
232  $head[$h][2] = 'rights';
233  $h++;
234  }
235 
236  // Show more tabs from modules
237  // Entries must be declared in modules descriptor with line
238  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
239  // $this->tabs = array('entity:-tabname); to remove a tab
240  complete_head_from_modules($conf,$langs,$object,$head,$h,'group');
241 
242  complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove');
243 
244  return $head;
245 }
246 
253 {
254  global $langs, $conf, $user;
255 
256  $langs->load("users");
257  $h=0;
258 
259  $head[$h][0] = DOL_URL_ROOT.'/admin/user.php';
260  $head[$h][1] = $langs->trans("Parameters");
261  $head[$h][2] = 'card';
262  $h++;
263 
264  $head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php';
265  $head[$h][1] = $langs->trans("Group");
266  $head[$h][2] = 'usergroupcard';
267  $h++;
268 
269  $head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
270  $head[$h][1] = $langs->trans("ExtraFields");
271  $head[$h][2] = 'attributes';
272  $h++;
273 
274  $head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
275  $head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups");
276  $head[$h][2] = 'attributes_group';
277  $h++;
278 
279  // Show more tabs from modules
280  // Entries must be declared in modules descriptor with line
281  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
282  // $this->tabs = array('entity:-tabname); to remove a tab
283  complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin');
284 
285  complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin','remove');
286 
287  return $head;
288 }
289 
298 function show_theme($fuser,$edit=0,$foruserprofile=false)
299 {
300  global $conf,$langs,$db,$form;
301  global $bc;
302 
303  require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
304 
305  $formother = new FormOther($db);
306 
307  $dirthemes=array('/theme');
308  if (! empty($conf->modules_parts['theme'])) // Using this feature slow down application
309  {
310  foreach($conf->modules_parts['theme'] as $reldir)
311  {
312  $dirthemes=array_merge($dirthemes,(array) ($reldir.'theme'));
313  }
314  }
315  $dirthemes=array_unique($dirthemes);
316  // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
317 
318  $selected_theme='';
319  if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME;
320  else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:'');
321 
322  $hoverdisabled='';
323  if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
324  else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):'');
325 
326  $checkeddisabled='';
327  if (empty($foruserprofile)) $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0');
328  else $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):'');
329 
330  $colspan=2;
331  if ($foruserprofile) $colspan=4;
332 
333  $thumbsbyrow=6;
334  print '<table class="noborder" width="100%">';
335 
336  // Title
337  if ($foruserprofile)
338  {
339  print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>';
340  print '<th colspan="2">&nbsp;</th>';
341  print '</tr>';
342 
343  print '<tr>';
344  print '<td>'.$langs->trans("DefaultSkin").'</td>';
345  print '<td>'.$conf->global->MAIN_THEME.'</td>';
346  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>';
347  print '<td>&nbsp;</td>';
348  print '</tr>';
349  }
350  else
351  {
352  print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>';
353  print '<th align="right">';
354  $url='https://www.dolistore.com/lang-en/4-skins';
355  if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes';
356  //if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes';
357  print '<a href="'.$url.'" target="_blank">';
358  print $langs->trans('DownloadMoreSkins');
359  print '</a>';
360  print '</th></tr>';
361 
362  print '<tr>';
363  print '<td>'.$langs->trans("ThemeDir").'</td>';
364  print '<td>';
365  foreach($dirthemes as $dirtheme)
366  {
367  echo '"'.$dirtheme.'" ';
368  }
369  print '</td>';
370  print '</tr>';
371  }
372 
373  print '<tr><td colspan="'.$colspan.'">';
374 
375  print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">';
376 
377  $i=0;
378  foreach($dirthemes as $dir)
379  {
380  //print $dirroot.$dir;exit;
381  $dirtheme=dol_buildpath($dir,0); // This include loop on $conf->file->dol_document_root
382  $urltheme=dol_buildpath($dir,1);
383 
384  if (is_dir($dirtheme))
385  {
386  $handle=opendir($dirtheme);
387  if (is_resource($handle))
388  {
389  while (($subdir = readdir($handle))!==false)
390  {
391  if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
392  && substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir))
393  {
394  // Disable not stable themes (dir ends with _exp or _dev)
395  if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue;
396  if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue;
397 
398  print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
399  $file=$dirtheme."/".$subdir."/thumb.png";
400  $url=$urltheme."/".$subdir."/thumb.png";
401  if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png';
402  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").'">';
403  if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
404  else $title=$langs->trans("ShowPreview");
405  print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
406  print '</a><br>';
407  if ($subdir == $selected_theme)
408  {
409  print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
410  }
411  else
412  {
413  print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
414  }
415  print '</div>';
416 
417  $i++;
418  }
419  }
420  }
421  }
422  }
423 
424  print '</div></td></tr></table>';
425 
426  print '</td></tr>';
427 
428  // TopMenuDisableImages
429  if ($foruserprofile)
430  {
431  /*
432  print '<tr class="oddeven">';
433  print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
434  print '<td>'.($conf->global->THEME_TOPMENU_DISABLE_IMAGE?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:$langs->trans("Default")).'</td>';
435  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":"");
436  print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
437  print '> '.$langs->trans("UsePersonalValue").'</td>';
438  print '<td>';
439  if ($edit)
440  {
441  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),''),'THEME_TOPMENU_DISABLE_IMAGE','formcolor',1).' ';
442  }
443  else
444  {
445  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),'');
446  if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
447  else print '';
448  }
449  if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
450  print '</td>';*/
451  }
452  else
453  {
454  $default=$langs->trans('No');
455  print '<tr class="oddeven">';
456  print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
457  print '<td colspan="'.($colspan-1).'">';
458  if ($edit)
459  {
460  print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1);
461  }
462  else
463  {
464  print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);
465  }
466  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
467  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
468  print '</span>';
469  print '</td>';
470  print '</tr>';
471  }
472 
473  // Background color THEME_ELDY_BACKBODY
474  if ($foruserprofile)
475  {
476  /*
477  print '<tr class="oddeven">';
478  print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
479  print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
480  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":"");
481  print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
482  print '> '.$langs->trans("UsePersonalValue").'</td>';
483  print '<td>';
484  if ($edit)
485  {
486  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
487  }
488  else
489  {
490  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
491  if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
492  else print '';
493  }
494  if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
495  print '</td>';*/
496  }
497  else
498  {
499  print '<tr class="oddeven">';
500  print '<td>'.$langs->trans("BackgroundColor").'</td>';
501  print '<td colspan="'.($colspan-1).'">';
502  //var_dump($conf->global->THEME_ELDY_BACKBODY);
503  if ($edit)
504  {
505  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' ';
506  }
507  else
508  {
509  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),'');
510  if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
511  else print $langs->trans("Default");
512  }
513  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>ffffff</strong>) ';
514  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
515  print '</span>';
516  print '</td>';
517  print '</tr>';
518  }
519 
520  // TopMenuBackgroundColor
521  if ($foruserprofile)
522  {
523  /*
524  print '<tr class="oddeven">';
525  print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
526  print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
527  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":"");
528  print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
529  print '> '.$langs->trans("UsePersonalValue").'</td>';
530  print '<td>';
531  if ($edit)
532  {
533  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
534  }
535  else
536  {
537  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
538  if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
539  else print '';
540  }
541  if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
542  print '</td>';*/
543  }
544  else
545  {
546  $default='5a6482';
547  if ($conf->theme == 'md') $default='5a3278';
548 
549  print '<tr class="oddeven">';
550  print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
551  print '<td colspan="'.($colspan-1).'">';
552  if ($edit)
553  {
554  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
555  }
556  else
557  {
558  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
559  if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
560  else print $langs->trans("Default");
561  }
562  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
563  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
564  print '</span>';
565  print '</td>';
566  print '</tr>';
567  }
568 
569  // LeftMenuBackgroundColor
570  if ($foruserprofile)
571  {
572  /*
573  print '<tr class="oddeven">';
574  print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
575  print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_VERMENU_BACK1:$langs->trans("Default")).'</td>';
576  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":"");
577  print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
578  print '> '.$langs->trans("UsePersonalValue").'</td>';
579  print '<td>';
580  if ($edit)
581  {
582  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' ';
583  }
584  else
585  {
586  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),'');
587  if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
588  else print '';
589  }
590  if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
591  print '</td>';*/
592  }
593  else
594  {
595  $default='f0f0f0';
596  if ($conf->theme == 'md') $default='ffffff';
597 
598  print '<tr class="oddeven">';
599  print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
600  print '<td colspan="'.($colspan-1).'">';
601  if ($edit)
602  {
603  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' ';
604  }
605  else
606  {
607  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),'');
608  if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
609  else print $langs->trans("Default");
610  }
611  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
612  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
613  print '</span>';
614  print '</td>';
615  print '</tr>';
616  }
617 
618  // TextTitleColor for title of Pages
619  if ($foruserprofile)
620  {
621 
622 
623  }
624  else
625  {
626  print '<tr class="oddeven">';
627  print '<td>'.$langs->trans("TextTitleColor").'</td>';
628  print '<td colspan="'.($colspan-1).'">';
629  if ($edit)
630  {
631  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' ';
632  }
633  else
634  {
635  print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
636  }
637  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #643c14">643c14</span></strong>) ';
638  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
639  print '</span>';
640  print '</td>';
641 
642  print '</tr>';
643  }
644 
645  // BackgroundTableTitleColor
646  if ($foruserprofile)
647  {
648 
649 
650  }
651  else
652  {
653  print '<tr class="oddeven">';
654  print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
655  print '<td colspan="'.($colspan-1).'">';
656  if ($edit)
657  {
658  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' ';
659  }
660  else
661  {
662  print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
663  }
664  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS
665  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
666  print '</span>';
667  print '</td>';
668 
669  print '</tr>';
670  }
671 
672  // TextTitleColor
673  if ($foruserprofile)
674  {
675 
676 
677  }
678  else
679  {
680  print '<tr class="oddeven">';
681  print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
682  print '<td colspan="'.($colspan-1).'">';
683  if ($edit)
684  {
685  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE,array()),''),'THEME_ELDY_TEXTTITLE','formcolor',1).' ';
686  }
687  else
688  {
689  print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
690  }
691  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000000">000000</span></strong>) ';
692  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
693  print '</span>';
694  print '</td>';
695 
696  print '</tr>';
697  }
698 
699  // BackgroundTableLineOddColor
700  if ($foruserprofile)
701  {
702 
703  }
704  else
705  {
706  $default='ffffff';
707  if ($conf->theme == 'md') $default='ffffff';
708 
709  print '<tr class="oddeven">';
710  print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
711  print '<td colspan="'.($colspan-1).'">';
712  if ($edit)
713  {
714  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' ';
715  }
716  else
717  {
718  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),'');
719  if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
720  else print $langs->trans("Default");
721  }
722  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
723  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
724  print '</span>';
725  print '</td>';
726  print '</tr>';
727  }
728 
729  // BackgroundTableLineEvenColor
730  if ($foruserprofile)
731  {
732 
733  }
734  else
735  {
736  $default='f8f8f8';
737  if ($conf->theme == 'md') $default='f8f8f8';
738 
739  print '<tr class="oddeven">';
740  print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
741  print '<td colspan="'.($colspan-1).'">';
742  if ($edit)
743  {
744  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' ';
745  }
746  else
747  {
748  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),'');
749  if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
750  else print $langs->trans("Default");
751  }
752  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
753  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
754  print '</span>';
755  print '</td>';
756  print '</tr>';
757  }
758 
759  // Text LinkColor
760  if ($foruserprofile)
761  {
762  /*
763  print '<tr class="oddeven">';
764  print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
765  print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTLINK:$langs->trans("Default")).'</td>';
766  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":"");
767  print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
768  print '> '.$langs->trans("UsePersonalValue").'</td>';
769  print '<td>';
770  if ($edit)
771  {
772  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
773  }
774  else
775  {
776  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
777  if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
778  else print '';
779  }
780  if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
781  print '</td>';*/
782  }
783  else
784  {
785  print '<tr class="oddeven">';
786  print '<td>'.$langs->trans("LinkColor").'</td>';
787  print '<td colspan="'.($colspan-1).'">';
788  if ($edit)
789  {
790  print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
791  }
792  else
793  {
794  $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
795  if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
796  else
797  {
798  //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
799  //print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
800  print $langs->trans("Default");
801  }
802  }
803  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000078">000078</span></strong>) ';
804  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
805  print '</span>';
806  print '</td>';
807  print '</tr>';
808  }
809 
810  // Use Hover
811  if ($foruserprofile)
812  {
813  /* Must first change option to choose color of highlight instead of yes or no.
814  print '<tr class="oddeven">';
815  print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
816  print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
817  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>';
818  print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
819  print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
820  print '</td>';
821  print '</tr>';
822  */
823  }
824  else {
825  print '<tr class="oddeven">';
826  print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
827  print '<td colspan="'.($colspan-1).'">';
828  //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
829  //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
830  if ($edit)
831  {
832  if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
833  else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
834  print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' ';
835  }
836  else
837  {
838  if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
839  else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
840  if ($color)
841  {
842  if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
843  else print $langs->trans("Default");
844  }
845  else print $langs->trans("None");
846  }
847  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
848  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
849  print '</span>';
850  print '</td>';
851  }
852 
853  // Use Checked
854  if ($foruserprofile)
855  {
856  /* Must first change option to choose color of highlight instead of yes or no.
857  print '<tr class="oddeven">';
858  print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
859  print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
860  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>';
861  print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
862  print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
863  print '</td>';
864  print '</tr>';
865  */
866  }
867  else
868  {
869  print '<tr class="oddeven">';
870  print '<td>'.$langs->trans("HighlightLinesChecked").'</td>';
871  print '<td colspan="'.($colspan-1).'">';
872  //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
873  //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
874  if ($edit)
875  {
876  if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
877  else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
878  print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' ';
879  }
880  else
881  {
882  if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
883  else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
884  if ($color)
885  {
886  if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
887  else print $langs->trans("Default");
888  }
889  else print $langs->trans("None");
890  }
891  print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
892  print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
893  print '</span>';
894  print '</td>';
895  print '</tr>';
896  }
897 
898  // Use MAIN_OPTIMIZEFORTEXTBROWSER
899  if ($foruserprofile)
900  {
901  $default=$langs->trans('No');
902  print '<tr class="oddeven">';
903  print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
904  print '<td colspan="'.($colspan-1).'">';
905  if ($edit)
906  {
907  print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER, 1);
908  }
909  else
910  {
911  if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
912  {
913  print yn($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER);
914  }
915  else
916  {
917  print yn(1);
918  if (empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) print ' ('.$langs->trans("ForcedByGlobalSetup").')';
919  }
920  }
921  print ' &nbsp; ('.$langs->trans("Default").': <strong>'.yn(0).'</strong>) ';
922  print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc"));
923  print '</td>';
924  print '</tr>';
925  }
926  else
927  {
928  // TODO
929  }
930 
931  print '</table>';
932 }
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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:1053
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...
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 (&#39;FFFFFF&#39;, &#39;255,255,255&#39;) into an array RGB array(255,255,255).
Classe permettant la generation de composants html autre Only common components are here...
group_prepare_head($object)
Prepare array with list of tabs.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
Definition: files.lib.php:59
colorArrayToHex($arraycolor, $colorifnotfound='888888')
Convert an array with RGB value into hex RGB value.
user_admin_prepare_head()
Prepare array with list of tabs.