SilverCart\Admin\Forms\GridField\GridFieldOrderPositionExportButton
Adds an export "current month", "previous month" and "penultimate month" button to the bottom of a {@link GridField}.
- Author: Sebastian Diel <sdiel@pixeltricks.de>
- Copyright: 2021 pixeltricks GmbH
- License: see license file in modules root directory
Synopsis
class GridFieldOrderPositionExportButton
implements
GridField_HTMLProvider,GridField_ActionProvider,GridField_URLHandler
{
- // constants
- const EXPORT_MODE_CURRENT_MONTH = 'current-month';
- const EXPORT_MODE_PREVIOUS_MONTH = 'previous-month';
- const EXPORT_MODE_PENULTIMATE_MONTH = 'penultimate-month';
- // members
- protected $exportColumns;
- protected string $csvSeparator = ",";
- protected string $csvEnclosure = '"';
- protected bool $csvHasHeader = true;
- protected $targetFragment;
- private static bool $xls_export_disabled = false;
- protected string $exportMode = self::EXPORT_MODE_PREVIOUS_MONTH;
- // methods
- public GridFieldOrderPositionExportButton __construct()
- public array getHTMLFragments()
- public string getExportModeAction()
- public string getExportModeLabel()
- public array getExportModeDates()
- public array getActions()
- public HTTPResponse|null handleAction()
- public array getURLHandlers()
- public HTTPResponse|null handleExportCurrent()
- public HTTPResponse|null handleExportPenultimate()
- public HTTPResponse|null handleExport()
- public string generateExportFileData()
- public array getExportColumns()
- public $this setExportColumns()
- public string getCsvSeparator()
- public $this setCsvSeparator()
- public string getCsvEnclosure()
- public $this setCsvEnclosure()
- public bool getCsvHasHeader()
- public $this setCsvHasHeader()
- public string getExportMode()
- public GridFieldOrderPositionExportButton setExportMode()
Hierarchy
Uses
- SilverStripe\Core\Injector\Injectable
Implements
- SilverStripe\Forms\GridField\GridField_HTMLProvider
- SilverStripe\Forms\GridField\GridField_ActionProvider
- SilverStripe\Forms\GridField\GridField_URLHandler
Constants
Name | Value |
---|---|
EXPORT_MODE_CURRENT_MONTH | 'current-month' |
EXPORT_MODE_PREVIOUS_MONTH | 'previous-month' |
EXPORT_MODE_PENULTIMATE_MONTH | 'penultimate-month' |
Members
private
- $xls_export_disabled
—
SilverCart\Admin\Forms\GridField\bool
Set to true to disable XLS sanitisation [SS-2017-007] Ensure all cells with leading [@=+] have a leading tab
protected
- $csvEnclosure — string
- $csvHasHeader — SilverCart\Admin\Forms\GridField\bool
- $csvSeparator — string
- $exportColumns — array
- $exportMode
—
string
Export mode. -
$targetFragment
Fragment to write the button to
Methods
public
- __construct() — Constructor.
- generateExportFileData() — Generate export fields for CSV.
- getActions() — export is an action button
- getCsvEnclosure() — Returns the CSV enclosure.
- getCsvHasHeader() — Returns whether the CSV has a header.
- getCsvSeparator() — Returns the CSV separator.
- getExportColumns() — Returns the export columns.
- getExportMode() — Returns the export mode.
- getExportModeAction() — Returns the action dependent on the current export mode.
- getExportModeDates() — Returns the export mode dates.
- getExportModeLabel() — Returns the display label dependent on the current export mode.
- getHTMLFragments() — Place the export button in a <p> tag below the field
- getURLHandlers() — it is also a URL
- handleAction() — Handles the action.
- handleExport() — Handle the export, for both the action button and the URL
- handleExportCurrent() — Export handler for current mode.
- handleExportPenultimate() — Export handler for penultimate mode.
- setCsvEnclosure() — Sets the CSV enclosure.
- setCsvHasHeader() — Sets whether the CSV has a header.
- setCsvSeparator() — Sets the CSV separator.
- setExportColumns() — Sets the export columns.
- setExportMode() — Sets the export mode.