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       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/**
24 *  \file       htdocs/core/lib/import.lib.php
25 *  \brief      Ensemble de fonctions de base pour le module import
26 *  \ingroup    import
27
28/**
29 * Function to return list of tabs for import pages
30 *
31 * @param	string		$param		Params to add on url links
32 * @param	int			$maxstep	Limit steps to maxstep or no limit if 0
33 * @return	array					Array of tabs
34 */
35function import_prepare_head($param, $maxstep = 0)
36{
37	global $langs;
38
39	if (empty($maxstep)) {
40		$maxstep = 6;
41	}
42
43	$h = 0;
44	$head = array();
45	$i = 1;
46	while ($i <= $maxstep) {
47		if ($i < 6) {
48			$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
49		} else {
50			$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=5'.$param;	// For step6, link is to step 5
51		}
52		$head[$h][1] = $langs->trans("Step")." ".$i;
53		$head[$h][2] = 'step'.$i;
54		$h++;
55		$i++;
56	}
57
58	return $head;
59}
60