dolibarr 21.0.0-alpha
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// Load Dolibarr environment
27require '../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
29
30
31if (!$user->admin) {
33}
34
35// Load translation files required by the page
36$langs->loadLangs(array("categories", "admin"));
37
38$action = GETPOST('action', 'aZ09');
39
40/*
41 * Actions
42 */
43
44$reg = array();
45if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
46 $code = $reg[1];
47 if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
48 header("Location: ".$_SERVER["PHP_SELF"]);
49 exit;
50 } else {
51 setEventMessages($db->lasterror(), null, 'errors');
52 }
53}
54
55if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
56 $code = $reg[1];
57 if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
58 header("Location: ".$_SERVER["PHP_SELF"]);
59 exit;
60 } else {
61 setEventMessages($db->lasterror(), null, 'errors');
62 }
63}
64
65
66
67/*
68 * View
69 */
70
71$help_url = 'EN:Module Categories|FR:Module Catégories|ES:Módulo Categorías|DE:Modul_Kategorien';
72$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
73
74llxHeader('', $langs->trans("Categories"), $help_url);
75
76$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
77print load_fiche_titre($langs->trans("CategoriesSetup"), $linkback, 'title_setup');
78
79
81
82print dol_get_fiche_head($head, 'setup', $langs->trans("Categories"), -1, 'category');
83
84
85print '<table class="noborder centpercent">';
86print '<tr class="liste_titre">';
87print '<td>'.$langs->trans("Description").'</td>';
88print '<td align="center" width="20">&nbsp;</td>';
89print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
90print '</tr>';
91
92$form = new Form($db);
93
94// Mail required for members
95
96print '<tr class="oddeven">';
97print '<td>'.$langs->trans("CategorieRecursiv").'</td>';
98print '<td align="center" width="20">'.$form->textwithpicto('', $langs->trans("CategorieRecursivHelp"), 1, 'help').'</td>';
99
100print '<td align="center" width="100">';
101if ($conf->use_javascript_ajax) {
102 print ajax_constantonoff('CATEGORIE_RECURSIV_ADD');
103} else {
104 if (!getDolGlobalString('CATEGORIE_RECURSIV_ADD')) {
105 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_CATEGORIE_RECURSIV_ADD&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
106 } else {
107 print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_CATEGORIE_RECURSIV_ADD&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
108 }
109}
110print '</td></tr>';
111
112print '</table>';
113
114// End of page
115llxFooter();
116$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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
categoriesadmin_prepare_head()
Prepare array with list of tabs.
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.