非公開フラグ、センシティブフラグのCSV出力対応

This commit is contained in:
shibafu 2020-08-19 09:46:18 +09:00
parent d894897b82
commit 3015f82611

View File

@ -30,7 +30,7 @@ class CheckinCsvExporter
$csv->addStreamFilter('convert.mbstring.encoding.UTF-8:SJIS-win'); $csv->addStreamFilter('convert.mbstring.encoding.UTF-8:SJIS-win');
} }
$header = ['日時', 'ノート', 'オカズリンク']; $header = ['日時', 'ノート', 'オカズリンク', '非公開', 'センシティブ'];
for ($i = 1; $i <= 32; $i++) { for ($i = 1; $i <= 32; $i++) {
$header[] = "タグ{$i}"; $header[] = "タグ{$i}";
} }
@ -45,6 +45,8 @@ class CheckinCsvExporter
$ejaculation->ejaculated_date->format('Y/m/d H:i'), $ejaculation->ejaculated_date->format('Y/m/d H:i'),
$ejaculation->note, $ejaculation->note,
$ejaculation->link, $ejaculation->link,
self::formatBoolean($ejaculation->is_private),
self::formatBoolean($ejaculation->is_too_sensitive),
]; ];
foreach ($ejaculation->tags->take(32) as $tag) { foreach ($ejaculation->tags->take(32) as $tag) {
$record[] = $tag->name; $record[] = $tag->name;
@ -54,4 +56,9 @@ class CheckinCsvExporter
}); });
}); });
} }
private static function formatBoolean($value): string
{
return $value ? 'true' : 'false';
}
} }