public function TripalEntityCollection::getOutfile
3.x TripalEntityCollection.inc | public TripalEntityCollection::getOutfile($formatter) |
Retrieves the output filename for the desired formatter.
Parameters
$formatter: The class name of the formatter to use. The formatter must be compatible with the data collection.
Throws
Exception
3 calls to TripalEntityCollection::getOutfile()
- TripalEntityCollection::delete in tripal/
includes/ TripalEntityCollection.inc - Deletes the current collection
- TripalEntityCollection::getOutfilePath in tripal/
includes/ TripalEntityCollection.inc - Retrieves the path for the downloadable file.
- TripalEntityCollection::write in tripal/
includes/ TripalEntityCollection.inc - Writes the collection to a file using a given formatter.
File
- tripal/
includes/ TripalEntityCollection.inc, line 407
Class
Code
public function getOutfile($formatter) {
if (!$this->isFormatterCompatible($formatter)) {
throw new Exception(t('The formatter, "%formatter", is not compatible with this data collection.', array('%formatter' => $formatter)));
}
if (!tripal_load_include_downloader_class($formatter)) {
throw new Exception(t('Cannot find the formatter named "@formatter".', array('@formatter', $formatter)));
}
$extension = $formatter::$default_extension;
$create_date = $this->getCreateDate(FALSE);
$outfile = preg_replace('/[^\w]/', '_', ucwords($this->collection_name)) . '_collection' . '_' . $create_date . '.' . $extension;
return $outfile;
}