info.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. /**
  20. * \file htdocs/categories/info.php
  21. * \ingroup categories
  22. * \brief Category info page
  23. */
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
  28. if (!$user->rights->categorie->lire) {
  29. accessforbidden();
  30. }
  31. // Load translation files required by the page
  32. $langs->loadLangs(array('categories', 'sendings'));
  33. $socid = 0;
  34. $id = GETPOST('id', 'int');
  35. $label = GETPOST('label', 'alpha');
  36. // Security check
  37. if ($user->socid) {
  38. $socid = $user->socid;
  39. }
  40. $result = restrictedArea($user, 'categorie', $id, '&category');
  41. $object = new Categorie($db);
  42. $result = $object->fetch($id, $label);
  43. if ($result <= 0) {
  44. dol_print_error($db, $object->error); exit;
  45. }
  46. $type = $object->type;
  47. if (is_numeric($type)) {
  48. $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
  49. }
  50. /*
  51. * View
  52. */
  53. $form = new Form($db);
  54. llxHeader('', $langs->trans('Categories'), '');
  55. //$object->info($object->id);
  56. $title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
  57. $head = categories_prepare_head($object, $type);
  58. print dol_get_fiche_head($head, 'info', $langs->trans($title), -1, 'category');
  59. $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
  60. $linkback = '<a href="'.$backtolist.'">'.$langs->trans("BackToList").'</a>';
  61. $object->next_prev_filter = ' type = '.$object->type;
  62. $object->ref = $object->label;
  63. $morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
  64. $ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
  65. foreach ($ways as $way) {
  66. $morehtmlref .= $way."<br>\n";
  67. }
  68. $morehtmlref .= '</div>';
  69. dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type='.$type, 0, '', '', 1);
  70. print '<br>';
  71. print '<div class="fichecenter">';
  72. print '<div class="underbanner clearboth"></div>';
  73. print '<br>';
  74. print '<table "border centpercent tableforfield">';
  75. print '<tr><td>';
  76. dol_print_object_info($object);
  77. print '</td></tr>';
  78. print '</table>';
  79. print '</div>';
  80. print dol_get_fiche_end();
  81. // End of page
  82. llxFooter();
  83. $db->close();