ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
class.ilCSVWriter.php
Go to the documentation of this file.
1
<?php
2
19
class
ilCSVWriter
20
{
21
private
string
$csv
=
''
;
22
private
string
$separator
=
','
;
23
private
string
$delimiter
=
'"'
;
24
private
string
$new_line
=
"\n"
;
25
private
bool
$first_entry
=
true
;
26
27
public
function
setSeparator
(
string
$a_sep): void
28
{
29
$this->separator = $a_sep;
30
}
31
32
public
function
setDelimiter
(
string
$a_del): void
33
{
34
$this->delimiter = $a_del;
35
}
36
37
public
function
addRow
(): void
38
{
39
$this->csv .=
$this->new_line
;
40
$this->first_entry =
true
;
41
}
42
43
public
function
addColumn
(
string
$a_col): void
44
{
45
if
(!$this->first_entry) {
46
$this->csv .=
$this->separator
;
47
}
48
$this->csv .=
$this->delimiter
;
49
$this->csv .= $this->
quote
($a_col);
50
$this->csv .=
$this->delimiter
;
51
$this->first_entry =
false
;
52
}
53
54
public
function
getCSVString
(): string
55
{
56
return
$this->csv
;
57
}
58
59
private
function
quote
(
string
$a_str): string
60
{
61
return
str_replace(
62
$this->delimiter,
63
$this->delimiter . $this->delimiter,
64
$a_str
65
);
66
}
67
}
ilCSVWriter\addColumn
addColumn(string $a_col)
Definition:
class.ilCSVWriter.php:43
ilCSVWriter
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
class.ilCSVWriter.php:19
ilCSVWriter\$new_line
string $new_line
Definition:
class.ilCSVWriter.php:24
ilCSVWriter\addRow
addRow()
Definition:
class.ilCSVWriter.php:37
ilCSVWriter\$separator
string $separator
Definition:
class.ilCSVWriter.php:22
ilCSVWriter\setSeparator
setSeparator(string $a_sep)
Definition:
class.ilCSVWriter.php:27
ilCSVWriter\getCSVString
getCSVString()
Definition:
class.ilCSVWriter.php:54
ilCSVWriter\setDelimiter
setDelimiter(string $a_del)
Definition:
class.ilCSVWriter.php:32
ilCSVWriter\$first_entry
bool $first_entry
Definition:
class.ilCSVWriter.php:25
ilCSVWriter\$delimiter
string $delimiter
Definition:
class.ilCSVWriter.php:23
ilCSVWriter\$csv
string $csv
Definition:
class.ilCSVWriter.php:21
ilCSVWriter\quote
quote(string $a_str)
Definition:
class.ilCSVWriter.php:59
components
ILIAS
CSV
classes
class.ilCSVWriter.php
Generated on Sun Aug 31 2025 23:02:43 for ILIAS by
1.8.13 (using
Doxyfile
)