Browse Source

added ismemberof collection output to displays

pull/118/head
krisbulman 13 years ago
parent
commit
096830c27a
  1. 30
      islandora-object.tpl.php
  2. 12
      islandora.module
  3. 1
      islandora_basic_image/css/islandora_basic_image.theme.css
  4. 8
      islandora_basic_image/islandora-basic-image.tpl.php
  5. 13
      islandora_basic_image/islandora_basic_image.module

30
islandora-object.tpl.php

@ -75,30 +75,7 @@
*
*/
//dsm($object);
drupal_set_title($islandora_object->label);
// $dublin_core = $variables['islandora_dublin_core'];
// print($islandora_object->label . ' ' . $islandora_object->id);
// print ('<h3>datastreams</h3>');
// foreach ($islandora_object as $ds) {
// print $ds->label . '<br>';
// //do something
// }
// print('<h3>Dublin Core</h3>');
// foreach ($dublin_core as $element) {
// if (!empty($element)) {
// // print($element);
// foreach ($element as $key => $value) {
// foreach($value as $v){
// if(!empty($v)){
// print '<strong>'.($key).'</strong>: ';print($v).'<br />';
// }
// }
// }
// }
// }
?>
<div class="islandora-object islandora">
<h2>Details</h2>
@ -120,6 +97,12 @@ drupal_set_title($islandora_object->label);
</dd>
<?php $row_field++; ?>
<?php endforeach; ?>
<dt>Collections</dt>
<dd>
<?php foreach($parent_collections as $key => $value): ?>
<div><?php print $value['label_link'] ?></div>
<?php endforeach; ?>
</dd>
</dl>
</div>
<fieldset class="collapsible collapsed" style="display: block; clear:both">
@ -145,4 +128,3 @@ drupal_set_title($islandora_object->label);
</table>
</div>
</fieldset>

12
islandora.module

@ -602,16 +602,18 @@ function islandora_preprocess_islandora_default(&$variables) {
module_load_include('inc', 'islandora', 'includes/islandora_dublin_core');
module_load_include('inc', 'islandora', 'includes/utilities');
$variables['parent_collections'] = array();
$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']);
$variables['parent_collections'][$pid] = array();
$variables['parent_collections'][$pid]['object'] = $object;
$variables['parent_collections'][$pid]['label'] = $object->label;
$variables['parent_collections'][$pid]['url'] = url('islandora/object/' . $object->id);
$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;

1
islandora_basic_image/css/islandora_basic_image.theme.css

@ -56,6 +56,7 @@ body.two-sidebars .islandora-basic-image-sidebar {
width: 60%;
padding: 0 20px 0 0;
float: left; /* LTR */
margin-top: 1em;
}
body.no-sidebars .islandora-basic-image-sidebar {

8
islandora_basic_image/islandora-basic-image.tpl.php

@ -31,6 +31,14 @@
<h1 class="title"><?php print $islandora_object_label; ?></h1>
<h3><?php print $dc_array['dc:description']['label']; ?></h3>
<p><?php print $dc_array['dc:description']['value']; ?></p>
<div>
<h3>In Collections</h3>
<ul>
<?php foreach($parent_collections as $key => $value): ?>
<li><?php print $value['label_link'] ?></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<fieldset class="collapsible collapsed islandora-basic-image-metadata">

13
islandora_basic_image/islandora_basic_image.module

@ -203,6 +203,7 @@ function islandora_basic_image_preprocess_islandora_basic_image(&$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');
try {
$dc = $islandora_object['DC']->content;
@ -214,6 +215,18 @@ 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;
global $base_url;
if (isset($islandora_object['OBJ'])) {
$full_size_url = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/OBJ/view';

Loading…
Cancel
Save