class BootstrapHTMLExporter in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/BootstrapHTMLExporter.php \AKlump\LoftDataGrids\BootstrapHTMLExporter
Class HTMLExporter
Hierarchy
- class \AKlump\LoftDataGrids\Exporter implements ExporterInterface
- class \AKlump\LoftDataGrids\CSVExporter implements ExporterInterface
- class \AKlump\LoftDataGrids\HTMLExporter implements ExporterInterface
- class \AKlump\LoftDataGrids\BootstrapHTMLExporter implements ExporterInterface
- class \AKlump\LoftDataGrids\HTMLExporter implements ExporterInterface
- class \AKlump\LoftDataGrids\CSVExporter implements ExporterInterface
Expanded class hierarchy of BootstrapHTMLExporter
File
- vendor/
aklump/ loft_data_grids/ src/ AKlump/ LoftDataGrids/ BootstrapHTMLExporter.php, line 7
Namespace
AKlump\LoftDataGridsView source
class BootstrapHTMLExporter extends HTMLExporter implements ExporterInterface {
public $format;
protected $extension = '.html';
/**
* Constructor
*/
public function __construct(ExportData $data, $filename = '') {
parent::__construct($data, $filename);
$this->format->bol = "<tr>";
$this->format->eol = "</tr>" . $this->format->cr;
$this->format->html = '<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css"></style>
</head>
<body></body>
</html>';
$this->format->css = null;
}
public function getInfo() {
$info = parent::getInfo();
$info = array(
'name' => 'HTML for Bootstrap Format',
'shortname' => 'HTML',
'description' => 'Export data in the .html file format using Bootstrap markup.',
) + $info;
return $info;
}
public function compile($page_id = null) {
$pages = $this
->getDataAsTransformedArray($page_id, null);
$tables = array();
foreach ($pages as $page_id => $data) {
$this->output = '';
$this->output .= '<thead>' . $this->format->cr;
$this->format->left = '<th>';
$this->format->right = '</th>';
$this->output .= $this
->collapseRow($this
->getHeader($page_id));
$this->output .= '</thead>' . $this->format->cr;
// Format the rows:
$this->format->left = '<td>';
$this->format->right = '</td>';
$this->output .= '<tbody>' . $this->format->cr;
foreach ($data as $row) {
$this->output .= $this
->collapseRow($row);
}
$this->output .= '</tbody>' . $this->format->cr;
$page_title = '';
if (count($pages) > 1 && $this
->getShowPageIds()) {
$page_title = '<caption>' . $page_id . '</caption>';
}
$tables[] = '<table class="table">' . $page_title . $this->format->cr . $this->output . '</table>' . $this->format->cr;
}
$this->output = implode($this->format->cr, $tables);
// Now decide if this is a snippet or full document
if (!$this->format->snippet) {
$snippet = $this->output;
$this->output = $this->format->html;
$this->output = str_replace('<style type="text/css"></style>', '<style type="text/css">' . $this->format->css . '</style>', $this->output);
$this->output = str_replace('<body></body>', '<body>' . $snippet . '</body>', $this->output);
$this->output = str_replace('<title></title>', '<title>' . $this->title . '</title>', $this->output);
}
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BootstrapHTMLExporter:: |
protected | property |
Overrides HTMLExporter:: |
|
BootstrapHTMLExporter:: |
public | property |
Overrides HTMLExporter:: |
|
BootstrapHTMLExporter:: |
public | function |
Build the string content of $this->output and return $this for chaining. Overrides HTMLExporter:: |
|
BootstrapHTMLExporter:: |
public | function |
Return info about this class Overrides HTMLExporter:: |
|
BootstrapHTMLExporter:: |
public | function |
Constructor Overrides HTMLExporter:: |
|
CSVExporter:: |
protected | property | ||
CSVExporter:: |
protected | function | Collapse a row | 1 |
Exporter:: |
protected | property | ||
Exporter:: |
protected | property | ||
Exporter:: |
protected | property | ||
Exporter:: |
public | function |
Adds/Updates a single setting by name. Overrides ExporterInterface:: |
|
Exporter:: |
protected | function | ||
Exporter:: |
protected | function | Iterate over all cells and transform data as appropriate. | |
Exporter:: |
public | function |
Export data as a string Overrides ExporterInterface:: |
1 |
Exporter:: |
protected | function | Return a string as a safe filename | |
Exporter:: |
public | function |
Format a single column with format by string Overrides ExporterInterface:: |
1 |
Exporter:: |
public | function |
Return the ExportDataInterface object Overrides ExporterInterface:: |
|
Exporter:: |
protected | function | Convert ExportData to an array transforming every cell. | |
Exporter:: |
public | function |
Get the filename Overrides ExporterInterface:: |
|
Exporter:: |
public | function |
Return an array each of the keys present in the data on a page. Overrides ExporterInterface:: |
|
Exporter:: |
public | function |
Return the settings object. Overrides ExporterInterface:: |
|
Exporter:: |
public | function |
Return the showPageIds. Overrides ExporterInterface:: |
|
Exporter:: |
public | function |
Overrides ExporterInterface:: |
|
Exporter:: |
public | function |
Set the exporter to hide page ids. Overrides ExporterInterface:: |
|
Exporter:: |
public | function |
Stream as a file to the server with headers. Overrides ExporterInterface:: |
1 |
Exporter:: |
public | function |
Compile and and save to a filepath. Overrides ExporterInterface:: |
2 |
Exporter:: |
public | function |
Set the export data object Overrides ExporterInterface:: |
|
Exporter:: |
public | function |
Getter/Setter for the filename Overrides ExporterInterface:: |
|
Exporter:: |
public | function |
Set the settings object. Overrides ExporterInterface:: |
|
Exporter:: |
protected | function | Setup default values on object data. | 4 |
Exporter:: |
public | function |
Set a title for the exported document Overrides ExporterInterface:: |
1 |
Exporter:: |
public | function |
Set the exporter to display page ids. Overrides ExporterInterface:: |
|
HTMLExporter:: |
protected | function |
Collapse a single cell in a row. Overrides CSVExporter:: |