dolibarr  19.0.0-dev
info.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2017 Ferran Marcet <fmarcet@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
27 require '../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
31 
32 if (!$user->hasRight('categorie', 'lire')) {
34 }
35 
36 // Load translation files required by the page
37 $langs->loadLangs(array('categories', 'sendings'));
38 
39 $socid = 0;
40 $id = GETPOST('id', 'int');
41 $label = GETPOST('label', 'alpha');
42 
43 // Security check
44 if ($user->socid) {
45  $socid = $user->socid;
46 }
47 $result = restrictedArea($user, 'categorie', $id, '&category');
48 
49 $object = new Categorie($db);
50 $result = $object->fetch($id, $label);
51 if ($result <= 0) {
52  dol_print_error($db, $object->error); exit;
53 }
54 
55 $type = $object->type;
56 if (is_numeric($type)) {
57  $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
58 }
59 
60 /*
61  * View
62  */
63 
64 $form = new Form($db);
65 
66 llxHeader('', $langs->trans('Categories'), '');
67 
68 //$object->info($object->id);
69 
70 $title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
71 
72 $head = categories_prepare_head($object, $type);
73 print dol_get_fiche_head($head, 'info', $langs->trans($title), -1, 'category');
74 
75 $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type));
76 $linkback = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>';
77 $object->next_prev_filter = ' type = '.$object->type;
78 $object->ref = $object->label;
79 $morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type).'">'.$langs->trans("Root").'</a> >> ';
80 $ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
81 foreach ($ways as $way) {
82  $morehtmlref .= $way."<br>\n";
83 }
84 $morehtmlref .= '</div>';
85 
86 dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type='.$type, 0, '', '', 1);
87 
88 print '<br>';
89 
90 print '<div class="fichecenter">';
91 print '<div class="underbanner clearboth"></div>';
92 
93 print '<br>';
94 
95 print '<table "border centpercent tableforfield">';
96 
97 print '<tr><td>';
98 dol_print_object_info($object);
99 print '</td></tr>';
100 
101 print '</table>';
102 
103 print '</div>';
104 
105 print dol_get_fiche_end();
106 
107 // End of page
108 llxFooter();
109 $db->close();
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
categories_prepare_head(Categorie $object, $type)
Prepare array with list of tabs.
Class to manage categories.
Class to manage generation of HTML components Only common components must be here.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
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.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.