You are here

public function Exporter::setFilename in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/Exporter.php \AKlump\LoftDataGrids\Exporter::setFilename()

Getter/Setter for the filename

Parameters

string $filename: Extension (if present in $filename) will be corrected based on the object

Return value

string The final $filename with correct extension

Overrides ExporterInterface::setFilename

6 calls to Exporter::setFilename()
ArrayExporter::saveFile in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/ArrayExporter.php
Compile and and save to a filepath.
Exporter::save in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/Exporter.php
Stream as a file to the server with headers.
Exporter::saveFile in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/Exporter.php
Compile and and save to a filepath.
Exporter::__construct in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/Exporter.php
Constructor
XLSXExporter::save in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/XLSXExporter.php
Stream as a file to the server with headers.

... See full list

File

vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/Exporter.php, line 63

Class

Exporter
Class Exporter

Namespace

AKlump\LoftDataGrids

Code

public function setFilename($filename) {
  $extension = trim($this->extension, '.');
  $filename = $this
    ->filenameSafe($filename, array(
    'extensions' => array(
      $extension,
    ),
    'ext' => $extension,
  ));
  $info = pathinfo($filename);
  if ($info['filename']) {
    $filename = $info['filename'];
  }
  else {
    $filename = time();
  }
  $this->filename = trim($filename, '.') . '.' . trim($this->extension, '.');
  return $this->filename;
}