diff --git a/plugins/fits.inc b/plugins/fits.inc new file mode 100644 index 00000000..bebb0a81 --- /dev/null +++ b/plugins/fits.inc @@ -0,0 +1,86 @@ +pid = $pid; + $this->item = new Fedora_Item($this->pid); + } + } + + /** + * extract metadata + * @param type $parameterArray + * @param type $dsid + * @param type $file + * @param type $file_ext + * @return type + */ + function extractFits($parameterArray, $dsid, $file, $file_ext) { + $file_name = '_' . $dsid . '.xml'; + $output = array(); + exec('fits.sh -i ' . escapeshellarg($file) . '', $output); + if ( !file_put_contents($file . $file_name, implode("\n", $output)) ) { + exit("Error writing file: ". $file_name); + } + $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_name; + return TRUE; + } + + /** + * display metadata + * @return type + */ + function displayFits() { + $output = ''; + $fits = $this->item->get_datastream_dissemination('FITS'); + if (trim($fits) != '') { + $fitsDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('FITS')); + if ($fitsDom != NULL) { + $description = $fitsDom->getElementsByTagName('fits'); + if ($description->length > 0) { + $description = $description->item(0); + $output .= '
'; + + $fieldset = array( + '#title' => t("!text", array('!text' => 'FITS Technical Metadata')), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#value' => $output + ); + $output = theme('fieldset', $fieldset); + } + } + } + return $output; + } + +}