dolibarr  16.0.5
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 
25 require '../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
28 
29 // Load translation files required by the page
30 $langs->load("admin");
31 
32 if (!$user->admin) {
34 }
35 
36 
37 /*
38  * Action
39  */
40 if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
41  $code = $reg[1];
42  if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
43  header("Location: ".$_SERVER["PHP_SELF"]);
44  exit;
45  } else {
46  dol_print_error($db);
47  }
48 }
49 
50 if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
51  $code = $reg[1];
52  if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
53  header("Location: ".$_SERVER["PHP_SELF"]);
54  exit;
55  } else {
56  dol_print_error($db);
57  }
58 }
59 
60 
61 /*
62  * View
63  */
64 
65 $help_url = '';
66 llxHeader('', $langs->trans("ECMSetup"), $help_url);
67 
68 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
69 print load_fiche_titre($langs->trans("ECMSetup"), $linkback, 'title_setup');
70 print '<br>';
71 
72 $head = ecm_admin_prepare_head();
73 
74 print dol_get_fiche_head($head, 'ecm', '', -1, '');
75 
76 print '<table class="noborder centpercent">';
77 print '<tr class="liste_titre">';
78 print '<td>'.$langs->trans("Description").'</td>';
79 print '<td class="center" width="20">&nbsp;</td>';
80 print '<td class="center" width="100">'.$langs->trans("Value").'</td>'."\n";
81 print '</tr>';
82 
83 $form = new Form($db);
84 
85 // Mail required for members
86 
87 print '<tr class="oddeven">';
88 print '<td>'.$langs->trans("ECMAutoTree").'</td>';
89 print '<td class="center" width="20">&nbsp;</td>';
90 
91 print '<td class="center" width="100">';
92 if ($conf->use_javascript_ajax) {
93  print ajax_constantonoff('ECM_AUTO_TREE_ENABLED');
94 } else {
95  if (empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
96  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
97  } elseif (!empty($conf->global->USER_MAIL_REQUIRED)) {
98  print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
99  }
100 }
101 print '</td></tr>';
102 
103 print '</table>';
104 
105 // End of page
106 llxFooter();
107 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
dolibarr_del_const
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:552
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5190
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4830
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
$help_url
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:116
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3866
ecm_admin_prepare_head
ecm_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: ecm.lib.php:161
ajax_constantonoff
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='')
On/off button for constant.
Definition: ajax.lib.php:573
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1808
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10864
dolibarr_set_const
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:627
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59