dolibarr  13.0.2
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  {
54  $head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&amp;type='.$type;
55  $head[$h][1] = $langs->trans("Translation");
56  $head[$h][2] = 'translation';
57  $h++;
58  }
59 
60  $head[$h][0] = DOL_URL_ROOT.'/categories/info.php?id='.$object->id;
61  $head[$h][1] = $langs->trans("Info");
62  $head[$h][2] = 'info';
63  $h++;
64 
65  // Show more tabs from modules
66  // Entries must be declared in modules descriptor with line
67  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
68  // $this->tabs = array('entity:-tabname); to remove a tab
69  complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type);
70 
71  complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type, 'remove');
72 
73  return $head;
74 }
75 
76 
83 {
84  global $langs, $conf, $user;
85 
86  $langs->load("categories");
87 
88  $h = 0;
89  $head = array();
90 
91  $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie.php';
92  $head[$h][1] = $langs->trans("Setup");
93  $head[$h][2] = 'setup';
94  $h++;
95 
96  $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php';
97  $head[$h][1] = $langs->trans("ExtraFieldsCategories");
98  $head[$h][2] = 'attributes_categories';
99  $h++;
100 
101  // Show more tabs from modules
102  // Entries must be declared in modules descriptor with line
103  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
104  // $this->tabs = array('entity:-tabname); to remove a tab
105  complete_head_from_modules($conf, $langs, null, $head, $h, 'categoriesadmin');
106 
107  complete_head_from_modules($conf, $langs, null, $head, $h, 'categoriesadmin', 'remove');
108 
109  return $head;
110 }
categories_prepare_head(Categorie $object, $type)
Prepare array with list of tabs.
Class to manage categories.
categoriesadmin_prepare_head()
Prepare array with list of tabs.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).