Browse Source

Merge pull request #76 from ajstanley/6.x

added convenience method to wrap datastream writing
pull/77/merge
Ben Woodhead 13 years ago
parent
commit
d53b25e0bd
  1. 27
      api/fedora_item.inc

27
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,8 +607,7 @@ class Fedora_Item {
return $relationships;
}
function get_models() {
function get_models() {
$relationships = array();
try {
$relsext = $this->get_datastream_dissemination('RELS-EXT');

Loading…
Cancel
Save