2
0
forked from Wavyzz/dolibarr

New: Ca y est. L'export est compltement oprationnel.

This commit is contained in:
Laurent Destailleur
2006-01-22 16:14:33 +00:00
parent 597e2a5d98
commit 879f882a77
13 changed files with 342 additions and 170 deletions

View File

@@ -38,9 +38,16 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/export/modules_export.php");
class ExportCsv extends ModeleExports
{
var $id;
var $label;
var $extension;
var $version;
var $label_lib;
var $version_lib;
var $handle; // Handle fichier
/**
\brief Constructeur
@@ -51,50 +58,96 @@ class ExportCsv extends ModeleExports
global $conf,$langs;
$this->db = $db;
$this->extension='csv';
$this->id='csv'; // Same value then xxx in file name export_xxx.modules.php
$this->label='Csv'; // Label of driver
$this->extension='csv'; // Extension for generated file by this driver
$ver=split(' ','$Revision$');
$this->version=$ver[2]; // Driver version
// If driver use an external library, put its name here
$this->label_lib='Dolibarr';
$this->version_lib=DOL_VERSION;
}
function getDriverId()
{
return $this->id;
}
function get_extension()
function getDriverLabel()
{
return $this->label;
}
function getDriverExtension()
{
return $this->extension;
}
function getDriverVersion()
{
return $this->version;
}
function getLibLabel()
{
return $this->label_lib;
}
function getLibVersion()
{
return $this->version_lib;
}
function open_file($file)
{
dolibarr_syslog("ExportCsv::open_file file=$file");
$this->handle = fopen($file, "wt");
return 0;
}
function write_header()
function write_header($langs)
{
return 0;
}
function write_title()
function write_title($array_export_fields_label,$array_selected_sorted,$langs)
{
foreach($array_selected_sorted as $code => $value)
{
fwrite($this->handle,$langs->trans($array_export_fields_label[$code]).";");
}
fwrite($this->handle,"\n");
return 0;
}
function write_record()
function write_record($array_alias,$array_selected_sorted,$objp)
{
foreach($array_selected_sorted as $code => $value)
{
$alias=$array_alias[$code];
//print "dd".$alias;
fwrite($this->handle,ereg_replace(';',',',$objp->$alias).";");
}
fwrite($this->handle,"\n");
return 0;
}
function write_footer()
function write_footer($langs)
{
return 0;
}
function close_file()
{
fclose($this->handle);
return 0;
}
}