dolibarr  16.0.5
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 
32 function categories_prepare_head(Categorie $object, $type)
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 (!empty($conf->global->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;
84 
85  $langs->load("categories");
86 
87  $h = 0;
88  $head = array();
89 
90  $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie.php';
91  $head[$h][1] = $langs->trans("Setup");
92  $head[$h][2] = 'setup';
93  $h++;
94 
95  $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php';
96  $head[$h][1] = $langs->trans("ExtraFieldsCategories");
97  $head[$h][2] = 'attributes_categories';
98  $h++;
99 
100  // Show more tabs from modules
101  // Entries must be declared in modules descriptor with line
102  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
103  // $this->tabs = array('entity:-tabname); to remove a tab
104  complete_head_from_modules($conf, $langs, null, $head, $h, 'categoriesadmin');
105 
106  complete_head_from_modules($conf, $langs, null, $head, $h, 'categoriesadmin', 'remove');
107 
108  return $head;
109 }
complete_head_from_modules
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add')
Complete or removed entries into a head array (used to build tabs).
Definition: functions.lib.php:9038
Categorie
Class to manage categories.
Definition: categorie.class.php:47
categoriesadmin_prepare_head
categoriesadmin_prepare_head()
Prepare array with list of tabs.
Definition: categories.lib.php:81
categories_prepare_head
categories_prepare_head(Categorie $object, $type)
Prepare array with list of tabs.
Definition: categories.lib.php:32