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