dolibarr  13.0.2
categorie.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
4  * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
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 
26 require '../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
28 
29 
30 if (!$user->admin)
32 
33 // Load translation files required by the page
34 $langs->loadLangs(array("categories", "admin"));
35 
36 $action = GETPOST('action', 'aZ09');
37 
38 /*
39  * Actions
40  */
41 
42 $reg = array();
43 if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
44 {
45  $code = $reg[1];
46  if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
47  {
48  header("Location: ".$_SERVER["PHP_SELF"]);
49  exit;
50  } else {
51  setEventMessages($db->lasterror(), null, 'errors');
52  }
53 }
54 
55 if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
56 {
57  $code = $reg[1];
58  if (dolibarr_del_const($db, $code, $conf->entity) > 0)
59  {
60  header("Location: ".$_SERVER["PHP_SELF"]);
61  exit;
62  } else {
63  setEventMessages($db->lasterror(), null, 'errors');
64  }
65 }
66 
67 
68 
69 /*
70  * View
71  */
72 
73 $help_url = 'EN:Module Categories|FR:Module Catégories|ES:Módulo Categorías';
74 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
75 
76 llxHeader('', $langs->trans("Categories"), $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("CategoriesSetup"), $linkback, 'title_setup');
80 
81 
83 
84 print dol_get_fiche_head($head, 'setup', $langs->trans("Categories"), -1, 'category');
85 
86 
87 print '<table class="noborder centpercent">';
88 print '<tr class="liste_titre">';
89 print '<td>'.$langs->trans("Description").'</td>';
90 print '<td align="center" width="20">&nbsp;</td>';
91 print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
92 print '</tr>';
93 
94 $form = new Form($db);
95 
96 // Mail required for members
97 
98 print '<tr class="oddeven">';
99 print '<td>'.$langs->trans("CategorieRecursiv").'</td>';
100 print '<td align="center" width="20">'.$form->textwithpicto('', $langs->trans("CategorieRecursivHelp"), 1, 'help').'</td>';
101 
102 print '<td align="center" width="100">';
103 if ($conf->use_javascript_ajax)
104 {
105  print ajax_constantonoff('CATEGORIE_RECURSIV_ADD');
106 } else {
107  if (empty($conf->global->CATEGORIE_RECURSIV_ADD))
108  {
109  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_CATEGORIE_RECURSIV_ADD">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
110  } else {
111  print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_CATEGORIE_RECURSIV_ADD">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
112  }
113 }
114 print '</td></tr>';
115 
116 print '</table>';
117 
118 // End of page
119 llxFooter();
120 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
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.
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
categoriesadmin_prepare_head()
Prepare array with list of tabs.
llxFooter()
Empty footer.
Definition: wrapper.php:59