Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
694 B
1
Indexable
Never
if ($exportType === 'csv') {
	$csvString = "";

	$csvRow = [];
	foreach ($this->getExportRowColumns([], 'name', $visitorGroups, $gateColumns) as $row) {
		$csvRow[] = '"' . $row . '"';
	}
	$csvString .= join(";",$csvRow) . "\n";

	foreach ($results['results'] as $resultRow) {				
		$csvRow = [];
		foreach ($this->getExportRowColumns($resultRow, 'data', $visitorGroups, $gateColumns) as $row) {
			$csvRow[] = '"' . $row . '"';
		}
		$csvString .= join(";",$csvRow) . "\n";
	}
	$response = new Response($csvString);
	$disposition = HeaderUtils::makeDisposition(
		HeaderUtils::DISPOSITION_ATTACHMENT,
		$filePrefix . '-' . (new \DateTime())->format('Y-m-d') . '.csv'
	);
}