dolibarr  18.0.0
ihm.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
7  * Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
8  * Copyright (C) 2021 Anthony Berton <bertonanthony@gmail.com>
9  * Copyright (C) 2023 Eric Seigne <eric.seigne@cap-rel.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
30 // Load Dolibarr environment
31 require '../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
39 
40 // Load translation files required by the page
41 $langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'projects', 'hrm', 'agenda'));
42 
43 if (!$user->admin) {
45 }
46 
47 $action = GETPOST('action', 'aZ09');
48 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
49 
50 $mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'other'; // 'template', 'dashboard', 'login', 'other'
51 
52 if (!defined("MAIN_MOTD")) {
53  define("MAIN_MOTD", "");
54 }
55 
56 /*
57  * Action
58  */
59 
60 $parameters = array();
61 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
62 if ($reshook < 0) {
63  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
64 }
65 
66 if (GETPOST('cancel', 'alpha')) {
67  $action = '';
68 }
69 
70 // Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
71 $regs = array();
72 if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
73  if ($regs[1] == 'set') {
74  dolibarr_set_const($db, $regs[2], 1, 'chaine', 0, '', $conf->entity);
75  } else {
76  dolibarr_del_const($db, $regs[2], $conf->entity);
77  }
78 }
79 
80 if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
81  dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
82  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
83 
84  $logofile = $conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
85  dol_delete_file($logofile);
86  dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND", $conf->entity);
87  $mysoc->logo = '';
88 
89  /*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
90  dol_delete_file($logosmallfile);
91  dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
92  $mysoc->logo_small='';
93 
94  $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
95  dol_delete_file($logominifile);
96  dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
97  $mysoc->logo_mini='';*/
98 }
99 
100 if ($action == 'update') {
101  $error = 0;
102 
103  if ($mode == 'template') {
104  //dolibarr_del_const($db, "MAIN_THEME", 0); // To be sure we don't have this constant set for all entities
105 
106  dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
107  dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
108 
109  if (GETPOSTISSET('THEME_DARKMODEENABLED')) {
110  $val = GETPOST('THEME_DARKMODEENABLED');
111  if (!$val) {
112  dolibarr_del_const($db, "THEME_DARKMODEENABLED", $conf->entity);
113  }
114  if ($val) {
115  dolibarr_set_const($db, "THEME_DARKMODEENABLED", $val, 'chaine', 0, '', $conf->entity);
116  }
117  }
118 
119  if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
120  $val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
121  if (!$val) {
122  dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
123  } else {
124  dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);
125  }
126  }
127 
128  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
129  if ($val == '') {
130  dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
131  } else {
132  dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity);
133  }
134 
135  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
136  if ($val == '') {
137  dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
138  } else {
139  dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
140  }
141 
142  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
143  if ($val == '') {
144  dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
145  } else {
146  dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
147  }
148 
149  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
150  if ($val == '') {
151  dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
152  } else {
153  dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity);
154  }
155 
156  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
157  if ($val == '') {
158  dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
159  } else {
160  dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity);
161  }
162 
163  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
164  if ($val == '') {
165  dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
166  } else {
167  dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
168  }
169 
170  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array()))));
171  if ($val == '') {
172  dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity);
173  } else {
174  dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity);
175  }
176 
177  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
178  if ($val == '') {
179  dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
180  } else {
181  dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity);
182  }
183  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
184  if ($val == '') {
185  dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
186  } else {
187  dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity);
188  }
189 
190  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
191  if ($val == '') {
192  dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
193  } else {
194  dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity);
195  }
196  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
197  if ($val == '') {
198  dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
199  } else {
200  dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity);
201  }
202 
203  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
204  if ($val == '') {
205  dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
206  } else {
207  dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
208  }
209 
210  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
211  if ($val == '') {
212  dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
213  } else {
214  dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
215  }
216 
217  $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
218  if ($val == '') {
219  dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
220  } else {
221  dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
222  }
223 
224  $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BTNACTION'), array()))));
225  if ($val == '') {
226  dolibarr_del_const($db, 'THEME_ELDY_BTNACTION', $conf->entity);
227  } else {
228  dolibarr_set_const($db, 'THEME_ELDY_BTNACTION', $val, 'chaine', 0, '', $conf->entity);
229  }
230 
231  $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTBTNACTION'), array()))));
232  if ($val == '') {
233  dolibarr_del_const($db, 'THEME_ELDY_TEXTBTNACTION', $conf->entity);
234  } else {
235  dolibarr_set_const($db, 'THEME_ELDY_TEXTBTNACTION', $val, 'chaine', 0, '', $conf->entity);
236  }
237  }
238 
239  if ($mode == 'dashboard') {
240  dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
241  }
242 
243  if ($mode == 'other') {
244  dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
245  dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
246 
247  dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity);
248  dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity);
249  dolibarr_set_const($db, "MAIN_CHECKBOX_LEFT_COLUMN", GETPOST("MAIN_CHECKBOX_LEFT_COLUMN", 'int'), 'chaine', 0, '', $conf->entity);
250 
251  //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity);
252  //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
253  //dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", GETPOST("MAIN_MENU_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
254  dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity);
255 
256  dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
257  dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
258 
259  dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity);
260 
261  dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
262  }
263 
264  if ($mode == 'login') {
265  dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
266  //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
267 
268  $varforimage = 'imagebackground';
269  $dirforimage = $conf->mycompany->dir_output . '/logos/';
270  if ($_FILES[$varforimage]["tmp_name"]) {
271  $reg = array();
272  if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
273  $original_file = $reg[1];
274 
275  $isimage = image_format_supported($original_file);
276  if ($isimage >= 0) {
277  dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file);
278  if (!is_dir($dirforimage)) {
279  dol_mkdir($dirforimage);
280  }
281  $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']);
282  if ($result > 0) {
283  dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
284  } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
285  $error++;
286  $langs->load("errors");
287  $tmparray = explode(':', $result);
288  setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
289  } else {
290  $error++;
291  setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
292  }
293  } else {
294  $error++;
295  $langs->load("errors");
296  setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
297  }
298  }
299  }
300  }
301 
302  if ($mode == 'css') {
303  //file_put_contents(DOL_DATA_ROOT.'/admin/customcss.css', $data);
304  //dol_chmod(DOL_DATA_ROOT.'/admin/customcss.css');
305  dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml'), 'chaine', 0, '', $conf->entity);
306  }
307 
308  $_SESSION["mainmenu"] = ""; // The menu manager may have changed
309 
310  if (GETPOST('dol_resetcache')) {
311  dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity);
312  }
313 
314  header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup&mode=".$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOST('page_y', 'int') : ''));
315  exit;
316 }
317 
318 
319 /*
320  * View
321  */
322 
323 $wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
324 
325 llxHeader('', $langs->trans("Setup"), $wikihelp, '', 0, 0,
326  array(
327  '/includes/ace/src/ace.js',
328  '/includes/ace/src/ext-statusbar.js',
329  '/includes/ace/src/ext-language_tools.js',
330  ), array());
331 
332 $form = new Form($db);
333 $formother = new FormOther($db);
334 $formadmin = new FormAdmin($db);
335 
336 print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
337 
338 print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n";
339 print "<br>\n";
340 
341 //WYSIWYG Editor
342 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
343 
344 print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
345 print '<input type="hidden" name="token" value="'.newToken().'">';
346 print '<input type="hidden" name="action" value="update">';
347 print '<input type="hidden" name="page_y" value="">';
348 print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
349 print '<input type="hidden" name="dol_resetcache" value="1">';
350 
351 $head = ihm_prepare_head();
352 
353 print dol_get_fiche_head($head, $mode, '', -1, '');
354 
355 print '<br>';
356 
357 clearstatcache();
358 
359 if ($mode == 'other') {
360  print '<div class="div-table-responsive-no-min">';
361  print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
362 
363  print '<tr class="liste_titre"><td class="titlefieldmiddle">';
364  print $langs->trans("Language");
365  print '</td><td class="titlefieldmiddle">';
366  print '</td></tr>';
367 
368  // Default language
369  print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
370  print img_picto('', 'language', 'class="pictofixedwidth"');
371  print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2);
372  //print '<input class="button button-save smallpaddingimp" type="submit" name="submit" value="'.$langs->trans("Save").'">';
373  print '</td>';
374  print '</tr>';
375 
376  // Multilingual GUI
377  print '<tr class="oddeven"><td>' . $langs->trans("EnableMultilangInterface") . '</td><td>';
378  print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'language');
379  print '</td>';
380  print '</tr>';
381 
382  print '</table>' . "\n";
383  print '</div>';
384 
385  print '<div class="center">';
386  print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
387  print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
388  print '</div>';
389 
390  print '<br>';
391  print '<br>';
392 
393  // Other
394  print '<div class="div-table-responsive-no-min">';
395  print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
396 
397  print '<tr class="liste_titre"><td class="titlefieldmiddle">';
398  print $langs->trans("Miscellaneous");
399  print '</td>';
400  print '<td class="titlefieldmiddle"></td>';
401  print '</tr>';
402 
403  // Show Quick Add link
404  print '<tr class="oddeven"><td>' . $langs->trans("ShowQuickAddLink") . '</td><td>';
405  print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
406  print '</td>';
407  print '</tr>';
408 
409  // Hide wiki link on login page
410  $pictohelp = '<span class="fa fa-question-circle"></span>';
411  print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
412  print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
413  //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
414  print '</td>';
415  print '</tr>';
416 
417  // Max size of lists
418  print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
419  print '</tr>';
420 
421  // Max size of short lists on customer card
422  print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeShortList") . '</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
423  print '</tr>';
424 
425  // Max size of lists
426  print '<tr class="oddeven"><td>' . $langs->trans("MAIN_CHECKBOX_LEFT_COLUMN") . '</td><td>';
427  print ajax_constantonoff("MAIN_CHECKBOX_LEFT_COLUMN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
428  print '</td>';
429  print '</tr>';
430 
431  // show input border
432  /*
433  print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>';
434  print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1);
435  print '</td>';
436  print '</tr>';
437  */
438 
439  // First day for weeks
440  print '<tr class="oddeven"><td>' . $langs->trans("WeekStartOnDay") . '</td><td>';
441  print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0);
442  print '</td>';
443  print '</tr>';
444 
445  // DefaultWorkingDays
446  print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingDays") . '</td><td>';
447  print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="' . (isset($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? $conf->global->MAIN_DEFAULT_WORKING_DAYS : '1-5') . '">';
448  print '</td>';
449  print '</tr>';
450 
451  // DefaultWorkingHours
452  print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingHours") . '</td><td>';
453  print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="' . (isset($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? $conf->global->MAIN_DEFAULT_WORKING_HOURS : '9-18') . '">';
454  print '</td>';
455  print '</tr>';
456 
457  // Firstname/Name
458  print '<tr class="oddeven"><td>' . $langs->trans("FirstnameNamePosition") . '</td><td>';
459  $array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname"));
460  print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
461  print '</td>';
462  print '</tr>';
463 
464  // Hide unauthorized menus
465  print '<tr class="oddeven"><td>' . $langs->trans("HideUnauthorizedMenu") . '</td><td>';
466  //print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1);
467  print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
468  print '</td>';
469  print '</tr>';
470 
471  // Hide unauthorized button
472  print '<tr class="oddeven"><td>' . $langs->trans("ButtonHideUnauthorized") . '</td><td>';
473  //print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
474  print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
475  print '</td>';
476  print '</tr>';
477 
478  // Hide version link
479  /*
480 
481  print '<tr><td>'.$langs->trans("HideVersionLink").'</td><td>';
482  print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1);
483  print '</td>';
484  print '</tr>';
485  */
486 
487  // Show bugtrack link
488  print '<tr class="oddeven"><td>';
489  print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc"));
490  print '</td><td>';
491  print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . (empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK) . '">';
492  print '</td>';
493  print '</tr>';
494 
495  // Disable javascript and ajax
496  print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . '</td><td>';
497  print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
498  print '</td>';
499  print '</tr>';
500 
501  print '</table>' . "\n";
502  print '</div>';
503 }
504 
505 
506 if ($mode == 'template') {
507  // Themes and themes options
508  showSkins(null, 1);
509 }
510 
511 
512 if ($mode == 'dashboard') {
513  print '<div class="div-table-responsive-no-min">';
514  print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
515 
516  // Message of the day on home page
517  $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
518  complete_substitutions_array($substitutionarray, $langs);
519 
520  print '<tr class="oddeven width25p"><td>';
521  $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
522  foreach ($substitutionarray as $key => $val) {
523  $texthelp .= $key . '<br>';
524  }
525  print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
526 
527  print '</td><td>';
528 
529  $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
530  $doleditor->Create();
531 
532  print '</td></tr>' . "\n";
533 
534  /* no more need for this option. It is now a widget already controlled by end user
535  print '<tr class="oddeven"><td>' . $langs->trans('BoxstatsDisableGlobal') . '</td><td>';
536  print ajax_constantonoff("MAIN_DISABLE_GLOBAL_BOXSTATS", array(), $conf->entity, 0, 0, 1, 0);
537  print '</td>';
538  print '</tr>';
539  */
540 
541  print '</table>';
542  print '</div>';
543 
544  print '<br>';
545 
546  print '<div class="div-table-responsive-no-min">';
547  print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
548 
549  print '<tr class="liste_titre"><td class="titlefieldmiddle">';
550  print $langs->trans("DashboardDisableBlocks");
551  print '</td><td class="titlefieldmiddle">';
552  print '</td></tr>';
553 
554  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableGlobal') . '</td><td>';
555  print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
556  print '</td>';
557  print '</tr>';
558 
559  if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
560  // Block meteo
561  print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
562  print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
563  print '</td>';
564  print '</tr>';
565 
566  // Block agenda
567  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
568  print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
569  print '</td>';
570  print '</tr>';
571 
572  // Block agenda
573  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
574  print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
575  print '</td>';
576  print '</tr>';
577 
578  // Block customer
579  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
580  print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
581  print '</td>';
582  print '</tr>';
583 
584  // Block supplier
585  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
586  print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
587  print '</td>';
588  print '</tr>';
589 
590  // Block contract
591  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
592  print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
593  print '</td>';
594  print '</tr>';
595 
596  // Block ticket
597  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
598  print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
599  print '</td>';
600  print '</tr>';
601 
602  // Block bank
603  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
604  print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
605  print '</td>';
606  print '</tr>';
607 
608  // Block adherent
609  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
610  print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
611  print '</td>';
612  print '</tr>';
613 
614  // Block expense report
615  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
616  print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
617  print '</td>';
618  print '</tr>';
619 
620  // Block holiday
621  print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
622  print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
623  print '</td>';
624  print '</tr>';
625  }
626 
627  print '</table>' . "\n";
628  print '</div>';
629 }
630 
631 
632 if ($mode == 'login') {
633  // Other
634  print '<div class="div-table-responsive-no-min">';
635  print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
636 
637  print '<tr class="liste_titre"><td class="titlefieldmax45">';
638  print $langs->trans("Parameter");
639  print '</td><td>';
640  print $langs->trans("Value");
641  print '</td></tr>';
642 
643  // Hide helpcenter link on login page
644  print '<tr class="oddeven"><td>' . $langs->trans("DisableLinkToHelpCenter") . '</td><td>';
645  print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '', 'login');
646  print '</td>';
647  print '</tr>';
648 
649  // Message on login page
650  $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
651  complete_substitutions_array($substitutionarray, $langs);
652  print '<tr class="oddeven"><td>';
653  $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
654  foreach ($substitutionarray as $key => $val) {
655  $texthelp .= $key . '<br>';
656  }
657  print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
658  print '</td><td>';
659  $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
660  $doleditor->Create();
661  print '</td></tr>' . "\n";
662 
663  // Background
664  print '<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans("BackgroundImageLogin") . ' (png,jpg)</label></td><td>';
665  print '<div class="centpercent inline-block">';
666  $disabled = '';
667  if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
668  $disabled = ' disabled="disabled"';
669  }
670  $maxfilesizearray = getMaxFileSizeArray();
671  $maxmin = $maxfilesizearray['maxmin'];
672  if ($maxmin > 0) {
673  print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
674  }
675  print '<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"' . $disabled . '>';
676  if ($disabled) {
677  print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
678  }
679  if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
680  print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin&token='.newToken().'&mode=login">' . img_delete($langs->trans("Delete")) . '</a>';
681  if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) {
682  print ' &nbsp; ';
683  print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . $conf->global->MAIN_LOGIN_BACKGROUND) . '">';
684  }
685  } else {
686  print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png">';
687  }
688  print '</div>';
689  print '</td></tr>';
690 
691  print '</table>' . "\n";
692  print '</div>';
693 }
694 
695 if ($mode == 'css') {
696  print '<div class="div-table-responsive-no-min">';
697  print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
698 
699  print '<tr class="liste_titre">';
700  print '<td colspan="2">';
701 
702  //$customcssValue = file_get_contents(DOL_DATA_ROOT.'/admin/customcss.css');
703  $customcssValue = getDolGlobalString('MAIN_IHM_CUSTOM_CSS');
704 
705  $doleditor = new DolEditor('MAIN_IHM_CUSTOM_CSS', $customcssValue, '80%', 400, 'Basic', 'In', true, false, 'ace', 10, '90%');
706  $doleditor->Create(0, '', true, 'css', 'css');
707  print '</td></tr>'."\n";
708 
709  print '</table>'."\n";
710  print '</div>';
711 }
712 
713 
714 print '<div class="center">';
715 print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
716 print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
717 print '</div>';
718 
719 print '</form>';
720 
721 
722 // End of page
723 llxFooter();
724 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
dolibarr_del_const
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:562
colorStringToArray
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
Definition: functions2.lib.php:2413
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5477
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:609
$wikihelp
if(GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) if(GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) if($actionsave) if(!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $wikihelp
View.
Definition: agenda_xcal.php:90
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
image_format_supported
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
Definition: images.lib.php:80
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
FormAdmin
Class to generate html code for admin pages.
Definition: html.formadmin.class.php:30
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:4135
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
dol_delete_file
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
Definition: files.lib.php:1334
getMaxFileSizeArray
getMaxFileSizeArray()
Return the max allowed for file upload.
Definition: security.lib.php:1228
img_delete
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
Definition: functions.lib.php:4692
dol_move_uploaded_file
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Make control on an uploaded file from an GUI page and move it to final destination.
Definition: files.lib.php:1196
ajax_constantonoff
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='', $morecss='')
On/off button for constant.
Definition: ajax.lib.php:630
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1741
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
Definition: functions.lib.php:8673
dol_htmlcleanlastbr
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
Definition: functions.lib.php:7518
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
Definition: functions.lib.php:1979
getDolGlobalString
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:142
dolibarr_set_const
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:638
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:509
showSkins
showSkins($fuser, $edit=0, $foruserprofile=false)
Show list of themes.
Definition: usergroups.lib.php:313
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:53
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
Definition: security.lib.php:1164
dol_mkdir
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
Definition: functions.lib.php:6936
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:156
getCommonSubstitutionArray
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
Definition: functions.lib.php:7762
DolEditor
Class to manage a WYSIWYG editor.
Definition: doleditor.class.php:30
complete_substitutions_array
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
Definition: functions.lib.php:8489
ihm_prepare_head
ihm_prepare_head()
Prepare array with list of tabs.
Definition: admin.lib.php:755