dolibarr  13.0.2
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) accessforbidden();
33 
34 
35 /*
36  * Action
37  */
38 if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
39 {
40  $code = $reg[1];
41  if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
42  {
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 {
52  $code = $reg[1];
53  if (dolibarr_del_const($db, $code, $conf->entity) > 0)
54  {
55  header("Location: ".$_SERVER["PHP_SELF"]);
56  exit;
57  } else {
58  dol_print_error($db);
59  }
60 }
61 
62 
63 /*
64  * View
65  */
66 
67 $help_url = '';
68 llxHeader('', $langs->trans("ECMSetup"), $help_url);
69 
70 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
71 print load_fiche_titre($langs->trans("ECMSetup"), $linkback, 'title_setup');
72 print '<br>';
73 
74 $head = ecm_admin_prepare_head();
75 
76 print dol_get_fiche_head($head, 'ecm', $langs->trans("ECM"), -1, 'ecm');
77 
78 print '<table class="noborder centpercent">';
79 print '<tr class="liste_titre">';
80 print '<td>'.$langs->trans("Description").'</td>';
81 print '<td class="center" width="20">&nbsp;</td>';
82 print '<td class="center" width="100">'.$langs->trans("Value").'</td>'."\n";
83 print '</tr>';
84 
85 $form = new Form($db);
86 
87 // Mail required for members
88 
89 print '<tr class="oddeven">';
90 print '<td>'.$langs->trans("ECMAutoTree").'</td>';
91 print '<td class="center" width="20">&nbsp;</td>';
92 
93 print '<td class="center" width="100">';
94 if ($conf->use_javascript_ajax)
95 {
96  print ajax_constantonoff('ECM_AUTO_TREE_ENABLED');
97 } else {
98  if (empty($conf->global->ECM_AUTO_TREE_ENABLED))
99  {
100  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED&amp;token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
101  } elseif (!empty($conf->global->USER_MAIL_REQUIRED))
102  {
103  print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED&amp;token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
104  }
105 }
106 print '</td></tr>';
107 
108 print '</table>';
109 
110 // End of page
111 llxFooter();
112 $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).
Definition: admin.lib.php:575
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dolibarr_del_const($db, $name, $entity=1)
Effacement d&#39;une constante dans la base de donnees.
Definition: admin.lib.php:499
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0)
On/off button for constant.
Definition: ajax.lib.php:503
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 ...
print $_SERVER["PHP_SELF"]
Edit parameters.
ecm_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: ecm.lib.php:147
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name &#39;newtoken&#39;.
llxFooter()
Empty footer.
Definition: wrapper.php:59