categories.lib.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.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 <http://www.gnu.org/licenses/>.
  16. * or see http://www.gnu.org/
  17. */
  18. /**
  19. * \file htdocs/core/lib/categories.lib.php
  20. * \brief Ensemble de fonctions de base pour le module categorie
  21. * \ingroup categorie
  22. */
  23. /**
  24. * Prepare array with list of tabs
  25. *
  26. * @param Object $object Object related to tabs
  27. * @param string $type Type of category
  28. * @return array Array of tabs to shoc
  29. */
  30. function categories_prepare_head($object,$type)
  31. {
  32. global $langs, $conf, $user;
  33. $langs->load("categories");
  34. $h = 0;
  35. $head = array();
  36. $head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&amp;type='.$type;
  37. $head[$h][1] = $langs->trans("Card");
  38. $head[$h][2] = 'card';
  39. $h++;
  40. $head[$h][0] = DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&amp;type='.$type;
  41. $head[$h][1] = $langs->trans("Photos");
  42. $head[$h][2] = 'photos';
  43. $h++;
  44. $head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&amp;type='.$type;
  45. $head[$h][1] = $langs->trans("Translation");
  46. $head[$h][2] = 'translation';
  47. $h++;
  48. // Show more tabs from modules
  49. // Entries must be declared in modules descriptor with line
  50. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  51. // $this->tabs = array('entity:-tabname); to remove a tab
  52. complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type);
  53. complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type,'remove');
  54. return $head;
  55. }
  56. /**
  57. * Prepare array with list of tabs
  58. *
  59. * @return array Array of tabs to show
  60. */
  61. function categoriesadmin_prepare_head()
  62. {
  63. global $langs, $conf, $user;
  64. $langs->load("categories");
  65. $h = 0;
  66. $head = array();
  67. $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie.php';
  68. $head[$h][1] = $langs->trans("Setup");
  69. $head[$h][2] = 'setup';
  70. $h++;
  71. $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php';
  72. $head[$h][1] = $langs->trans("ExtraFieldsCategories");
  73. $head[$h][2] = 'attributes_categories';
  74. $h++;
  75. // Show more tabs from modules
  76. // Entries must be declared in modules descriptor with line
  77. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  78. // $this->tabs = array('entity:-tabname); to remove a tab
  79. complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin');
  80. complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin','remove');
  81. return $head;
  82. }