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