*
* 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: index.php,v 1.1 2005/09/11 22:42:51 eldy Exp $
* $Source: /srv/cvs/sources/dolibarr/dolibarr/htdocs/exports/index.php,v $
*/
/**
\file htdocs/exports/index.php
\ingroup core
\brief Page accueil de la zone export
\version $Revision: 1.1 $
*/
require("./pre.inc.php");
$langs->load("commercial");
$langs->load("orders");
$user->getrights();
if (! $user->rights->mailing->lire || $user->societe_id > 0)
accessforbidden();
$dir=DOL_DOCUMENT_ROOT."/includes/modules";
$handle=opendir($dir);
// Recherche des exports disponibles
$var=True;
$i=0;
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
if (eregi("(.*)\.class\.php",$file,$reg))
{
$modulename=$reg[1];
// Chargement de la classe
$file = $dir."/".$modulename.".class.php";
$classname = $modulename;
require_once($file);
$module = new $classname($db);
if (is_array($module->export_code))
{
foreach($module->export_code as $r => $value)
{
$perm=$module->export_permission[$r][0];
if (strlen($perms[2]) > 0)
{
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
}
else
{
$bool=$user->rights->$perm[0]->$perm[1];
}
if ($bool)
{
$array_export_module[$i]=$module;
$array_export_code[$i]=$module->export_code[$r];
$array_export_label[$i]=$module->export_label[$r];
$array_export_fields_code[$i]=$module->export_fields_code[$r];
$array_export_fields_label[$i]=$module->export_fields_label[$r];
$array_export_sql[$i]=$module->export_sql[$r];
$i++;
}
}
}
}
}
}
closedir($handle);
llxHeader('',$langs->trans("ExportsArea"));
print_fiche_titre($langs->trans("ExportsArea"));
print '
';
print '';
// Liste des formats d'exports disponibles
$var=true;
print '';
print '';
print ''.$langs->trans("AvilableFormats").' | ';
print ''.$langs->trans("LibraryUsed").' | ';
$var=!$var;
print 'Excel | Php_WriteExcel | ';
$var=!$var;
print 'Csv | Dolibarr | ';
print ' ';
print ' | ';
// Affiche les modules d'exports
print '';
print '';
print ''.$langs->trans("Module").' | ';
print ''.$langs->trans("ExportableDatas").' | ';
print ' ';
$val=true;
foreach ($array_export_code as $key => $value)
{
$val=!$val;
print '';
print img_object($array_export_module[$key]->getName(),$array_export_module[$key]->picto).' ';
print $array_export_module[$key]->getName();
print ' | ';
print $array_export_label[$key];
print ' | ';
}
print ' ';
// 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 '';
print '';
print ''.$langs->trans("ExportProfiles").' | ';
print ''.$langs->trans("Public").' | ';
$num = $db->num_rows($result);
if ($num > 0)
{
$var = true;
$i = 0;
while ($i < $num )
{
$obj = $db->fetch_object($result);
$var=!$var;
print "";
print ''.$obj->label.' | ';
print ''.$yn($obj->public).' | ';
print ' ';
$i++;
}
}
}
print " ";
print ' |
';
print '
';
$db->close();
llxFooter('$Date: 2005/09/11 22:42:51 $ - $Revision: 1.1 $');
?>