dolibarr 21.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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Load Dolibarr environment
28require '../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
30
39if (!$user->admin) {
41}
42
43// Load translation files required by the page
44$langs->loadLangs(array("categories", "admin"));
45
46$action = GETPOST('action', 'aZ09');
47
48/*
49 * Actions
50 */
51
52$reg = array();
53if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
54 $code = $reg[1];
55 if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
56 header("Location: ".$_SERVER["PHP_SELF"]);
57 exit;
58 } else {
59 setEventMessages($db->lasterror(), null, 'errors');
60 }
61}
62
63if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
64 $code = $reg[1];
65 if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
66 header("Location: ".$_SERVER["PHP_SELF"]);
67 exit;
68 } else {
69 setEventMessages($db->lasterror(), null, 'errors');
70 }
71}
72
73
74
75/*
76 * View
77 */
78
79$help_url = 'EN:Module Categories|FR:Module Catégories|ES:Módulo Categorías|DE:Modul_Kategorien';
80$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
81
82llxHeader('', $langs->trans("Categories"), $help_url);
83
84$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
85print load_fiche_titre($langs->trans("CategoriesSetup"), $linkback, 'title_setup');
86
87
89
90print dol_get_fiche_head($head, 'setup', $langs->trans("Categories"), -1, 'category');
91
92
93print '<table class="noborder centpercent">';
94print '<tr class="liste_titre">';
95print '<td>'.$langs->trans("Description").'</td>';
96print '<td align="center" width="20">&nbsp;</td>';
97print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
98print '</tr>';
99
100$form = new Form($db);
101
102// Mail required for members
103
104print '<tr class="oddeven">';
105print '<td>'.$langs->trans("CategorieRecursiv").'</td>';
106print '<td align="center" width="20">'.$form->textwithpicto('', $langs->trans("CategorieRecursivHelp"), 1, 'help').'</td>';
107
108print '<td align="center" width="100">';
109if ($conf->use_javascript_ajax) {
110 print ajax_constantonoff('CATEGORIE_RECURSIV_ADD');
111} else {
112 if (!getDolGlobalString('CATEGORIE_RECURSIV_ADD')) {
113 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_CATEGORIE_RECURSIV_ADD&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
114 } else {
115 print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_CATEGORIE_RECURSIV_ADD&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
116 }
117}
118print '</td></tr>';
119
120print '</table>';
121
122// End of page
123llxFooter();
124$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:71
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.