36 $this->filename=$p_filename;
37 $this->element=array();
48 if (
trim(strlen($this->filename))==0) {
49 error_log(
'CSV->correct_name filename is empty');
50 throw new Exception(
'CSV-CORRECT_NAME');
52 $this->filename.=
"-".date(
"ymd-Hi");
53 $this->filename.=
".csv";
55 $this->filename=str_replace(
";",
"", $this->filename);
56 $this->filename=str_replace(
"/",
"", $this->filename);
57 $this->filename=str_replace(
":",
"", $this->filename);
58 $this->filename=str_replace(
"*",
"", $this->filename);
59 $this->filename=str_replace(
" ",
"_", $this->filename);
60 $this->filename=strtolower($this->filename);
69 header(
'Pragma: public');
70 header(
'Content-type: application/csv');
71 header(
"Content-Disposition: attachment;filename=\"{$this->filename}\"",
73 header(
'Cache-Control: no-store, no-cache, must-revalidate');
74 header(
'Expires: Sun, 1 Jan 2000 12:00:00 GMT');
75 header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
'GMT');
87 for ($i=0; $i<$size_array; $i++)
103 if ( ! in_array(
$p_type, array(
"text",
"number"))) {
104 throw new Exception(
"NOALYSS_CSV::ADD");
119 if ($this->
size == 0 )
return;
123 if ($this->element[$i][
'type'] ==
'number' )
125 printf(
$sep.
'%s',
nb($this->element[$i][
'value']));
130 $export=str_replace(
"\n",
" ",$this->element[$i][
'value']);
146 $this->element=array();
nb($p_number)
format the number for the CSV export
add($p_item, $p_type="text")
function trim(s)
remove trailing and heading space