dolibarr  19.0.0-dev
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  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
26 // Load Dolibarr environment
27 require '../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30 
31 // Load translation files required by the page
32 $langs->load("admin");
33 
34 $action = GETPOST('action', 'aZ09');
35 
36 if (!$user->admin) {
38 }
39 
40 
41 /*
42  * Action
43  */
44 
45 // set
46 $reg = array();
47 if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
48  $code = $reg[1];
49  if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
50  header("Location: ".$_SERVER["PHP_SELF"]);
51  exit;
52  } else {
53  dol_print_error($db);
54  }
55 }
56 
57 // delete
58 if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
59  $code = $reg[1];
60  if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
61  header("Location: ".$_SERVER["PHP_SELF"]);
62  exit;
63  } else {
64  dol_print_error($db);
65  }
66 }
67 
68 
69 /*
70  * View
71  */
72 
73 $form = new Form($db);
74 
75 $help_url = '';
76 llxHeader('', $langs->trans("ECMSetup"), $help_url);
77 
78 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
79 print load_fiche_titre($langs->trans("ECMSetup"), $linkback, 'title_setup');
80 print '<br>';
81 
82 $head = ecm_admin_prepare_head();
83 
84 print dol_get_fiche_head($head, 'ecm', '', -1, '');
85 
86 print '<table class="noborder centpercent">';
87 print '<tr class="liste_titre">';
88 print '<td>'.$langs->trans("Description").'</td>';
89 print '<td class="center" width="100px">'.$langs->trans("Value").'</td>'."\n";
90 print '</tr>';
91 
92 // Mail required for members
93 
94 print '<tr class="oddeven">';
95 print '<td>'.$langs->trans("ECMAutoTree").'</td>';
96 print '<td class="center">';
97 if ($conf->use_javascript_ajax) {
98  print ajax_constantonoff('ECM_AUTO_TREE_HIDEN', null, null, 1);
99 } else {
100  if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) {
101  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
102  } else {
103  print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
104  }
105 }
106 print '</td></tr>';
107 
108 print '</table>';
109 
110 // End of page
111 llxFooter();
112 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
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:638
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:562
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='', $morecss='inline-block')
On/off button for constant.
Definition: ajax.lib.php:630
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
ecm_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: ecm.lib.php:178
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.