new export options

This commit is contained in:
2018-07-29 22:07:21 +02:00
parent 8047a0487f
commit 8f76ce3569
7 changed files with 137 additions and 7 deletions
+24
View File
@@ -37,6 +37,30 @@ abstract class BaseExporter
$this->columns = Column::columnsFromJson($table->revision->columns);
}
protected function getHeaderComment($prefix = " ")
{
$table = $this->table;
$owner = $this->table->owner;
$s =
$prefix."Table \"$table->title\" by $owner->title\n".
$prefix."exported ".date('M n, Y \\a\\t G:i')."\n".
$prefix."\n".
$prefix."License: ". str_replace("\n", "\n$prefix", $table->license ?: 'CC0') ."\n".
$prefix."\n".
$prefix."Upstream: https://datatable.directory/$owner->handle/$table->name\n";
$s .=
$prefix."\n".
$prefix."Columns:\n";
foreach ($this->columns as $c) {
$s .= $prefix." - $c->name ... $c->title\n";
}
return $s;
}
/**
* @return string - mime type for the downloaded file
*/