Browse Source

Updated collection stuff

pull/120/head
jonathangreen 13 years ago
parent
commit
031ae8ba56
  1. 21
      includes/datastream.inc
  2. 16
      islandora.module
  3. 15
      islandora_basic_image/islandora_basic_image.module

21
includes/datastream.inc

@ -36,6 +36,27 @@ function islandora_datastream_as_attachment($object_id, $dsid) {
exit();
}
function islandora_get_datastream_parents($islandora_object) {
$parent_collections = array();
$repository = $islandora_object->repository;
$collections = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOfCollection');
foreach($collections as $collection) {
try {
$pid = $collection['object']['value'];
$object = $repository->getObject($collection['object']['value']);
$parent_collections[$pid] = array();
$parent_collections[$pid]['object'] = $object;
$parent_collections[$pid]['url'] = 'islandora/object/' . $object->id;
$parent_collections[$pid]['label'] = $object->label;
$parent_collections[$pid]['label_link'] = l($parent_collections[$pid]['label'], $parent_collections[$pid]['url']);
}
catch (RepositoryException $e) {}
}
return $parent_collections;
}
/**
*
* @param array $arr

16
islandora.module

@ -596,22 +596,12 @@ function islandora_preprocess_islandora_default(&$variables) {
drupal_add_js('misc/form.js');
drupal_add_js('misc/collapse.js');
$islandora_object = $variables['islandora_object'];
$repository = $islandora_object->repository;
module_load_include('inc', 'islandora', 'includes/islandora_dublin_core');
module_load_include('inc', 'islandora', 'includes/utilities');
module_load_include('inc', 'islandora', 'includes/datastream');
$variables['parent_collections'] = islandora_get_datastream_parents($islandora_object);
$parent_collections = array();
$collections = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOfCollection');
foreach($collections as $collection) {
$pid = $collection['object']['value'];
$object = $repository->getObject($collection['object']['value']);
$parent_collections[$pid] = array();
$parent_collections[$pid]['object'] = $object;
$parent_collections[$pid]['url'] = 'islandora/object/' . $object->id;
$parent_collections[$pid]['label'] = $object->label;
$parent_collections[$pid]['label_link'] = l($parent_collections[$pid]['label'], $parent_collections[$pid]['url']);
}
$variables['parent_collections'] = $parent_collections;
$datastreams = array();
foreach ($islandora_object as $ds) {
$pid = $islandora_object->id;

15
islandora_basic_image/islandora_basic_image.module

@ -205,6 +205,8 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
$islandora_object = $variables['islandora_object'];
$repository = $islandora_object->repository;
module_load_include('inc', 'islandora', 'includes/islandora_dublin_core');
module_load_include('inc', 'islandora', 'includes/datastream');
try {
$dc = $islandora_object['DC']->content;
$dc_object = Dublin_Core::import_from_xml_string($dc);
@ -215,18 +217,7 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$variables) {
$variables['dc_array'] = $dc_object->as_formatted_array();
$variables['islandora_object_label'] = $islandora_object->label;
$variables['theme_hook_suggestions'][] = 'islandora_basic_image__' . str_replace(':', '_', $islandora_object->id);
$parent_collections = array();
$collections = $islandora_object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOfCollection');
foreach($collections as $collection) {
$pid = $collection['object']['value'];
$object = $repository->getObject($collection['object']['value']);
$parent_collections[$pid] = array();
$parent_collections[$pid]['object'] = $object;
$parent_collections[$pid]['url'] = 'islandora/object/' . $object->id;
$parent_collections[$pid]['label'] = $object->label;
$parent_collections[$pid]['label_link'] = l($parent_collections[$pid]['label'], $parent_collections[$pid]['url']);
}
$variables['parent_collections'] = $parent_collections;
$variables['parent_collections'] = islandora_get_datastream_parents($islandora_object);
global $base_url;
if (isset($islandora_object['OBJ'])) {
$full_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/OBJ/view';

Loading…
Cancel
Save