dolibarr 23.0.3
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
28// Load Dolibarr environment
29require '../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
32
41// Load translation files required by the page
42$langs->load("admin");
43
44$action = GETPOST('action', 'aZ09');
45
46if (!$user->admin) {
48}
49
50
51/*
52 * Action
53 */
54
55// set
56$reg = array();
57if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
58 $code = $reg[1];
59 if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
60 header("Location: ".$_SERVER["PHP_SELF"]);
61 exit;
62 } else {
63 dol_print_error($db);
64 }
65}
66
67// delete
68if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
69 $code = $reg[1];
70 if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
71 header("Location: ".$_SERVER["PHP_SELF"]);
72 exit;
73 } else {
74 dol_print_error($db);
75 }
76}
77
78
79/*
80 * View
81 */
82
83$form = new Form($db);
84
85$help_url = '';
86llxHeader('', $langs->trans("ECMSetup"), $help_url, '', 0, 0, '', '', '', 'mod-admin page-ecm');
87
88$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
89
90print load_fiche_titre($langs->trans("ECMSetup"), $linkback, 'title_setup');
91print '<br>';
92
94
95print dol_get_fiche_head($head, 'ecm', '', -1, '');
96
97print '<table class="noborder centpercent">';
98print '<tr class="liste_titre">';
99print '<td>'.$langs->trans("Description").'</td>';
100print '<td class="center" width="100px"></td>'."\n";
101print '</tr>';
102
103// Mail required for members
104
105print '<tr class="oddeven">';
106print '<td>'.$langs->trans("ECMAutoTree").'</td>';
107print '<td class="center">';
108if ($conf->use_javascript_ajax) {
109 print ajax_constantonoff('ECM_AUTO_TREE_HIDEN', array(), null, 1);
110} else {
111 if (!getDolGlobalString('ECM_AUTO_TREE_HIDEN')) {
112 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
113 } else {
114 print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
115 }
116}
117print '</td></tr>';
118
119print '</table>';
120
121// End of page
122llxFooter();
123$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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
Class to manage generation of HTML components Only common components must be here.
ecm_admin_prepare_head()
Return array head with list of tabs to view object information.
Definition ecm.lib.php:178
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)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.