dolibarr/htdocs/admin/import/index.php

165 lines
4.8 KiB
PHP
Raw Normal View History

2007-04-27 14:33:27 +02:00
<?php
2007-10-22 20:03:54 +02:00
/* Copyright (C) 2005-2007 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 2 of the License, or
* (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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
2008-01-20 20:24:05 +01:00
\file htdocs/admin/imports/index.php
2007-10-22 20:03:54 +02:00
\ingroup core
\brief Page accueil de la zone import
\version $Revision$
2007-04-27 14:33:27 +02:00
*/
2007-10-22 20:03:54 +02:00
require_once("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/admin/import/dolibarrimport.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();
2007-10-22 20:03:54 +02:00
$export=new DolibarrImport($db);
//$export->load_arrays($user);
llxHeader('',$langs->trans("ImportArea"));
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
2007-10-22 20:03:54 +02:00
print '<table class="notopnoleftnoright" width="100%">';
2007-04-27 14:33:27 +02:00
2007-10-22 20:03:54 +02:00
print '<tr><td valign="top" width="30%" class="notopnoleft">';
2007-04-27 14:33:27 +02:00
2007-10-22 20:03:54 +02:00
// Liste des formats d'exports disponibles
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("AvailableFormats").'</td>';
print '<td>'.$langs->trans("LibraryUsed").'</td>';
print '<td>'.$langs->trans("LibraryVersion").'</td>';
print '</tr>';
2007-04-27 14:33:27 +02:00
2007-10-22 20:03:54 +02:00
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/export/modules_export.php');
$model=new ModeleExports();
$liste=$model->liste_modeles($db);
2007-04-27 14:33:27 +02:00
2007-10-22 20:03:54 +02:00
foreach($liste as $key)
{
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$model->getDriverLabel($key).'</td>';
print '<td>'.$model->getLibLabel($key).'</td>';
print '<td nowrap="nowrap" align="center">'.$model->getLibVersion($key).'</td>';
print '</tr>';
}
print '</table>';
2007-04-27 14:33:27 +02:00
2007-10-22 20:03:54 +02:00
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
2007-04-27 14:33:27 +02:00
2007-10-22 20:03:54 +02:00
// Affiche les modules d'exports
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 (sizeof($export->array_export_code))
2007-04-27 14:33:27 +02:00
{
2007-10-22 20:03:54 +02:00
foreach ($export->array_export_code as $key => $value)
2007-04-27 14:33:27 +02:00
{
2007-10-22 20:03:54 +02:00
$val=!$val;
print '<tr '.$bc[$val].'><td>';
print img_object($export->array_export_module[$key]->getName(),$export->array_export_module[$key]->picto).' ';
print $export->array_export_module[$key]->getName();
print '</td><td>';
$string=$langs->trans($export->array_export_label[$key]);
print ($string!=$export->array_export_label[$key]?$string:$export->array_export_label[$key]);
print '</td>';
// print '<td width="24">';
// print '<a href="'.DOL_URL_ROOT.'/exports/export.php?step=2&amp;datatoexport='.$export->array_export_code[$key].'&amp;action=cleanselect">'.img_picto($langs->trans("NewExport"),'filenew').'</a>';
// print '</td>';
print '</tr>';
2007-04-27 14:33:27 +02:00
}
2007-10-22 20:03:54 +02:00
print '<tr class="total"><td class="total" colspan="2" align="center"><form action="'.DOL_URL_ROOT.'/admin/import.php?leftmenu=import"><input type="submit" class="button" value="'.$langs->trans("NewExport").'"></form></td></tr>';
}
else
{
print '<tr><td '.$bc[false].' colspan="2">'.$langs->trans("NoImportableData").'</td></tr>';
}
print '</table>';
// Affiche les profils d'exports
$sql = "SELECT rowid, label, public, fk_user, ".$db->pdate("datec");
$sql .= " FROM ".MAIN_DB_PREFIX."export as e";
$result=$db->query($sql);
if ($result)
{
print '<br>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("ExportProfiles").'</td>';
print '<td align="right">'.$langs->trans("Public").'</td></tr>';
$num = $db->num_rows($result);
if ($num > 0)
2007-04-27 14:33:27 +02:00
{
2007-10-22 20:03:54 +02:00
$var = true;
$i = 0;
while ($i < $num )
{
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print '<td>'.$obj->label.'</td>';
print '<td align="center">'.$yn($obj->public).'</td>';
print '</tr>';
$i++;
}
2007-04-27 14:33:27 +02:00
}
2007-10-22 20:03:54 +02:00
print "</table>";
2007-04-27 14:33:27 +02:00
}
2007-10-22 20:03:54 +02:00
print '</td></tr>';
print '</table>';
2007-04-27 14:33:27 +02:00
$db->close();
2007-10-22 20:03:54 +02:00
2007-04-27 14:33:27 +02:00
llxFooter('$Date$ - $Revision$');
2007-10-22 20:03:54 +02:00
2007-04-27 14:33:27 +02:00
?>