.
*/
/**
* called by theme function and populates a render array for a table view.
* @param array $metadata
* @param array $render_array
* @return array
*/
function fedora_repository_show_metadata($metadata, &$render_array) {
$header = array(t('Label'), t('Value'));
$table_attributes = array('class' => array('islandora_metadata'));
/*$rows = array();
foreach ($metadata as $key => $value) {
if (isset($value) && is_array($value)) {
$item_list = array('#items' => $value, '#theme' => 'item_list');
$rows[] = array($key, array('data' => $item_list));
}
else {
$rows[] = array($key, $value);
}
}
$render_array['metadata'] = array('#header' => $header, '#theme' => 'table', '#rows' => $rows, '#attributes' => $table_attributes);
*/
return $render_array;
}
/**
* returns a drupal render array as a html string
* @param array $variables
* @return string
*/
function theme_fedora_repository_view_object($variables) {
$object = $variables['object'];
//$metadata = $object->metadata;
$render_array = array('title' => array(
'#type' => 'markup',
'#markup' => '
' . $object->label . '
',
));
fedora_repository_show_metadata($metadata, $render_array);
fedora_repository_list_datastreams($object, $render_array);
return drupal_render($render_array);
}
/**
*
* @global object $user
* @param Object $object
* A tuque fedora object
* @param string $render_array
* @return type
*/
function fedora_repository_list_datastreams($object, &$render_array) {
global $user;
$datastreams = $object->datastreams;
if (!isset($datastreams)) {
return $render_array;
}
foreach ($datastreams as $datastream) {
foreach ($datastream as $key => $value) {
if ($key == 'islandora:bookCmodel') {
// $id = $d->getID()->id;
$render_array[(string)$d->getID()] = array('type' => 'markup', '#markup' => ''.l($d->label, $d->path,array('html'=>TRUE)).'
');
}
}
if($key = 'islandora:iaBookCModel'){
$d = new datastream();
$d->find($value);
if(isset($d)){
//@TODO: do something here
}
}
}
}
/**
* Theme registry function
* @return array
*/
function fedora_repository_theme() {
return array(
'fedora_repository_view_objects' => array(
'template' => 'fedora-repository-view-objects',
'variables' => array('objects' => NULL),
),
'fedora_repository_view_object' => array(
'varibles' => array('object'),
)
);
}
/**
* tells the main module what types of objects we support.
* @return array
*/
function fedora_repository_get_types() {
return array('islandora:bookCModel','islandora:isBookCModel');
}
/**
* this modules implentation of view_object will handle objects of type islandora:pdfCmodel as registered in its return types
* Other modules would handle objects
* of other types.
* @param FedoraObject $object
* @param object $user
* @param string $page_number
* @param string $page_size
* @return string
* themed html
*/
function fedora_repository_islandora_view_object($object, $user, $page_number, $page_size) {
//global $user;
if (!in_array('info:fedora/islandora_bookCmodel', $object->models) && !in_array('info:fedora/islandora:iaBookCModel', $object->models)) {
return NULL;
}
$output = theme('fedora_repository_view_object', array('object' => $object));
//pager_default_initialize($results['count'], $page_size);
//$pager = theme('pager', array('quantity' => $results['count']));
//$output .= $pager;
//if ($results['count'] > 0) {
// $output .= theme('fedora_repository_view_objects', $results);
//}
//$output .= $pager;
return $output;
}
?>