From 2b05618dc8c185ee57047217b8f20d5dcc5467d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2005 22:42:51 +0000 Subject: [PATCH] =?UTF-8?q?New:=20D=E9ut=20d'un=20outil=20d'exports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/exports/index.php | 181 +++++++++++++++++++++++++++++++++++++ htdocs/exports/pre.inc.php | 45 +++++++++ 2 files changed, 226 insertions(+) create mode 100644 htdocs/exports/index.php create mode 100644 htdocs/exports/pre.inc.php diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php new file mode 100644 index 00000000000..34b99b947c7 --- /dev/null +++ b/htdocs/exports/index.php @@ -0,0 +1,181 @@ + + * + * 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 ''; + +print ''; +print '
'; + + +// Liste des formats d'exports disponibles +$var=true; +print ''; +print ''; +print ''; +print ''; +$var=!$var; +print ''; +$var=!$var; +print ''; +print '
'.$langs->trans("AvilableFormats").''.$langs->trans("LibraryUsed").'
ExcelPhp_WriteExcel
CsvDolibarr
'; + + +print '
'; + + +// Affiche les modules d'exports +print ''; +print ''; +print ''; +print ''; +print ''; +$val=true; +foreach ($array_export_code as $key => $value) +{ + $val=!$val; + print ''; + +} +print '
'.$langs->trans("Module").''.$langs->trans("ExportableDatas").'
'; + 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 '
'; + + +// 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 ''; + print ''; + + $num = $db->num_rows($result); + if ($num > 0) + { + $var = true; + $i = 0; + + while ($i < $num ) + { + $obj = $db->fetch_object($result); + $var=!$var; + + print ""; + print ''; + print ''; + print ''; + $i++; + } + } +} +print "
'.$langs->trans("ExportProfiles").''.$langs->trans("Public").'
'.$obj->label.''.$yn($obj->public).'

"; + + +print '
'; + +$db->close(); + + +llxFooter('$Date$ - $Revision$'); + +?> diff --git a/htdocs/exports/pre.inc.php b/htdocs/exports/pre.inc.php new file mode 100644 index 00000000000..c75d0eae1c3 --- /dev/null +++ b/htdocs/exports/pre.inc.php @@ -0,0 +1,45 @@ + + * + * 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); +} + +?>