dolibarr  9.0.0
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 <http://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->load("categories");
35 
36 $action=GETPOST('action','aZ09');
37 
38 /*
39  * Actions
40  */
41 
42 if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
43 {
44  $code=$reg[1];
45  if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
46  {
47  header("Location: ".$_SERVER["PHP_SELF"]);
48  exit;
49  }
50  else
51  {
52  setEventMessages($db->lasterror(), null, 'errors');
53  }
54 }
55 
56 if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
57 {
58  $code=$reg[1];
59  if (dolibarr_del_const($db, $code, $conf->entity) > 0)
60  {
61  header("Location: ".$_SERVER["PHP_SELF"]);
62  exit;
63  }
64  else
65  {
66  setEventMessages($db->lasterror(), null, 'errors');
67  }
68 }
69 
70 
71 
72 /*
73  * View
74  */
75 
76 $help_url='EN:Module Categories|FR:Module Catégories|ES:Módulo Categorías';
77 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
78 
79 llxHeader('',$langs->trans("Categories"),$help_url);
80 
81 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
82 print load_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'title_setup');
83 
84 
86 
87 dol_fiche_head($head, 'setup', $langs->trans("Categories"), -1, 'category');
88 
89 
90 print '<table class="noborder" width="100%">';
91 print '<tr class="liste_titre">';
92 print '<td>'.$langs->trans("Description").'</td>';
93 print '<td align="center" width="20">&nbsp;</td>';
94 print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
95 print '</tr>';
96 
97 $form = new Form($db);
98 
99 // Mail required for members
100 
101 print '<tr class="oddeven">';
102 print '<td>'.$langs->trans("CategorieRecursiv").'</td>';
103 print '<td align="center" width="20">'. $form->textwithpicto('',$langs->trans("CategorieRecursivHelp"),1,'help').'</td>';
104 
105 print '<td align="center" width="100">';
106 if ($conf->use_javascript_ajax)
107 {
108  print ajax_constantonoff('CATEGORIE_RECURSIV_ADD');
109 }
110 else
111 {
112  if (empty($conf->global->CATEGORIE_RECURSIV_ADD))
113  {
114  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_CATEGORIE_RECURSIV_ADD">'.img_picto($langs->trans("Disabled"),'off').'</a>';
115  }
116  else
117  {
118  print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_CATEGORIE_RECURSIV_ADD">'.img_picto($langs->trans("Enabled"),'on').'</a>';
119  }
120 }
121 print '</td></tr>';
122 
123 print '</table>';
124 
125 // End of page
126 llxFooter();
127 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
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:510
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
dolibarr_del_const($db, $name, $entity=1)
Effacement d&#39;une constante dans la base de donnees.
Definition: admin.lib.php:435
llxHeader()
Empty header.
Definition: wrapper.php:44
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0)
On/off button for constant.
Definition: ajax.lib.php:484
categoriesadmin_prepare_head()
Prepare array with list of tabs.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it&#39;s its name (generic function)
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.