PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/propal/lib/propal.lib.php

https://bitbucket.org/speedealing/speedealing
PHP | 106 lines | 56 code | 13 blank | 37 comment | 9 complexity | 300d513f27d7922a3d216230584490a3 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  1. <?php
  2. /* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
  4. * Copyright (C) 2012 David Moothen <dmoothen@websitti.fr>
  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 <http://www.gnu.org/licenses/>.
  18. * or see http://www.gnu.org/
  19. */
  20. /**
  21. * \file htdocs/core/lib/propal.lib.php
  22. * \brief Ensemble de fonctions de base pour le module propal
  23. * \ingroup propal
  24. */
  25. /**
  26. * Prepare array with list of tabs
  27. *
  28. * @param Object $object Object related to tabs
  29. * @return array Array of tabs to shoc
  30. */
  31. function propal_prepare_head($object)
  32. {
  33. global $langs, $conf, $user;
  34. $langs->load("propal");
  35. $langs->load("compta");
  36. $h = 0;
  37. $head = array();
  38. $head[$h][0] = DOL_URL_ROOT.'/propal/propal.php?id='.$object->id;
  39. $head[$h][1] = $langs->trans('ProposalCard');
  40. $head[$h][2] = 'comm';
  41. $h++;
  42. if ((empty($conf->commande->enabled) && ((! empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire)
  43. || (! empty($conf->livraison_bon->enabled) && $user->rights->expedition->livraison->lire))))
  44. {
  45. $langs->load("sendings");
  46. $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id;
  47. if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings");
  48. if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings");
  49. $head[$h][1] = $text;
  50. $head[$h][2] = 'shipping';
  51. $h++;
  52. }
  53. if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
  54. {
  55. $head[$h][0] = DOL_URL_ROOT.'/propal/apercu.php?id='.$object->id;
  56. $head[$h][1] = $langs->trans("Preview");
  57. $head[$h][2] = 'preview';
  58. $h++;
  59. }
  60. if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
  61. {
  62. $head[$h][0] = DOL_URL_ROOT.'/propal/contact.php?id='.$object->id;
  63. $head[$h][1] = $langs->trans('ContactsAddresses');
  64. $head[$h][2] = 'contact';
  65. $h++;
  66. }
  67. // Show more tabs from modules
  68. // Entries must be declared in modules descriptor with line
  69. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  70. // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
  71. complete_head_from_modules($conf,$langs,$object,$head,$h,'propal');
  72. if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
  73. {
  74. $head[$h][0] = DOL_URL_ROOT.'/propal/note.php?id='.$object->id;
  75. $head[$h][1] = $langs->trans('Notes');
  76. $head[$h][2] = 'note';
  77. $h++;
  78. }
  79. $head[$h][0] = DOL_URL_ROOT.'/propal/document.php?id='.$object->id;
  80. /*$filesdir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($propal->ref);
  81. include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  82. $listoffiles=dol_dir_list($filesdir,'files',1);
  83. $head[$h][1] = (count($listoffiles)?$langs->trans('DocumentsNb',count($listoffiles)):$langs->trans('Documents'));*/
  84. $head[$h][1] = $langs->trans('Documents');
  85. $head[$h][2] = 'document';
  86. $h++;
  87. $head[$h][0] = DOL_URL_ROOT.'/propal/info.php?id='.$object->id;
  88. $head[$h][1] = $langs->trans('Info');
  89. $head[$h][2] = 'info';
  90. $h++;
  91. return $head;
  92. }
  93. ?>