add name collections in exporter items csv #385

This commit is contained in:
vnmedeiros 2020-05-07 11:32:49 -03:00
parent 758878932d
commit 1ed99cb1ae
1 changed files with 12 additions and 2 deletions

View File

@ -180,6 +180,15 @@ class CSV extends Exporter {
return false; return false;
} }
private function get_collections_names() {
$collections_names = [];
foreach($this->collections as $col) {
$collection = \Tainacan\Repositories\Collections::get_instance()->fetch( (int) $col['id'], 'OBJECT' );
$collections_names[] = $collection->get_name();
}
return $collections_names;
}
/** /**
* When exporter is finished, gets the final output * When exporter is finished, gets the final output
*/ */
@ -188,8 +197,9 @@ class CSV extends Exporter {
if ( is_array($files) && isset($files['csvexporter.csv'])) { if ( is_array($files) && isset($files['csvexporter.csv'])) {
$file = $files['csvexporter.csv']; $file = $files['csvexporter.csv'];
$message = __('target collections:', 'tainacan');
$message = __('Your CSV file is ready! Access it in the link below:', 'tainacan'); $message .= " <b>" . implode(", ", $this->get_collections_names() ) . "</b><br/>";
$message .= __('Your CSV file is ready! Access it in the link below:', 'tainacan');
$message .= '<br/><br/>'; $message .= '<br/><br/>';
$message .= '<a href="' . $file['url'] . '">Download</a>'; $message .= '<a href="' . $file['url'] . '">Download</a>';