|
|
|
@ -69,8 +69,6 @@ function islandora_basic_collection_manage_object($object_id) {
|
|
|
|
|
return 'Collection CModel edit function ' . $object_id; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* determines whether or not to show this modules manage tab |
|
|
|
|
* @global object $user |
|
|
|
@ -197,6 +195,18 @@ function islandora_basic_collection_preprocess_islandora_basic_collection(&$vari
|
|
|
|
|
$associated_objects_array = array(); |
|
|
|
|
foreach ($variables['islandora_associated_objects'] as $key => $value) { |
|
|
|
|
$pid = $variables['islandora_associated_objects'][$key]['object']['value']; |
|
|
|
|
$fc_object = islandora_basic_collection_get_object($pid); |
|
|
|
|
if (!isset($fc_object)) { |
|
|
|
|
continue; //null object so don't show in collection view; |
|
|
|
|
} |
|
|
|
|
$associated_objects_array[$pid]['object'] = $fc_object; |
|
|
|
|
try { |
|
|
|
|
$dc = $fc_object['DC']->content; |
|
|
|
|
$dc_object = Dublin_Core::import_from_xml_string($dc); |
|
|
|
|
$associated_objects_array[$pid]['dc_array'] = $dc_object->as_formatted_array(); |
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error'); |
|
|
|
|
} |
|
|
|
|
$object_url = 'islandora/object/' . $pid; |
|
|
|
|
$thumbnail_img = '<img src="' . $base_path . $object_url . '/datastream/TN/view"' . '/>'; |
|
|
|
|
$title = $variables['islandora_associated_objects'][$key]['title']['value']; |
|
|
|
@ -204,12 +214,29 @@ function islandora_basic_collection_preprocess_islandora_basic_collection(&$vari
|
|
|
|
|
$associated_objects_array[$pid]['path'] = $object_url; |
|
|
|
|
$associated_objects_array[$pid]['title'] = $title; |
|
|
|
|
$associated_objects_array[$pid]['class'] = strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $pid)); |
|
|
|
|
if(isset($fc_object['TN'])){ |
|
|
|
|
$thumbnail_img = '<img src="' . $base_path . $object_url . '/datastream/TN/view"' . '/>'; |
|
|
|
|
} else { |
|
|
|
|
$thumbnail_img = '<img src="http://codesprint-centos.islandora.ca/islandora/object/islandora%3A52/datastream/TN"' . '/>'; |
|
|
|
|
} |
|
|
|
|
$associated_objects_array[$pid]['thumbnail'] = $thumbnail_img; |
|
|
|
|
$associated_objects_array[$pid]['title_link'] = l($title, $object_url, array('html' => TRUE, 'attributes' => array('title' => $title))); |
|
|
|
|
$associated_objects_array[$pid]['thumb_link'] = l($thumbnail_img, $object_url, array('html' => TRUE, 'attributes' => array('title' => $title))); |
|
|
|
|
} |
|
|
|
|
$variables['associated_objects_array'] = $associated_objects_array; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function islandora_basic_collection_get_object($object_id) { |
|
|
|
|
module_load_include('inc', 'islandora', 'RestConnection'); |
|
|
|
|
global $user; |
|
|
|
|
try { |
|
|
|
|
$restConnection = new RestConnection($user); |
|
|
|
|
$fedora_object = new FedoraObject($object_id, $restConnection->repository); |
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
//drupal_set_message(t('Error getting Islandora object %s', array('%s' => $object_id)), 'error'); |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
return $fedora_object; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function islandora_basic_collection_get_objects($object) { |
|
|
|
|