New: Dut d'un outil d'exports
This commit is contained in:
parent
d6ad9a959a
commit
2b05618dc8
181
htdocs/exports/index.php
Normal file
181
htdocs/exports/index.php
Normal file
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/exports/index.php
|
||||
\ingroup core
|
||||
\brief Page accueil de la zone export
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
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 '<table class="notopnoleftnoright" width="100%">';
|
||||
|
||||
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||
|
||||
|
||||
// Liste des formats d'exports disponibles
|
||||
$var=true;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("AvilableFormats").'</td>';
|
||||
print '<td>'.$langs->trans("LibraryUsed").'</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>Excel</td><td>Php_WriteExcel</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>Csv</td><td>Dolibarr</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
|
||||
|
||||
// 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("ExportableDatas").'</td>';
|
||||
print '</tr>';
|
||||
$val=true;
|
||||
foreach ($array_export_code as $key => $value)
|
||||
{
|
||||
$val=!$val;
|
||||
print '<tr '.$bc[$val].'><td>';
|
||||
print img_object($array_export_module[$key]->getName(),$array_export_module[$key]->picto).' ';
|
||||
print $array_export_module[$key]->getName();
|
||||
print '</td><td>';
|
||||
print $array_export_label[$key];
|
||||
print '</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 '<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)
|
||||
{
|
||||
$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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
?>
|
||||
45
htdocs/exports/pre.inc.php
Normal file
45
htdocs/exports/pre.inc.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/exports/pre.inc.php
|
||||
\ingroup core
|
||||
\brief Fichier de gestion du menu gauche de l'espace exports
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
|
||||
|
||||
function llxHeader($head = "", $title = "")
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
||||
top_menu($head, $title);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/exports/index.php", $langs->trans("Exports"));
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user