views_data_export_exporter_txt.inc in Views data export 7.4
File
exporters/views_data_export_exporter_txt.inc
View source
<?php
require_once 'views_data_export_exporter.inc';
class ViewsDataExportExporterTXT extends ViewsDataExportExporter {
function __construct($options) {
$this->options = $options;
parent::__construct($options);
}
function supports_hide_if_empty() {
return TRUE;
}
function option_definition() {
$options = array();
return $options;
}
function add_row(&$file_handle, $data, $row_count, $field_titles) {
$row = '';
foreach ($data as $key => $value) {
$row .= '[' . $field_titles[$key] . ']' . PHP_EOL . PHP_EOL;
$row .= $value . PHP_EOL;
}
$row .= '----------------------------------------' . PHP_EOL . PHP_EOL;
fwrite($file_handle, $row);
}
function add_header(&$file_handle, $filename) {
return 'file header';
}
function get_headers($filename) {
$headers = parent::get_headers($filename);
$extension = 'txt';
$content_type = 'text/txt';
$headers['Content-Type'] = $content_type;
$headers['Content-Disposition'] = "attachment; filename={$filename}.{$extension}";
return $headers;
}
function bof(&$file_handle) {
}
function eof(&$file_handle, $row_count, $col_count) {
}
function post_process(&$results) {
}
}