diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 2aeef489d68..eafbc0de0a0 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -3155,164 +3155,6 @@ function make_alpha_from_numbers($number) } } -/* - * \brief Affiche le contenu d'un fichier CSV sous forme de tableau - * \param file_to_include Fichier CSV a afficher - * \param max_rows Nombre max de lignes a afficher (0 = illimité) - */ -function viewCsvFileContent($file_to_include='',$max_rows=0) -{ - $fic = fopen($file_to_include, 'rb'); - $count = 0; - - print ''; - for ($ligne = fgetcsv($fic, 1024); (!feof($fic) && (($max_rows > 0)?($count<=$max_rows):1==1)); $ligne = fgetcsv($fic, 1024)) - { - print ''; - $j = sizeof($ligne); - for ($i = 0; $i < $j; $i++) - { - print ''; - } - print ''; - $count++; - } - print '
'.$ligne[$i].'
'; -} - -/* - * \brief Affiche le contenu d'un fichier Excel (avec les feuilles de calcul) sous forme de tableau - * \param file_to_include Fichier Excel a afficher - * \param max_rows Nombre max de lignes a afficher (0 = illimité) - * \param max_cols Nombre max de colonnes a afficher (0 = illimité) - */ -function viewExcelFileContent($file_to_include='',$max_rows=0,$max_cols=0) -{ - $debug = 0; //1 for on 0 for off - $force_nobr = 0; //Force the info in cells not to wrap unless stated explicitly (newline) - - require_once(DOL_DOCUMENT_ROOT.'/includes/phpexcelreader/excelreader.php'); - $data = new Spreadsheet_Excel_Reader(); - $data->setOutputEncoding('CPa25a'); - $data->read($file_to_include); - error_reporting(E_ALL ^ E_NOTICE); - - echo ""; - - echo " - - "; - for($sheet=0;$sheetsheets);$sheet++) - { - echo ""; - } - - echo - ""; - echo "
", $data->boundsheets[$sheet]['name'] , "
-
- "; -} - /** \brief Retourne un tableau des mois ou le mois sélectionné diff --git a/htdocs/lib/viewfiles.lib.php b/htdocs/lib/viewfiles.lib.php new file mode 100644 index 00000000000..6af5c6a312a --- /dev/null +++ b/htdocs/lib/viewfiles.lib.php @@ -0,0 +1,187 @@ + + * Copyright (C) 2005-2007 Regis Houssin + * + * 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. + * or see http://www.gnu.org/ + * + * $Id$ + */ + +/** + \file htdocs/lib/excel.lib.php + \brief Ensemble de fonctions de base de dolibarr sous forme d'include +*/ + + +/* + * \brief Affiche le contenu d'un fichier CSV sous forme de tableau + * \param file_to_include Fichier CSV a afficher + * \param max_rows Nombre max de lignes a afficher (0 = illimité) + */ +function viewCsvFileContent($file_to_include='',$max_rows=0) +{ + $fic = fopen($file_to_include, 'rb'); + $count = 0; + + print ''; + for ($ligne = fgetcsv($fic, 1024); (!feof($fic) && (($max_rows > 0)?($count<=$max_rows):1==1)); $ligne = fgetcsv($fic, 1024)) + { + print ''; + $j = sizeof($ligne); + for ($i = 0; $i < $j; $i++) + { + print ''; + } + print ''; + $count++; + } + print '
'.$ligne[$i].'
'; +} + +/* + * \brief Affiche le contenu d'un fichier Excel (avec les feuilles de calcul) sous forme de tableau + * \param file_to_include Fichier Excel a afficher + * \param max_rows Nombre max de lignes a afficher (0 = illimité) + * \param max_cols Nombre max de colonnes a afficher (0 = illimité) + */ +function viewExcelFileContent($file_to_include='',$max_rows=0,$max_cols=0) +{ + $debug = 0; //1 for on 0 for off + $force_nobr = 0; //Force the info in cells not to wrap unless stated explicitly (newline) + + require_once(DOL_DOCUMENT_ROOT.'/includes/phpexcelreader/excelreader.php'); + $data = new Spreadsheet_Excel_Reader(); + $data->setOutputEncoding('CPa25a'); + $data->read($file_to_include); + error_reporting(E_ALL ^ E_NOTICE); + + echo ""; + + echo " + +"; + for($sheet=0;$sheetsheets);$sheet++) + { + echo ""; + } + + echo + ""; + echo "
", $data->boundsheets[$sheet]['name'] , "
+
+"; +} + +?>