diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-10-30 23:09:19 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-11-04 23:02:09 +0300 |
commit | 89eb98b2fdaf3fa72a4a038daa050764f904ecc6 (patch) | |
tree | 2780a76f14724cb5546cfce657ede275d6ab3b85 /core | |
parent | 71c972da727f1f97c5fc13eb491daa77ff516de6 (diff) |
added screen to see custom variable usages
Diffstat (limited to 'core')
-rw-r--r-- | core/DataTable/Renderer/Csv.php | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/core/DataTable/Renderer/Csv.php b/core/DataTable/Renderer/Csv.php index 4eee1949b7..c3fb08b15a 100644 --- a/core/DataTable/Renderer/Csv.php +++ b/core/DataTable/Renderer/Csv.php @@ -70,6 +70,8 @@ class Csv extends Renderer */ const NO_DATA_AVAILABLE = 'No data available'; + private $unsupportedColumns = array(); + /** * Computes the dataTable output and returns the string/binary * @@ -213,6 +215,12 @@ class Csv extends Renderer */ private function getHeaderLine($columnMetrics) { + foreach ($columnMetrics as $index => $value) { + if (in_array($value, $this->unsupportedColumns)) { + unset($columnMetrics[$index]); + } + } + if ($this->translateColumnNames) { $columnMetrics = $this->translateColumnNames($columnMetrics); } @@ -391,12 +399,23 @@ class Csv extends Renderer $name = 'metadata_' . $name; } - $csvRow[$name] = $value; + if (is_array($value)) { + if (!in_array($name, $this->unsupportedColumns)) { + $this->unsupportedColumns[] = $name; + } + } else { + $csvRow[$name] = $value; + } + } } foreach ($csvRow as $name => $value) { - $allColumns[$name] = true; + if (in_array($name, $this->unsupportedColumns)) { + unset($allColumns[$name]); + } else { + $allColumns[$name] = true; + } } if ($this->exportIdSubtable) { @@ -410,6 +429,15 @@ class Csv extends Renderer $csv[] = $csvRow; } + + if (!empty($this->unsupportedColumns)) { + foreach ($this->unsupportedColumns as $unsupportedColumn) { + foreach ($csv as $index => $row) { + unset($row[$index][$unsupportedColumn]); + } + } + } + return $csv; } |