Browse Source

added conveninece method to wrap datastream writing

pull/76/head
Alan Stanley 13 years ago
parent
commit
79b3723459
  1. 25
      api/fedora_item.inc

25
api/fedora_item.inc

@ -164,6 +164,30 @@ class Fedora_Item {
return $returnvalue;
}
/**
* Wrapper to add new or modify existing datastream
* @global url $base_url
* @param url $external_url
* @param string $dsid
* @param string $label
* @param string $mime_type
* @param string $controlGroup
* @param boolean $force
* @param string $logMessage
* @param boolean $quiet
*/
function add_or_modify_by_reference($external_url, $dsid, $label, $mime_type, $controlGroup = 'M', $force = FALSE, $logMessage = 'Modified by Islandora API', $quiet=FALSE) {
global $base_url;
if (array_key_exists($dsid, $this->datastreams)) {
$this->modify_datastream_by_reference($external_url, $dsid, $label, $mime_type, $force, $logMessage, $quiet);
}
else {
$file_location = str_replace("$base_url/", '', $external_url);
$this->add_datastream_from_file($file_location, $dsid, $label, $mime_type, $controlGroup = 'M', $logMessage = NULL);
}
}
/**
* Add a relationship string to this object's RELS-EXT.
* does not support rels-int yet.
@ -583,7 +607,6 @@ class Fedora_Item {
return $relationships;
}
function get_models() {
$relationships = array();
try {

Loading…
Cancel
Save