contact.lib.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. * or see http://www.gnu.org/
  18. */
  19. /**
  20. * \file htdocs/core/lib/contact.lib.php
  21. * \brief Ensemble de fonctions de base pour les contacts
  22. */
  23. /**
  24. * Prepare array with list of tabs
  25. *
  26. * @param Object $object Object related to tabs
  27. * @return array Array of tabs to shoc
  28. */
  29. function contact_prepare_head($object)
  30. {
  31. global $langs, $conf, $user;
  32. $h = 0;
  33. $head = array();
  34. $head[$h][0] = DOL_URL_ROOT.'/contact/fiche.php?id='.$object->id;
  35. $head[$h][1] = $langs->trans("Card");
  36. $head[$h][2] = 'card';
  37. $h++;
  38. if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE))
  39. {
  40. $langs->load("ldap");
  41. $head[$h][0] = DOL_URL_ROOT.'/contact/ldap.php?id='.$object->id;
  42. $head[$h][1] = $langs->trans("LDAPCard");
  43. $head[$h][2] = 'ldap';
  44. $h++;
  45. }
  46. $head[$h][0] = DOL_URL_ROOT.'/contact/perso.php?id='.$object->id;
  47. $head[$h][1] = $langs->trans("PersonalInformations");
  48. $head[$h][2] = 'perso';
  49. $h++;
  50. $head[$h][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$object->id;
  51. $head[$h][1] = $langs->trans("ExportImport");
  52. $head[$h][2] = 'exportimport';
  53. $h++;
  54. // Show more tabs from modules
  55. // Entries must be declared in modules descriptor with line
  56. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  57. // $this->tabs = array('entity:-tabname); to remove a tab
  58. complete_head_from_modules($conf,$langs,$object,$head,$h,'contact');
  59. // Notes
  60. $head[$h][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id;
  61. $head[$h][1] = $langs->trans("Note");
  62. $head[$h][2] = 'note';
  63. $h++;
  64. if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
  65. {
  66. $type = 4;
  67. $head[$h][0] = DOL_URL_ROOT.'/categories/categorie.php?id='.$object->id."&type=".$type;
  68. $head[$h][1] = $langs->trans('Categories');
  69. $head[$h][2] = 'category';
  70. $h++;
  71. }
  72. // Info
  73. $head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id;
  74. $head[$h][1] = $langs->trans("Info");
  75. $head[$h][2] = 'info';
  76. $h++;
  77. complete_head_from_modules($conf,$langs,$object,$head,$h,'contact','remove');
  78. return $head;
  79. }