45 function __construct ($headline, $header, $entries, $columns = [])
48 if (!count($columns)) {
49 foreach ($header as $index => $dummy) {
56 foreach ($columns as $index) {
57 if (isset($header[$index])) {
58 $this->result .= trim(html_entity_decode($header[$index], ENT_QUOTES,
'UTF-8').
";");
63 $this->result = preg_replace(
'/;$/',
'', $this->result).
"\n";
66 foreach ($entries as $row) {
67 foreach ($columns as $index) {
68 if (isset($row[
"_sort$index"])) {
69 $this->result .= trim(html_entity_decode($row[
"_sort$index"], ENT_QUOTES,
'UTF-8')).
";";
74 $this->result = preg_replace(
'/;$/',
'', $this->result).
"\n";
88 $columns = $listing->getColumns();
89 $iterator = $listing->getIterator();
93 foreach ($columns as $column) {
94 if ($column->isExportable()) {
95 $result .= $column->getLabel().
';';
98 $result = preg_replace(
'/;$/',
'', $result).
"\n";
101 foreach ($iterator as $entry) {
102 foreach ($columns as $column) {
103 if ($column->isExportable()) {
104 $result .= implode(
',', $column->getRawExportValues($entry)).
';';
107 $result = preg_replace(
'/;$/',
'', $result).
"\n";
118 return [
"exportCSV" => [
"label" => _(
"CSV"),
"image" =>
"geticon.php?context=mimetypes&icon=text-csv&size=16",
"class" =>
"csvExporter",
"mime" =>
"text/x-csv",
"filename" =>
"export.csv" ]];
__construct($headline, $header, $entries, $columns=[])
Create a csvExporter.
This class handles the entries list for a management instance.
static getInfo()
Get Informations.
This class contains all the functions needed for csv export.