import.lib.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  4. * Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
  6. * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. * or see https://www.gnu.org/
  21. */
  22. /**
  23. * \file htdocs/core/lib/import.lib.php
  24. * \brief Ensemble de fonctions de base pour le module import
  25. * \ingroup import
  26. */
  27. /**
  28. * Function to return list of tabs for import pages
  29. *
  30. * @param string $param Params to add on url links
  31. * @param int $maxstep Limit steps to maxstep or no limit if 0
  32. * @return array Array of tabs
  33. */
  34. function import_prepare_head($param, $maxstep = 0)
  35. {
  36. global $langs;
  37. if (empty($maxstep)) {
  38. $maxstep = 6;
  39. }
  40. $h = 0;
  41. $head = array();
  42. $i = 1;
  43. while ($i <= $maxstep) {
  44. if ($i < 6) {
  45. $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
  46. } else {
  47. $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=5'.$param; // For step6, link is to step 5
  48. }
  49. $head[$h][1] = $langs->trans("Step")." ".$i;
  50. $head[$h][2] = 'step'.$i;
  51. $h++;
  52. $i++;
  53. }
  54. return $head;
  55. }