dolibarr 20.0.0
categories.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 * or see https://www.gnu.org/
17 */
18
33{
34 global $langs, $conf, $user;
35
36 // Load translation files required by the page
37 $langs->loadLangs(array('categories', 'products'));
38
39 $h = 0;
40 $head = array();
41
42 $head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&amp;type='.$type;
43 $head[$h][1] = $langs->trans("Category");
44 $head[$h][2] = 'card';
45 $h++;
46
47 $head[$h][0] = DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&amp;type='.$type;
48 $head[$h][1] = $langs->trans("Photos");
49 $head[$h][2] = 'photos';
50 $h++;
51
52 if (getDolGlobalInt('MAIN_MULTILANGS')) {
53 $head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&amp;type='.$type;
54 $head[$h][1] = $langs->trans("Translation");
55 $head[$h][2] = 'translation';
56 $h++;
57 }
58
59 $head[$h][0] = DOL_URL_ROOT.'/categories/info.php?id='.$object->id.'&amp;type='.$type;
60 $head[$h][1] = $langs->trans("Info");
61 $head[$h][2] = 'info';
62 $h++;
63
64 // Show more tabs from modules
65 // Entries must be declared in modules descriptor with line
66 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
67 // $this->tabs = array('entity:-tabname); to remove a tab
68 complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type);
69
70 complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type, 'remove');
71
72 return $head;
73}
74
75
82{
83 global $langs, $conf, $user, $db;
84
85 $extrafields = new ExtraFields($db);
86 $extrafields->fetch_name_optionals_label('categorie');
87
88 $langs->load("categories");
89
90 $h = 0;
91 $head = array();
92
93 $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie.php';
94 $head[$h][1] = $langs->trans("Setup");
95 $head[$h][2] = 'setup';
96 $h++;
97
98 $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php';
99 $head[$h][1] = $langs->trans("ExtraFieldsCategories");
100 $nbExtrafields = $extrafields->attributes['categorie']['count'];
101 if ($nbExtrafields > 0) {
102 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
103 }
104 $head[$h][2] = 'attributes_categories';
105 $h++;
106
107 // Show more tabs from modules
108 // Entries must be declared in modules descriptor with line
109 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
110 // $this->tabs = array('entity:-tabname); to remove a tab
111 complete_head_from_modules($conf, $langs, null, $head, $h, 'categoriesadmin');
112
113 complete_head_from_modules($conf, $langs, null, $head, $h, 'categoriesadmin', 'remove');
114
115 return $head;
116}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
categories_prepare_head(Categorie $object, $type)
Prepare array with list of tabs.
categoriesadmin_prepare_head()
Prepare array with list of tabs.
Class to manage categories.
Class to manage standard extra fields.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).