filter export filenames
This commit is contained in:
parent
6e421753fd
commit
68a440a53c
@ -68,7 +68,7 @@ abstract class ExportBase implements QueryBase
|
||||
/** @var $oFS d3filesystem */
|
||||
$oFS = oxNew(d3filesystem::class);
|
||||
$oFS->startDirectDownload(
|
||||
$this->getExportFilenameBase().'.'.$this->getFileExtension($format),
|
||||
$oFS->filterFilename($this->getExportFileName($format)),
|
||||
$content
|
||||
);
|
||||
}
|
||||
@ -105,4 +105,14 @@ abstract class ExportBase implements QueryBase
|
||||
$renderer = $this->getRenderer($format);
|
||||
return $renderer->getContent($rows, $fieldnames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $format
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExportFileName($format) : string
|
||||
{
|
||||
return $this->getExportFilenameBase().'_'.date('Y-m-d_H-i-s').'.'.$this->getFileExtension($format);
|
||||
}
|
||||
}
|
@ -31,7 +31,7 @@ class Csv implements RendererInterface
|
||||
* @throws Exception
|
||||
* @throws CannotInsertRecord
|
||||
*/
|
||||
public function getContent($rows, $fieldNames)
|
||||
public function getContent($rows, $fieldNames): string
|
||||
{
|
||||
$csv = $this->getCsv();
|
||||
$csv->insertOne($fieldNames);
|
||||
|
@ -19,7 +19,7 @@ use MathieuViossat\Util\ArrayToTextTable;
|
||||
|
||||
class Pretty implements RendererInterface
|
||||
{
|
||||
public function getContent($rows, $fieldnames)
|
||||
public function getContent($rows, $fieldNames) : string
|
||||
{
|
||||
$renderer = oxNew(ArrayToTextTable::class, $rows);
|
||||
return $renderer->getTable();
|
||||
|
@ -17,7 +17,7 @@ namespace D3\DataWizard\Application\Model\ExportRenderer;
|
||||
|
||||
interface RendererInterface
|
||||
{
|
||||
public function getContent($rows, $fieldnames);
|
||||
public function getContent($rows, $fieldNames) : string;
|
||||
|
||||
public function getFileExtension();
|
||||
public function getFileExtension() : string;
|
||||
}
|
Loading…
Reference in New Issue
Block a user