dolibarr 21.0.3
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 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
11 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 */
26
32// Load Dolibarr environment
33require '../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
41
51// Load translation files required by the page
52$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'projects', 'hrm', 'agenda'));
53
54if (!$user->admin) {
56}
57
58$action = GETPOST('action', 'aZ09');
59$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
60
61$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'other'; // 'template', 'dashboard', 'login', 'other'
62
63if (!defined("MAIN_MOTD")) {
64 define("MAIN_MOTD", "");
65}
66
67/*
68 * Action
69 */
70
71$parameters = array();
72$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
73if ($reshook < 0) {
74 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
75}
76
77if (GETPOST('cancel', 'alpha')) {
78 $action = '';
79}
80
81// Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
82$regs = array();
83if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
84 if ($regs[1] == 'set') {
85 dolibarr_set_const($db, $regs[2], 1, 'chaine', 0, '', $conf->entity);
86 } else {
87 dolibarr_del_const($db, $regs[2], $conf->entity);
88 }
89}
90
91if ($action == 'removebackgroundlogin' && getDolGlobalString('MAIN_LOGIN_BACKGROUND')) {
92 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
93 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
94
95 $logofile = $conf->mycompany->dir_output.'/logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND');
96 dol_delete_file($logofile);
97 dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND", $conf->entity);
98 $mysoc->logo = '';
99
100 /*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
101 dol_delete_file($logosmallfile);
102 dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
103 $mysoc->logo_small='';
104
105 $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
106 dol_delete_file($logominifile);
107 dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
108 $mysoc->logo_mini='';*/
109}
110
111if ($action == 'update') {
112 $error = 0;
113
114 if ($mode == 'template') {
115 //dolibarr_del_const($db, "MAIN_THEME", 0); // To be sure we don't have this constant set for all entities
116
117 dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
118 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
119
120 if (GETPOSTISSET('THEME_ELDY_USECOMOACTROW')) {
121 dolibarr_set_const($db, "THEME_ELDY_USECOMOACTROW", GETPOST('THEME_ELDY_USECOMOACTROW'), 'chaine', 0, '', $conf->entity);
122 }
123
124 if (GETPOSTISSET('THEME_DARKMODEENABLED')) {
125 $val = GETPOST('THEME_DARKMODEENABLED');
126 if (!$val) {
127 dolibarr_del_const($db, "THEME_DARKMODEENABLED", $conf->entity);
128 }
129 if ($val) {
130 dolibarr_set_const($db, "THEME_DARKMODEENABLED", $val, 'chaine', 0, '', $conf->entity);
131 }
132 }
133
134 if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
135 $val = GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
136 if (!$val) {
137 dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
138 } else {
139 dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);
140 }
141 }
142
143 if (GETPOSTISSET('THEME_ELDY_BORDER_RADIUS')) {
144 $val = GETPOST('THEME_ELDY_BORDER_RADIUS');
145 dolibarr_set_const($db, 'THEME_ELDY_BORDER_RADIUS', GETPOSTINT('THEME_ELDY_BORDER_RADIUS'), 'chaine', 0, '', $conf->entity);
146 }
147
148 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
149 if ($val == '') {
150 dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
151 } else {
152 dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity);
153 }
154
155 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
156 if ($val == '') {
157 dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
158 } else {
159 dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
160 }
161
162 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
163 if ($val == '') {
164 dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
165 } else {
166 dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
167 }
168
169 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
170 if ($val == '') {
171 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
172 } else {
173 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity);
174 }
175
176 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
177 if ($val == '') {
178 dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
179 } else {
180 dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity);
181 }
182
183 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
184 if ($val == '') {
185 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
186 } else {
187 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
188 }
189
190 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array()))));
191 if ($val == '') {
192 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity);
193 } else {
194 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity);
195 }
196
197 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
198 if ($val == '') {
199 dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
200 } else {
201 dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity);
202 }
203 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
204 if ($val == '') {
205 dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
206 } else {
207 dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity);
208 }
209
210 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
211 if ($val == '') {
212 dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
213 } else {
214 dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity);
215 }
216 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
217 if ($val == '') {
218 dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
219 } else {
220 dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity);
221 }
222
223 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
224 if ($val == '') {
225 dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
226 } else {
227 dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
228 }
229
230 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
231 if ($val == '') {
232 dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
233 } else {
234 dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
235 }
236
237 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
238 if ($val == '') {
239 dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
240 } else {
241 dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
242 }
243
244 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BTNACTION'), array()))));
245 if ($val == '') {
246 dolibarr_del_const($db, 'THEME_ELDY_BTNACTION', $conf->entity);
247 } else {
248 dolibarr_set_const($db, 'THEME_ELDY_BTNACTION', $val, 'chaine', 0, '', $conf->entity);
249 }
250
251 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTBTNACTION'), array()))));
252 if ($val == '') {
253 dolibarr_del_const($db, 'THEME_ELDY_TEXTBTNACTION', $conf->entity);
254 } else {
255 dolibarr_set_const($db, 'THEME_ELDY_TEXTBTNACTION', $val, 'chaine', 0, '', $conf->entity);
256 }
257 }
258
259 if ($mode == 'dashboard') {
260 dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
261 }
262
263 if ($mode == 'other') {
264 dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
265 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
266
267 dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOSTINT("MAIN_SIZE_LISTE_LIMIT"), 'chaine', 0, '', $conf->entity);
268 dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOSTINT("MAIN_SIZE_SHORTLIST_LIMIT"), 'chaine', 0, '', $conf->entity);
269
270 if (GETPOSTISSET("MAIN_CHECKBOX_LEFT_COLUMN")) {
271 dolibarr_set_const($db, "MAIN_CHECKBOX_LEFT_COLUMN", GETPOSTINT("MAIN_CHECKBOX_LEFT_COLUMN"), 'chaine', 0, '', $conf->entity);
272 }
273
274 //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity);
275 //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
276 //dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", GETPOST("MAIN_MENU_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
277 dolibarr_set_const($db, "MAIN_START_WEEK", GETPOSTINT("MAIN_START_WEEK"), 'chaine', 0, '', $conf->entity);
278
279 dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
280 dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
281
282 dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity);
283
284 dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
285 }
286
287 if ($mode == 'login') {
288 dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
289 //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
290
291 $varforimage = 'imagebackground';
292 $dirforimage = $conf->mycompany->dir_output . '/logos/';
293 if ($_FILES[$varforimage]["tmp_name"]) {
294 $reg = array();
295 if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
296 $original_file = $reg[1];
297
298 $isimage = image_format_supported($original_file);
299 if ($isimage >= 0) {
300 dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file);
301 if (!is_dir($dirforimage)) {
302 dol_mkdir($dirforimage);
303 }
304 $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']);
305 if ($result > 0) {
306 dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
307 } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
308 $error++;
309 $langs->load("errors");
310 $tmparray = explode(':', $result);
311 setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
312 } else {
313 $error++;
314 setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
315 }
316 } else {
317 $error++;
318 $langs->load("errors");
319 setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
320 }
321 }
322 }
323 }
324
325 if ($mode == 'css') {
326 //file_put_contents(DOL_DATA_ROOT.'/admin/customcss.css', $data);
327 //dol_chmod(DOL_DATA_ROOT.'/admin/customcss.css');
328 $csscontent = GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml');
329 $csscontent = dol_string_nohtmltag($csscontent, 2);
330
331 dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", $csscontent, 'chaine', 0, '', $conf->entity);
332
333 setEventMessages($langs->trans("RecordSaved"), null);
334 }
335
336 $_SESSION["mainmenu"] = ""; // The menu manager may have changed
337
338 if (GETPOST('dol_resetcache')) {
339 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
340 }
341
342 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup&mode=".$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOSTINT('page_y') : ''));
343 exit;
344}
345
346
347/*
348 * View
349 */
350
351$wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
352
354 '',
355 $langs->trans("Setup"),
356 $wikihelp,
357 '',
358 0,
359 0,
360 array(
361 '/includes/ace/src/ace.js',
362 '/includes/ace/src/ext-statusbar.js',
363 '/includes/ace/src/ext-language_tools.js',
364 ),
365 array(),
366 '',
367 'mod-admin page-ihm'
368);
369
370$form = new Form($db);
371$formother = new FormOther($db);
372$formadmin = new FormAdmin($db);
373
374print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
375
376print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n";
377print "<br>\n";
378
379//WYSIWYG Editor
380require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
381
382print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
383print '<input type="hidden" name="token" value="'.newToken().'">';
384print '<input type="hidden" name="action" value="update">';
385print '<input type="hidden" name="page_y" value="">';
386print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
387print '<input type="hidden" name="dol_resetcache" value="1">';
388
389$head = ihm_prepare_head();
390
391print dol_get_fiche_head($head, $mode, '', -1, '');
392
393print '<br>';
394
395clearstatcache();
396
397if ($mode == 'other') {
398 print '<div class="div-table-responsive-no-min">';
399 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
400
401 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
402 print $langs->trans("Language");
403 print '</td><td>';
404 print '</td></tr>';
405
406 // Default language
407 print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
408 print img_picto('', 'language', 'class="pictofixedwidth"');
409 print $formadmin->select_language(getDolGlobalString('MAIN_LANG_DEFAULT'), 'MAIN_LANG_DEFAULT', 1, array(), '', 0, 0, 'minwidth300', 2);
410 //print '<input class="button button-save smallpaddingimp" type="submit" name="submit" value="'.$langs->trans("Save").'">';
411 print '</td>';
412 print '</tr>';
413
414 // Multilingual GUI
415 print '<tr class="oddeven"><td>' . $langs->trans("EnableMultilangInterface") . '</td><td>';
416 print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'language');
417 print '</td>';
418 print '</tr>';
419
420 print '</table>' . "\n";
421 print '</div>';
422
423 print '<div class="center">';
424 print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
425 print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
426 print '</div>';
427
428 print '<br>';
429 print '<br>';
430
431 // Other
432 print '<div class="div-table-responsive-no-min">';
433 print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
434
435 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
436 print $langs->trans("Miscellaneous");
437 print '</td>';
438 print '<td></td>';
439 print '</tr>';
440
441 if (!empty($conf->use_javascript_ajax)) {
442 // Show Quick Add link
443 print '<tr class="oddeven"><td>' . $langs->trans("ShowQuickAddLink") . '</td><td>';
444 print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
445 print '</td>';
446 print '</tr>';
447 }
448
449 // Hide wiki link on login page
450 $pictohelp = '<span class="fa fa-question-circle"></span>';
451 print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
452 print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
453 //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
454 print '</td>';
455 print '</tr>';
456
457 // Max size of lists
458 print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat width50" name="MAIN_SIZE_LISTE_LIMIT" value="';
459 if (getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT') > 0) {
460 print getDolGlobalString('MAIN_SIZE_LISTE_LIMIT');
461 }
462 print '">';
463 if (getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT') <= 0) {
464 print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Automatic").')</span>';
465 }
466 print '</td>';
467 print '</tr>';
468
469 // Max size of short lists on customer card
470 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>';
471 print '</tr>';
472
473 // Display checkboxes and fields menu left / right
474 print '<tr class="oddeven"><td>' . $langs->trans("MAIN_CHECKBOX_LEFT_COLUMN") . '</td><td>';
475 print ajax_constantonoff("MAIN_CHECKBOX_LEFT_COLUMN", array(), $conf->entity, 0, 0, 1, 0, 0, 1, '', 'other');
476 print '</td>';
477 print '</tr>';
478
479 // First day for weeks
480 print '<tr class="oddeven"><td>' . $langs->trans("WeekStartOnDay") . '</td><td>';
481 print $formother->select_dayofweek(getDolGlobalString('MAIN_START_WEEK', '1'), 'MAIN_START_WEEK', 0);
482 print '</td>';
483 print '</tr>';
484
485 // DefaultWorkingDays
486 print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingDays") . '</td><td>';
487 print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="' . getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS', '1-5') . '">';
488 print '</td>';
489 print '</tr>';
490
491 // DefaultWorkingHours
492 print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingHours") . '</td><td>';
493 print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="' . getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS', '9-18') . '">';
494 print '</td>';
495 print '</tr>';
496
497 // Firstname/Name
498 print '<tr class="oddeven"><td>' . $langs->trans("FirstnameNamePosition") . '</td><td>';
499 $array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname"));
500 print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, getDolGlobalInt('MAIN_FIRSTNAME_NAME_POSITION', 0));
501 print '</td>';
502 print '</tr>';
503
504 // Hide unauthorized menus
505 print '<tr class="oddeven"><td>' . $langs->trans("HideUnauthorizedMenu") . '</td><td>';
506 //print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1);
507 print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
508 print '</td>';
509 print '</tr>';
510
511 // Hide unauthorized button
512 print '<tr class="oddeven"><td>' . $langs->trans("ButtonHideUnauthorized") . '</td><td>';
513 //print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
514 print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
515 print '</td>';
516 print '</tr>';
517
518 // Hide version link
519 /*
520
521 print '<tr><td>'.$langs->trans("HideVersionLink").'</td><td>';
522 print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1);
523 print '</td>';
524 print '</tr>';
525 */
526
527
528 // Show search area in top menu
529 print '<tr class="oddeven"><td>' . $langs->trans("ShowSearchAreaInTopMenu") . '</td><td>';
530 print ajax_constantonoff("MAIN_USE_TOP_MENU_SEARCH_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
531 print '</td>';
532 print '</tr>';
533
534 // Show bugtrack link
535 print '<tr class="oddeven"><td>';
536 print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc"));
537 print '</td><td>';
538 print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . getDolGlobalString('MAIN_BUGTRACK_ENABLELINK') . '">';
539 print '</td>';
540 print '</tr>';
541
542 // Disable javascript and ajax
543 print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . '</td><td>';
544 print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
545 print '</td>';
546 print '</tr>';
547
548 print '</table>' . "\n";
549 print '</div>';
550}
551
552
553if ($mode == 'template') {
554 // Themes and themes options
555 showSkins(null, 1);
556}
557
558
559if ($mode == 'dashboard') {
560 print '<div class="div-table-responsive-no-min">';
561 print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
562
563 // Message of the day on home page
564 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
565 complete_substitutions_array($substitutionarray, $langs);
566
567 print '<tr class="oddeven width25p"><td>';
568 $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
569 foreach ($substitutionarray as $key => $val) {
570 $texthelp .= $key . '<br>';
571 }
572 print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
573
574 print '</td><td>';
575
576 $doleditor = new DolEditor('main_motd', getDolGlobalString('MAIN_MOTD'), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
577 $doleditor->Create();
578
579 print '</td></tr>'."\n";
580
581 print '</table>';
582 print '</div>';
583
584 print '<br>';
585
586 print '<div class="div-table-responsive-no-min">';
587 print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
588
589 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
590 print $langs->trans("DashboardDisableBlocks");
591 print '</td><td class="titlefieldmiddle">';
592 print '</td></tr>';
593
594 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableGlobal') . '</td><td>';
595 print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
596 print '</td>';
597 print '</tr>';
598
599 if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD')) {
600 // Block meteo
601 print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
602 print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
603 print '</td>';
604 print '</tr>';
605
606 // Block agenda
607 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
608 print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
609 print '</td>';
610 print '</tr>';
611
612 // Block agenda
613 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
614 print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
615 print '</td>';
616 print '</tr>';
617
618 // Block customer
619 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
620 print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
621 print '</td>';
622 print '</tr>';
623
624 // Block supplier
625 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
626 print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
627 print '</td>';
628 print '</tr>';
629
630 // Block contract
631 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
632 print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
633 print '</td>';
634 print '</tr>';
635
636 // Block ticket
637 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
638 print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
639 print '</td>';
640 print '</tr>';
641
642 // Block bank
643 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
644 print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
645 print '</td>';
646 print '</tr>';
647
648 // Block adherent
649 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
650 print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
651 print '</td>';
652 print '</tr>';
653
654 // Block expense report
655 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
656 print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
657 print '</td>';
658 print '</tr>';
659
660 // Block holiday
661 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
662 print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
663 print '</td>';
664 print '</tr>';
665 }
666
667 print '</table>' . "\n";
668 print '</div>';
669}
670
671
672if ($mode == 'login') {
673 // Other
674 print '<div class="div-table-responsive-no-min">';
675 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
676
677 print '<tr class="liste_titre"><td class="titlefieldmax45">';
678 print $langs->trans("Parameter");
679 print '</td><td>';
680 print $langs->trans("Value");
681 print '</td></tr>';
682
683 // Hide helpcenter link on login page
684 /*
685 print '<tr class="oddeven"><td>' . $langs->trans("DisableLinkToHelpCenter") . '</td><td>';
686 print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '', 'login');
687 print '</td>';
688 print '</tr>';
689 */
690
691 // Message on login page
692 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
693 complete_substitutions_array($substitutionarray, $langs);
694 print '<tr class="oddeven"><td>';
695 $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
696 foreach ($substitutionarray as $key => $val) {
697 $texthelp .= $key . '<br>';
698 }
699 print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
700 print '</td><td>';
701 $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
702 $doleditor->Create();
703 print '</td></tr>' . "\n";
704
705 // Background
706 print '<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans("BackgroundImageLogin") . ' (png,jpg)</label></td><td>';
707 print '<div class="centpercent inline-block">';
708 $disabled = '';
709 if (getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) {
710 $disabled = ' disabled="disabled"';
711 }
712 $maxfilesizearray = getMaxFileSizeArray();
713 $maxmin = $maxfilesizearray['maxmin'];
714 if ($maxmin > 0) {
715 print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
716 }
717 print '<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"' . $disabled . '>';
718 if ($disabled) {
719 print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
720 }
721 if (getDolGlobalString('MAIN_LOGIN_BACKGROUND')) {
722 print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin&token='.newToken().'&mode=login">' . img_delete($langs->trans("Delete")) . '</a>';
723 if (file_exists($conf->mycompany->dir_output . '/logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND'))) {
724 print ' &nbsp; ';
725 print '<img class="marginleftonly boxshadow valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND')) . '">';
726 }
727 } else {
728 print '<img class="marginleftonly valignmiddle" width="100" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png">';
729 }
730 print '</div>';
731 print '</td></tr>';
732
733 print '</table>' . "\n";
734 print '</div>';
735}
736
737if ($mode == 'css') {
738 print '<div class="div-table-responsive-no-min">';
739 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
740
741 print '<tr class="liste_titre">';
742 print '<td colspan="2">';
743
744 //$customcssValue = file_get_contents(DOL_DATA_ROOT.'/admin/customcss.css');
745 $customcssValue = getDolGlobalString('MAIN_IHM_CUSTOM_CSS');
746
747 $doleditor = new DolEditor('MAIN_IHM_CUSTOM_CSS', $customcssValue, '80%', 400, 'Basic', 'In', true, false, 'ace', 10, '90%');
748 $doleditor->Create(0, '', true, 'css', 'css');
749 print '</td></tr>'."\n";
750
751 print '</table>'."\n";
752 print '</div>';
753}
754
755
756print '<div class="center">';
757print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
758print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
759print '</div>';
760
761print '</form>';
762
763
764// End of page
765llxFooter();
766$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
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.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return a 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.