dolibarr  16.0.5
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 require '../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
30 
31 if (!$user->rights->categorie->lire) {
33 }
34 
35 // Load translation files required by the page
36 $langs->loadLangs(array('categories', 'sendings'));
37 
38 $socid = 0;
39 $id = GETPOST('id', 'int');
40 $label = GETPOST('label', 'alpha');
41 
42 // Security check
43 if ($user->socid) {
44  $socid = $user->socid;
45 }
46 $result = restrictedArea($user, 'categorie', $id, '&category');
47 
48 $object = new Categorie($db);
49 $result = $object->fetch($id, $label);
50 if ($result <= 0) {
51  dol_print_error($db, $object->error); exit;
52 }
53 
54 $type = $object->type;
55 if (is_numeric($type)) {
56  $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
57 }
58 
59 /*
60  * View
61  */
62 
63 $form = new Form($db);
64 
65 llxHeader('', $langs->trans('Categories'), '');
66 
67 //$object->info($object->id);
68 
69 $title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
70 
71 $head = categories_prepare_head($object, $type);
72 print dol_get_fiche_head($head, 'info', $langs->trans($title), -1, 'category');
73 
74 $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type));
75 $linkback = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>';
76 $object->next_prev_filter = ' type = '.$object->type;
77 $object->ref = $object->label;
78 $morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type).'">'.$langs->trans("Root").'</a> >> ';
79 $ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
80 foreach ($ways as $way) {
81  $morehtmlref .= $way."<br>\n";
82 }
83 $morehtmlref .= '</div>';
84 
85 dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type='.$type, 0, '', '', 1);
86 
87 print '<br>';
88 
89 print '<div class="fichecenter">';
90 print '<div class="underbanner clearboth"></div>';
91 
92 print '<br>';
93 
94 print '<table "border centpercent tableforfield">';
95 
96 print '<tr><td>';
97 dol_print_object_info($object);
98 print '</td></tr>';
99 
100 print '</table>';
101 
102 print '</div>';
103 
104 print dol_get_fiche_end();
105 
106 // End of page
107 llxFooter();
108 $db->close();
restrictedArea
restrictedArea($user, $features, $objectid=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.
Definition: security.lib.php:234
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
Categorie
Class to manage categories.
Definition: categorie.class.php:47
dol_banner_tab
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.
Definition: functions.lib.php:2046
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_print_object_info
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
Definition: functions2.lib.php:205
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
categories_prepare_head
categories_prepare_head(Categorie $object, $type)
Prepare array with list of tabs.
Definition: categories.lib.php:32
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59