dolibarr 20.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-2023 Anthony Berton <anthony.berton@bb2a.fr>
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
31require '../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
38require_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
43if (!$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
52if (!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
62if ($reshook < 0) {
63 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
64}
65
66if (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();
72if (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
80if ($action == 'removebackgroundlogin' && getDolGlobalString('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/' . getDolGlobalString('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
100if ($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_ELDY_USECOMOACTROW')) {
110 dolibarr_set_const($db, "THEME_ELDY_USECOMOACTROW", GETPOST('THEME_ELDY_USECOMOACTROW'), 'chaine', 0, '', $conf->entity);
111 }
112
113 if (GETPOSTISSET('THEME_DARKMODEENABLED')) {
114 $val = GETPOST('THEME_DARKMODEENABLED');
115 if (!$val) {
116 dolibarr_del_const($db, "THEME_DARKMODEENABLED", $conf->entity);
117 }
118 if ($val) {
119 dolibarr_set_const($db, "THEME_DARKMODEENABLED", $val, 'chaine', 0, '', $conf->entity);
120 }
121 }
122
123 if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
124 $val = GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
125 if (!$val) {
126 dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
127 } else {
128 dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);
129 }
130 }
131
132 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
133 if ($val == '') {
134 dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
135 } else {
136 dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity);
137 }
138
139 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
140 if ($val == '') {
141 dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
142 } else {
143 dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
144 }
145
146 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
147 if ($val == '') {
148 dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
149 } else {
150 dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
151 }
152
153 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
154 if ($val == '') {
155 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
156 } else {
157 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity);
158 }
159
160 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
161 if ($val == '') {
162 dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
163 } else {
164 dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity);
165 }
166
167 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
168 if ($val == '') {
169 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
170 } else {
171 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
172 }
173
174 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array()))));
175 if ($val == '') {
176 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity);
177 } else {
178 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity);
179 }
180
181 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
182 if ($val == '') {
183 dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
184 } else {
185 dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity);
186 }
187 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
188 if ($val == '') {
189 dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
190 } else {
191 dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity);
192 }
193
194 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
195 if ($val == '') {
196 dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
197 } else {
198 dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity);
199 }
200 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
201 if ($val == '') {
202 dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
203 } else {
204 dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity);
205 }
206
207 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
208 if ($val == '') {
209 dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
210 } else {
211 dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
212 }
213
214 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
215 if ($val == '') {
216 dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
217 } else {
218 dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
219 }
220
221 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
222 if ($val == '') {
223 dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
224 } else {
225 dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
226 }
227
228 $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BTNACTION'), array()))));
229 if ($val == '') {
230 dolibarr_del_const($db, 'THEME_ELDY_BTNACTION', $conf->entity);
231 } else {
232 dolibarr_set_const($db, 'THEME_ELDY_BTNACTION', $val, 'chaine', 0, '', $conf->entity);
233 }
234
235 $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTBTNACTION'), array()))));
236 if ($val == '') {
237 dolibarr_del_const($db, 'THEME_ELDY_TEXTBTNACTION', $conf->entity);
238 } else {
239 dolibarr_set_const($db, 'THEME_ELDY_TEXTBTNACTION', $val, 'chaine', 0, '', $conf->entity);
240 }
241 }
242
243 if ($mode == 'dashboard') {
244 dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
245 }
246
247 if ($mode == 'other') {
248 dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
249 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
250
251 dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOSTINT("MAIN_SIZE_LISTE_LIMIT"), 'chaine', 0, '', $conf->entity);
252 dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOSTINT("MAIN_SIZE_SHORTLIST_LIMIT"), 'chaine', 0, '', $conf->entity);
253
254 if (GETPOSTISSET("MAIN_CHECKBOX_LEFT_COLUMN")) {
255 dolibarr_set_const($db, "MAIN_CHECKBOX_LEFT_COLUMN", GETPOSTINT("MAIN_CHECKBOX_LEFT_COLUMN"), 'chaine', 0, '', $conf->entity);
256 }
257
258 //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity);
259 //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
260 //dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", GETPOST("MAIN_MENU_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
261 dolibarr_set_const($db, "MAIN_START_WEEK", GETPOSTINT("MAIN_START_WEEK"), 'chaine', 0, '', $conf->entity);
262
263 dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
264 dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
265
266 dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity);
267
268 dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
269 }
270
271 if ($mode == 'login') {
272 dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
273 //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
274
275 $varforimage = 'imagebackground';
276 $dirforimage = $conf->mycompany->dir_output . '/logos/';
277 if ($_FILES[$varforimage]["tmp_name"]) {
278 $reg = array();
279 if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
280 $original_file = $reg[1];
281
282 $isimage = image_format_supported($original_file);
283 if ($isimage >= 0) {
284 dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file);
285 if (!is_dir($dirforimage)) {
286 dol_mkdir($dirforimage);
287 }
288 $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']);
289 if ($result > 0) {
290 dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
291 } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
292 $error++;
293 $langs->load("errors");
294 $tmparray = explode(':', $result);
295 setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
296 } else {
297 $error++;
298 setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
299 }
300 } else {
301 $error++;
302 $langs->load("errors");
303 setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
304 }
305 }
306 }
307 }
308
309 if ($mode == 'css') {
310 //file_put_contents(DOL_DATA_ROOT.'/admin/customcss.css', $data);
311 //dol_chmod(DOL_DATA_ROOT.'/admin/customcss.css');
312 dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml'), 'chaine', 0, '', $conf->entity);
313 }
314
315 $_SESSION["mainmenu"] = ""; // The menu manager may have changed
316
317 if (GETPOST('dol_resetcache')) {
318 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
319 }
320
321 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup&mode=".$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOSTINT('page_y') : ''));
322 exit;
323}
324
325
326/*
327 * View
328 */
329
330$wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
331
333 '',
334 $langs->trans("Setup"),
335 $wikihelp,
336 '',
337 0,
338 0,
339 array(
340 '/includes/ace/src/ace.js',
341 '/includes/ace/src/ext-statusbar.js',
342 '/includes/ace/src/ext-language_tools.js',
343 ),
344 array(),
345 '',
346 'mod-admin page-ihm'
347);
348
349$form = new Form($db);
350$formother = new FormOther($db);
351$formadmin = new FormAdmin($db);
352
353print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
354
355print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n";
356print "<br>\n";
357
358//WYSIWYG Editor
359require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
360
361print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
362print '<input type="hidden" name="token" value="'.newToken().'">';
363print '<input type="hidden" name="action" value="update">';
364print '<input type="hidden" name="page_y" value="">';
365print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
366print '<input type="hidden" name="dol_resetcache" value="1">';
367
368$head = ihm_prepare_head();
369
370print dol_get_fiche_head($head, $mode, '', -1, '');
371
372print '<br>';
373
374clearstatcache();
375
376if ($mode == 'other') {
377 print '<div class="div-table-responsive-no-min">';
378 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
379
380 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
381 print $langs->trans("Language");
382 print '</td><td class="titlefieldmiddle">';
383 print '</td></tr>';
384
385 // Default language
386 print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
387 print img_picto('', 'language', 'class="pictofixedwidth"');
388 print $formadmin->select_language(getDolGlobalString('MAIN_LANG_DEFAULT'), 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2);
389 //print '<input class="button button-save smallpaddingimp" type="submit" name="submit" value="'.$langs->trans("Save").'">';
390 print '</td>';
391 print '</tr>';
392
393 // Multilingual GUI
394 print '<tr class="oddeven"><td>' . $langs->trans("EnableMultilangInterface") . '</td><td>';
395 print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'language');
396 print '</td>';
397 print '</tr>';
398
399 print '</table>' . "\n";
400 print '</div>';
401
402 print '<div class="center">';
403 print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
404 print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
405 print '</div>';
406
407 print '<br>';
408 print '<br>';
409
410 // Other
411 print '<div class="div-table-responsive-no-min">';
412 print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
413
414 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
415 print $langs->trans("Miscellaneous");
416 print '</td>';
417 print '<td class="titlefieldmiddle"></td>';
418 print '</tr>';
419
420 if (!empty($conf->use_javascript_ajax)) {
421 // Show Quick Add link
422 print '<tr class="oddeven"><td>' . $langs->trans("ShowQuickAddLink") . '</td><td>';
423 print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
424 print '</td>';
425 print '</tr>';
426 }
427
428 // Hide wiki link on login page
429 $pictohelp = '<span class="fa fa-question-circle"></span>';
430 print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
431 print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
432 //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
433 print '</td>';
434 print '</tr>';
435
436 // Max size of lists
437 print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat width50" name="MAIN_SIZE_LISTE_LIMIT" value="' . getDolGlobalString('MAIN_SIZE_LISTE_LIMIT') . '"></td>';
438 print '</tr>';
439
440 // Max size of short lists on customer card
441 print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeShortList") . '</td><td><input class="flat width50" name="MAIN_SIZE_SHORTLIST_LIMIT" value="' . getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT') . '"></td>';
442 print '</tr>';
443
444 // Display checkboxes and fields menu left / right
445 print '<tr class="oddeven"><td>' . $langs->trans("MAIN_CHECKBOX_LEFT_COLUMN") . '</td><td>';
446 print ajax_constantonoff("MAIN_CHECKBOX_LEFT_COLUMN", array(), $conf->entity, 0, 0, 1, 0, 0, 1, '', 'other');
447 print '</td>';
448 print '</tr>';
449
450 // show input border
451 /*
452 print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>';
453 print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1);
454 print '</td>';
455 print '</tr>';
456 */
457
458 // First day for weeks
459 print '<tr class="oddeven"><td>' . $langs->trans("WeekStartOnDay") . '</td><td>';
460 print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0);
461 print '</td>';
462 print '</tr>';
463
464 // DefaultWorkingDays
465 print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingDays") . '</td><td>';
466 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') . '">';
467 print '</td>';
468 print '</tr>';
469
470 // DefaultWorkingHours
471 print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingHours") . '</td><td>';
472 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') . '">';
473 print '</td>';
474 print '</tr>';
475
476 // Firstname/Name
477 print '<tr class="oddeven"><td>' . $langs->trans("FirstnameNamePosition") . '</td><td>';
478 $array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname"));
479 print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
480 print '</td>';
481 print '</tr>';
482
483 // Hide unauthorized menus
484 print '<tr class="oddeven"><td>' . $langs->trans("HideUnauthorizedMenu") . '</td><td>';
485 //print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1);
486 print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
487 print '</td>';
488 print '</tr>';
489
490 // Hide unauthorized button
491 print '<tr class="oddeven"><td>' . $langs->trans("ButtonHideUnauthorized") . '</td><td>';
492 //print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
493 print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
494 print '</td>';
495 print '</tr>';
496
497 // Hide version link
498 /*
499
500 print '<tr><td>'.$langs->trans("HideVersionLink").'</td><td>';
501 print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1);
502 print '</td>';
503 print '</tr>';
504 */
505
506
507 // Show search area in top menu
508 print '<tr class="oddeven"><td>' . $langs->trans("ShowSearchAreaInTopMenu") . '</td><td>';
509 print ajax_constantonoff("MAIN_USE_TOP_MENU_SEARCH_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
510 print '</td>';
511 print '</tr>';
512
513 // Show bugtrack link
514 print '<tr class="oddeven"><td>';
515 print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc"));
516 print '</td><td>';
517 print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . (!getDolGlobalString('MAIN_BUGTRACK_ENABLELINK') ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK) . '">';
518 print '</td>';
519 print '</tr>';
520
521 // Disable javascript and ajax
522 print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . '</td><td>';
523 print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
524 print '</td>';
525 print '</tr>';
526
527 print '</table>' . "\n";
528 print '</div>';
529}
530
531
532if ($mode == 'template') {
533 // Themes and themes options
534 showSkins(null, 1);
535}
536
537
538if ($mode == 'dashboard') {
539 print '<div class="div-table-responsive-no-min">';
540 print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
541
542 // Message of the day on home page
543 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
544 complete_substitutions_array($substitutionarray, $langs);
545
546 print '<tr class="oddeven width25p"><td>';
547 $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
548 foreach ($substitutionarray as $key => $val) {
549 $texthelp .= $key . '<br>';
550 }
551 print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
552
553 print '</td><td>';
554
555 $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
556 $doleditor->Create();
557
558 print '</td></tr>' . "\n";
559
560 /* no more need for this option. It is now a widget already controlled by end user
561 print '<tr class="oddeven"><td>' . $langs->trans('BoxstatsDisableGlobal') . '</td><td>';
562 print ajax_constantonoff("MAIN_DISABLE_GLOBAL_BOXSTATS", array(), $conf->entity, 0, 0, 1, 0);
563 print '</td>';
564 print '</tr>';
565 */
566
567 print '</table>';
568 print '</div>';
569
570 print '<br>';
571
572 print '<div class="div-table-responsive-no-min">';
573 print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
574
575 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
576 print $langs->trans("DashboardDisableBlocks");
577 print '</td><td class="titlefieldmiddle">';
578 print '</td></tr>';
579
580 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableGlobal') . '</td><td>';
581 print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
582 print '</td>';
583 print '</tr>';
584
585 if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD')) {
586 // Block meteo
587 print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
588 print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
589 print '</td>';
590 print '</tr>';
591
592 // Block agenda
593 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
594 print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
595 print '</td>';
596 print '</tr>';
597
598 // Block agenda
599 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
600 print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
601 print '</td>';
602 print '</tr>';
603
604 // Block customer
605 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
606 print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
607 print '</td>';
608 print '</tr>';
609
610 // Block supplier
611 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
612 print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
613 print '</td>';
614 print '</tr>';
615
616 // Block contract
617 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
618 print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
619 print '</td>';
620 print '</tr>';
621
622 // Block ticket
623 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
624 print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
625 print '</td>';
626 print '</tr>';
627
628 // Block bank
629 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
630 print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
631 print '</td>';
632 print '</tr>';
633
634 // Block adherent
635 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
636 print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
637 print '</td>';
638 print '</tr>';
639
640 // Block expense report
641 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
642 print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
643 print '</td>';
644 print '</tr>';
645
646 // Block holiday
647 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
648 print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
649 print '</td>';
650 print '</tr>';
651 }
652
653 print '</table>' . "\n";
654 print '</div>';
655}
656
657
658if ($mode == 'login') {
659 // Other
660 print '<div class="div-table-responsive-no-min">';
661 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
662
663 print '<tr class="liste_titre"><td class="titlefieldmax45">';
664 print $langs->trans("Parameter");
665 print '</td><td>';
666 print $langs->trans("Value");
667 print '</td></tr>';
668
669 // Hide helpcenter link on login page
670 print '<tr class="oddeven"><td>' . $langs->trans("DisableLinkToHelpCenter") . '</td><td>';
671 print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '', 'login');
672 print '</td>';
673 print '</tr>';
674
675 // Message on login page
676 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
677 complete_substitutions_array($substitutionarray, $langs);
678 print '<tr class="oddeven"><td>';
679 $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
680 foreach ($substitutionarray as $key => $val) {
681 $texthelp .= $key . '<br>';
682 }
683 print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
684 print '</td><td>';
685 $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
686 $doleditor->Create();
687 print '</td></tr>' . "\n";
688
689 // Background
690 print '<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans("BackgroundImageLogin") . ' (png,jpg)</label></td><td>';
691 print '<div class="centpercent inline-block">';
692 $disabled = '';
693 if (getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) {
694 $disabled = ' disabled="disabled"';
695 }
696 $maxfilesizearray = getMaxFileSizeArray();
697 $maxmin = $maxfilesizearray['maxmin'];
698 if ($maxmin > 0) {
699 print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
700 }
701 print '<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"' . $disabled . '>';
702 if ($disabled) {
703 print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
704 }
705 if (getDolGlobalString('MAIN_LOGIN_BACKGROUND')) {
706 print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin&token='.newToken().'&mode=login">' . img_delete($langs->trans("Delete")) . '</a>';
707 if (file_exists($conf->mycompany->dir_output . '/logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND'))) {
708 print ' &nbsp; ';
709 print '<img class="marginleftonly boxshadow valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND')) . '">';
710 }
711 } else {
712 print '<img class="marginleftonly valignmiddle" width="100" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png">';
713 }
714 print '</div>';
715 print '</td></tr>';
716
717 print '</table>' . "\n";
718 print '</div>';
719}
720
721if ($mode == 'css') {
722 print '<div class="div-table-responsive-no-min">';
723 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
724
725 print '<tr class="liste_titre">';
726 print '<td colspan="2">';
727
728 //$customcssValue = file_get_contents(DOL_DATA_ROOT.'/admin/customcss.css');
729 $customcssValue = getDolGlobalString('MAIN_IHM_CUSTOM_CSS');
730
731 $doleditor = new DolEditor('MAIN_IHM_CUSTOM_CSS', $customcssValue, '80%', 400, 'Basic', 'In', true, false, 'ace', 10, '90%');
732 $doleditor->Create(0, '', true, 'css', 'css');
733 print '</td></tr>'."\n";
734
735 print '</table>'."\n";
736 print '</div>';
737}
738
739
740print '<div class="center">';
741print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
742print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
743print '</div>';
744
745print '</form>';
746
747
748// End of page
749llxFooter();
750$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
ihm_prepare_head()
Prepare array with list of tabs.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
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.
Class permettant la generation de composants html autre Only common components are here.
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.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Check validity of a file upload from an GUI page, and move it to its final destination.
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($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.
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.