dolibarr  20.0.0-alpha
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 = GETPOSTINT('id');
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);
53  exit;
54 }
55 
56 $type = $object->type;
57 if (is_numeric($type)) {
58  $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
59 }
60 
61 /*
62  * View
63  */
64 
65 $form = new Form($db);
66 
67 llxHeader('', $langs->trans('Categories'), '');
68 
69 //$object->info($object->id);
70 
71 $title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
72 
73 $head = categories_prepare_head($object, $type);
74 print dol_get_fiche_head($head, 'info', $langs->trans($title), -1, 'category');
75 
76 $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type));
77 $linkback = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>';
78 $object->next_prev_filter = 'type = '.((int) $object->type);
79 $object->ref = $object->label;
80 $morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type).'">'.$langs->trans("Root").'</a> >> ';
81 $ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
82 foreach ($ways as $way) {
83  $morehtmlref .= $way."<br>\n";
84 }
85 $morehtmlref .= '</div>';
86 
87 dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type='.$type, 0, '', '', 1);
88 
89 print '<br>';
90 
91 print '<div class="fichecenter">';
92 print '<div class="underbanner clearboth"></div>';
93 
94 print '<br>';
95 
96 print '<table "border centpercent tableforfield">';
97 
98 print '<tr><td>';
100 print '</td></tr>';
101 
102 print '</table>';
103 
104 print '</div>';
105 
106 print dol_get_fiche_end();
107 
108 // End of page
109 llxFooter();
110 $db->close();
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
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 information on an object TODO Move this into html.formother.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.