* Export Report * * @param int $reportId * @return DataDownloadResponse */
(int $reportId)
| 534 | * @return DataDownloadResponse |
| 535 | */ |
| 536 | public function export(int $reportId) { |
| 537 | $result = array(); |
| 538 | $result['report'] = $this->ReportMapper->readOwn($reportId); |
| 539 | $datasetId = $result['report']['dataset']; |
| 540 | $result['dataload'] = $this->DataloadMapper->read($datasetId); |
| 541 | $result['threshold'] = $this->ThresholdMapper->getThresholdsByReport($reportId); |
| 542 | $result['favorite'] = ''; |
| 543 | |
| 544 | if ($result['report']['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB) { |
| 545 | $result['data'] = $this->StorageMapper->read($datasetId); |
| 546 | } |
| 547 | |
| 548 | unset($result['report']['id'], $result['report']['user_id'], $result['report']['user_id'], $result['report']['parent'], $result['report']['dataset']); |
| 549 | $data = json_encode($result); |
| 550 | return new DataDownloadResponse($data, $result['report']['name'] . '.export.txt', 'text/plain; charset=utf-8'); |
| 551 | } |
| 552 | |
| 553 | /** |
| 554 | * Update report options |
no test coverage detected