abrain/einsatzverwaltung

View on GitHub
src/Export/Formats/Excel.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php
namespace abrain\Einsatzverwaltung\Export\Formats;

/**
 * Exportiert Einsatzberichte in eine für Excel formatierte CSV-Datei.
 *
 * Die escapeChar-Funktion wurde erst einmal auskommentiert, da diese PHP >=5.5.4
 * voraussetzt, das Plugin jedoch auch unter PHP <5.4 laufen soll.
 */
class Excel extends Csv
{
    /**
     * @inheritDoc
     */
    public function getTitle(): string
    {
        return 'CSV für Microsoft Excel';
    }

    /**
     * @inheritDoc
     */
    public function renderOptions()
    {
        ?>
        <li>
            <input type="checkbox" name="export_options[excel][columns]" id="excel_columns" value="1" checked="checked">
            <label for="excel_columns">Spaltennamen in die erste Zeile setzen</label>
        </li>
        <?php
    }

    /**
     * @inheritDoc
     */
    public function setOptions(array $options)
    {
        $this->delimiter = ';';
        $this->enclosure = '"';
        // $this->escapeChar = '\\';
        $this->headers = (boolean)@$options['columns'];
    }
}