categories.lib.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 show
  29. */
  30. function categories_prepare_head($object,$type)
  31. {
  32. global $langs, $conf, $user;
  33. $langs->load("categories");
  34. $langs->load("products");
  35. $h = 0;
  36. $head = array();
  37. $head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&amp;type='.$type;
  38. $head[$h][1] = $langs->trans("Card");
  39. $head[$h][2] = 'card';
  40. $h++;
  41. $head[$h][0] = DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&amp;type='.$type;
  42. $head[$h][1] = $langs->trans("Photos");
  43. $head[$h][2] = 'photos';
  44. $h++;
  45. if (! empty($conf->global->MAIN_MULTILANGS))
  46. {
  47. $head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&amp;type='.$type;
  48. $head[$h][1] = $langs->trans("Translation");
  49. $head[$h][2] = 'translation';
  50. $h++;
  51. }
  52. // Show more tabs from modules
  53. // Entries must be declared in modules descriptor with line
  54. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  55. // $this->tabs = array('entity:-tabname); to remove a tab
  56. complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type);
  57. complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type,'remove');
  58. return $head;
  59. }
  60. /**
  61. * Prepare array with list of tabs
  62. *
  63. * @return array Array of tabs to show
  64. */
  65. function categoriesadmin_prepare_head()
  66. {
  67. global $langs, $conf, $user;
  68. $langs->load("categories");
  69. $h = 0;
  70. $head = array();
  71. $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie.php';
  72. $head[$h][1] = $langs->trans("Setup");
  73. $head[$h][2] = 'setup';
  74. $h++;
  75. $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php';
  76. $head[$h][1] = $langs->trans("ExtraFieldsCategories");
  77. $head[$h][2] = 'attributes_categories';
  78. $h++;
  79. // Show more tabs from modules
  80. // Entries must be declared in modules descriptor with line
  81. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  82. // $this->tabs = array('entity:-tabname); to remove a tab
  83. complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin');
  84. complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin','remove');
  85. return $head;
  86. }