dolibarr  7.0.0-beta
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 $langs->load("categories");
34 
35 $action=GETPOST('action','aZ09');
36 
37 /*
38  * Actions
39  */
40 
41 if (preg_match('/set_(.*)/',$action,$reg))
42 {
43  $code=$reg[1];
44  if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
45  {
46  header("Location: ".$_SERVER["PHP_SELF"]);
47  exit;
48  }
49  else
50  {
51  setEventMessages($db->lasterror(), null, 'errors');
52  }
53 }
54 
55 if (preg_match('/del_(.*)/',$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  }
63  else
64  {
65  setEventMessages($db->lasterror(), null, 'errors');
66  }
67 }
68 
69 
70 
71 /*
72  * View
73  */
74 
75 $help_url='EN:Module Categories|FR:Module Catégories|ES:Módulo Categorías';
76 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
77 
78 llxHeader('',$langs->trans("Categories"),$help_url);
79 
80 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
81 print load_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'title_setup');
82 
83 
85 
86 dol_fiche_head($head, 'setup', $langs->trans("Categories"), -1, 'category');
87 
88 
89 print '<table class="noborder" width="100%">';
90 print '<tr class="liste_titre">';
91 print '<td>'.$langs->trans("Description").'</td>';
92 print '<td align="center" width="20">&nbsp;</td>';
93 print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
94 print '</tr>';
95 
96 $var=true;
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 llxFooter();
126 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
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:485
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $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)
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'une constante dans la base de donnees.
Definition: admin.lib.php:410
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
print
Draft customers invoices.
Definition: index.php:91
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0)
On/off button for constant.
Definition: ajax.lib.php:500
categoriesadmin_prepare_head()
Prepare array with list of tabs.