dolibarr/htdocs/imports/index.php

142 lines
4.1 KiB
PHP
Raw Normal View History

2007-04-27 14:33:27 +02:00
<?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
2007-04-27 14:33:27 +02:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
2007-04-27 14:33:27 +02:00
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2011-08-01 01:45:11 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2007-04-27 14:33:27 +02:00
*/
/**
2010-07-21 14:35:56 +02:00
* \file htdocs/imports/index.php
2009-11-04 21:58:56 +01:00
* \ingroup import
* \brief Home page of import wizard
2009-05-19 02:33:57 +02:00
*/
require_once '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/imports/class/import.class.php';
2007-04-27 14:33:27 +02:00
2007-10-22 20:03:54 +02:00
$langs->load("exports");
2007-04-27 14:33:27 +02:00
2007-10-22 20:03:54 +02:00
if (! $user->societe_id == 0)
2007-04-27 14:33:27 +02:00
accessforbidden();
2009-03-25 22:26:15 +01:00
$import=new Import($db);
2009-05-19 02:33:57 +02:00
$import->load_arrays($user);
/*
* View
*/
2007-10-22 20:03:54 +02:00
$form=new Form($db);
2009-09-28 22:06:15 +02:00
2009-08-12 14:59:14 +02:00
llxHeader('',$langs->trans("ImportArea"),'EN:Module_Imports_En|FR:Module_Imports|ES:M&oacute;dulo_Importaciones');
2007-10-22 20:03:54 +02:00
print_fiche_titre($langs->trans("ImportArea"));
print $langs->trans("FormatedImportDesc1").'<br>';
print $langs->trans("FormatedImportDesc2").'<br>';
print '<br>';
2007-04-27 14:33:27 +02:00
2013-04-03 15:45:06 +02:00
print '<div class="fichecenter"><div class="fichethirdleft">';
2012-09-09 16:32:03 +02:00
// List of import set
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>';
print '<td>'.$langs->trans("ImportableDatas").'</td>';
//print '<td>&nbsp;</td>';
print '</tr>';
$val=true;
if (count($import->array_import_code))
{
foreach ($import->array_import_code as $key => $value)
{
$val=!$val;
print '<tr '.$bc[$val].'><td>';
print img_object($import->array_import_module[$key]->getName(),$import->array_import_module[$key]->picto).' ';
print $import->array_import_module[$key]->getName();
print '</td><td>';
$string=$langs->trans($import->array_import_label[$key]);
print ($string!=$import->array_import_label[$key]?$string:$import->array_import_label[$key]);
print '</td>';
// print '<td width="24">';
// print '<a href="'.DOL_URL_ROOT.'/imports/import.php?step=2&amp;datatoimport='.$import->array_import_code[$key].'&amp;action=cleanselect">'.img_picto($langs->trans("NewImport"),'filenew').'</a>';
// print '</td>';
print '</tr>';
}
}
else
{
print '<tr><td '.$bc[false].' colspan="2">'.$langs->trans("NoImportableData").'</td></tr>';
}
print '</table>';
print '<br>';
print '<center>';
if (count($import->array_import_code))
{
//if ($user->rights->import->run)
//{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import">'.$langs->trans("NewImport").'</a>';
//}
//else
//{
// print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("NewImport").'</a>';
//}
}
print '</center>';
2013-06-05 16:24:32 +02:00
print '<br>';
2007-04-27 14:33:27 +02:00
2013-04-03 15:45:06 +02:00
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
2012-09-09 16:32:03 +02:00
// List of available import format
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("AvailableFormats").'</td>';
print '<td>'.$langs->trans("LibraryShort").'</td>';
print '<td align="right">'.$langs->trans("LibraryVersion").'</td>';
print '</tr>';
include_once DOL_DOCUMENT_ROOT.'/core/modules/import/modules_import.php';
$model=new ModeleImports();
$liste=$model->liste_modeles($db);
foreach($liste as $key)
{
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td width="16">'.img_picto_common($model->getDriverLabelForKey($key),$model->getPictoForKey($key)).'</td>';
$text=$model->getDriverDescForKey($key);
print '<td>'.$form->textwithpicto($model->getDriverLabelForKey($key),$text).'</td>';
print '<td>'.$model->getLibLabelForKey($key).'</td>';
print '<td class="nowrap" align="right">'.$model->getLibVersionForKey($key).'</td>';
2012-09-09 16:32:03 +02:00
print '</tr>';
}
print '</table>';
2007-10-22 20:03:54 +02:00
2009-07-29 21:47:15 +02:00
2013-04-03 15:45:06 +02:00
print '</div></div></div>';
2007-04-27 14:33:27 +02:00
2007-10-22 20:03:54 +02:00
llxFooter();
2007-10-22 20:03:54 +02:00
2013-06-05 16:24:32 +02:00
$db->close();
2007-04-27 14:33:27 +02:00
?>