@ -3,9 +3,9 @@
/*
/*
* @file fedora_repository.module
* @file fedora_repository.module
*
*
* Copyright (c) 2012 Paul Pound.
*
*
* This file is part of CMR.
*
* This file is part of Islandora.
*
*
* This program is free software: you can redistribute it and/or modify
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
@ -31,8 +31,8 @@
*/
*/
function fedora_repository_show_metadata($metadata, &$render_array) {
function fedora_repository_show_metadata($metadata, &$render_array) {
$header = array(t('Label'), t('Value'));
$header = array(t('Label'), t('Value'));
$table_attributes = array('class' => array('cmr _metadata'));
$table_attributes = array('class' => array('islandora _metadata'));
$rows = array();
/* $rows = array();
foreach ($metadata as $key => $value) {
foreach ($metadata as $key => $value) {
if (isset($value) && is_array($value)) {
if (isset($value) && is_array($value)) {
$item_list = array('#items' => $value, '#theme' => 'item_list');
$item_list = array('#items' => $value, '#theme' => 'item_list');
@ -43,7 +43,9 @@ function fedora_repository_show_metadata($metadata, &$render_array) {
}
}
}
}
$render_array['metadata'] = array('#header' => $header, '#theme' => 'table', '#rows' => $rows, '#attributes' => $table_attributes);
$render_array['metadata'] = array('#header' => $header, '#theme' => 'table', '#rows' => $rows, '#attributes' => $table_attributes);
*/
return $render_array;
return $render_array;
}
}
/**
/**
@ -53,11 +55,12 @@ function fedora_repository_show_metadata($metadata, &$render_array) {
*/
*/
function theme_fedora_repository_view_object($variables) {
function theme_fedora_repository_view_object($variables) {
$object = $variables['object'];
$object = $variables['object'];
$metadata = $object->metadata;
// $metadata = $object->metadata;
$render_array = array('title' => array(
$render_array = array('title' => array(
'#type' => 'markup',
'#type' => 'markup',
'#markup' => '<h2>' . $object->label . '</h2>',
'#markup' => '<h2>' . $object->label . '</h2>',
));
));
fedora_repository_show_metadata($metadata, $render_array);
fedora_repository_show_metadata($metadata, $render_array);
fedora_repository_list_datastreams($object, $render_array);
fedora_repository_list_datastreams($object, $render_array);
return drupal_render($render_array);
return drupal_render($render_array);
@ -134,25 +137,22 @@ function fedora_repository_get_types() {
* @return string
* @return string
* themed html
* themed html
*/
*/
function fedora_repository_view_object($object, $user, $page_number, $page_size) {
function fedora_repository_islandora_ view_object($object, $user, $page_number, $page_size) {
//global $user;
//global $user;
if ($object->type != 'islandora:pdfCModel' && $object->type != 'cmr:basicObject') {
if (!in_array('info:fedora/islandora_bookCmodel', $object->models) && !in_array('info:fedora/islandora:iaBookCModel', $object->models)) {
return NULL;
return NULL;
}
}
$output = theme('fedora_repository_view_object', array('object' => $object));
$output = theme('fedora_repository_view_object', array('object' => $object));
$api = new CmrAPIDrupal($user);
//$api = new CmrAPIDrupal($user);
try {
$results = $api->listObjectsByRelationship($object, 'cmr:isPartOf', $user, array('offset' => $page_number, 'limit' => $page_size));
//pager_default_initialize($results['count'], $page_size);
} catch (CmrRelationshipException $e) {
//$pager = theme('pager', array('quantity' => $results['count']));
drupal_set_message(t('error executing list objects query, %s', array('%s' => $e)));
//$output .= $pager;
}
//if ($results['count'] > 0) {
pager_default_initialize($results['count'], $page_size);
// $output .= theme('fedora_repository_view_objects', $results);
$pager = theme('pager', array('quantity' => $results['count']));
//}
$output .= $pager;
//$output .= $pager;
if ($results['count'] > 0) {
$output .= theme('fedora_repository_view_objects', $results);
}
$output .= $pager;
return $output;
return $output;
}
}