dolibarr 21.0.0-alpha
ecm.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
3 * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
27// Load Dolibarr environment
28require '../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
31
32// Load translation files required by the page
33$langs->load("admin");
34
35$action = GETPOST('action', 'aZ09');
36
37if (!$user->admin) {
39}
40
41
42/*
43 * Action
44 */
45
46// set
47$reg = array();
48if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
49 $code = $reg[1];
50 if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
51 header("Location: ".$_SERVER["PHP_SELF"]);
52 exit;
53 } else {
54 dol_print_error($db);
55 }
56}
57
58// delete
59if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
60 $code = $reg[1];
61 if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
62 header("Location: ".$_SERVER["PHP_SELF"]);
63 exit;
64 } else {
65 dol_print_error($db);
66 }
67}
68
69
70/*
71 * View
72 */
73
74$form = new Form($db);
75
76$help_url = '';
77llxHeader('', $langs->trans("ECMSetup"), $help_url, '', 0, 0, '', '', '', 'mod-admin page-ecm');
78
79$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
80print load_fiche_titre($langs->trans("ECMSetup"), $linkback, 'title_setup');
81print '<br>';
82
84
85print dol_get_fiche_head($head, 'ecm', '', -1, '');
86
87print '<table class="noborder centpercent">';
88print '<tr class="liste_titre">';
89print '<td>'.$langs->trans("Description").'</td>';
90print '<td class="center" width="100px">'.$langs->trans("Value").'</td>'."\n";
91print '</tr>';
92
93// Mail required for members
94
95print '<tr class="oddeven">';
96print '<td>'.$langs->trans("ECMAutoTree").'</td>';
97print '<td class="center">';
98if ($conf->use_javascript_ajax) {
99 print ajax_constantonoff('ECM_AUTO_TREE_HIDEN', array(), null, 1);
100} else {
101 if (!getDolGlobalString('ECM_AUTO_TREE_HIDEN')) {
102 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
103 } else {
104 print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
105 }
106}
107print '</td></tr>';
108
109print '</table>';
110
111// End of page
112llxFooter();
113$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
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:70
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
ecm_admin_prepare_head()
Return array head with list of tabs to view object information.
Definition ecm.lib.php:179
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.