|
|
@ -392,6 +392,59 @@ class ObjectHelper { |
|
|
|
return $output; |
|
|
|
return $output; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getFormattedDatastreamList($object_pid, $contentModels, &$fedoraItem) { |
|
|
|
|
|
|
|
$availableDataStreamsText = 'Detailed List of Content'; |
|
|
|
|
|
|
|
//$metaDataText='Description'; |
|
|
|
|
|
|
|
$mainStreamLabel = NULL; |
|
|
|
|
|
|
|
$object = $fedoraItem->get_datastreams_list_as_SimpleXML(); |
|
|
|
|
|
|
|
if (!isset($object)) { |
|
|
|
|
|
|
|
drupal_set_message(t("No datastreams available")); |
|
|
|
|
|
|
|
return ' '; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$hasOBJStream = NULL; |
|
|
|
|
|
|
|
$hasTNStream = FALSE; |
|
|
|
|
|
|
|
$dataStreamBody = "<br /><table>\n"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$cmDatastreams = array(); |
|
|
|
|
|
|
|
if (variable_get('fedora_object_restrict_datastreams', FALSE) == TRUE && ($cm = ContentModel::loadFromObject($object_pid)) !== FALSE) { |
|
|
|
|
|
|
|
$cmDatastreams = $cm->listDatastreams(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dataStreamBody .= $this->get_parent_objects_asHTML($object_pid); |
|
|
|
|
|
|
|
$dataStreamBody .= '<tr><th colspan="4"><h3>' . t("!text", array('!text' => $availableDataStreamsText)) . '</h3></th></tr>'; |
|
|
|
|
|
|
|
foreach ($object as $datastream) { |
|
|
|
|
|
|
|
foreach ($datastream as $datastreamValue) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (variable_get('fedora_object_restrict_datastreams', FALSE) == FALSE || ((isset($user) && in_array('administrator',$user->roles)) || in_array($datastreamValue->ID,$cmDatastreams))) { |
|
|
|
|
|
|
|
if ($datastreamValue->ID == 'OBJ') { |
|
|
|
|
|
|
|
$hasOBJStream = '1'; |
|
|
|
|
|
|
|
$mainStreamLabel = $datastreamValue->label; |
|
|
|
|
|
|
|
$mainStreamLabel = str_replace("_", " ", $mainStreamLabel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($datastreamValue->ID == 'TN') { |
|
|
|
|
|
|
|
$hasTNStream = TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//create the links to each datastream |
|
|
|
|
|
|
|
$dataStreamBody .= $this->create_link_for_ds($object_pid, $datastreamValue); //"<tr><td><b>$key :</b></td><td>$value</td></tr>\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$dataStreamBody .= "</table>\n"; |
|
|
|
|
|
|
|
//if they have access let them add a datastream |
|
|
|
|
|
|
|
if (user_access(ObjectHelper :: $ADD_FEDORA_STREAMS)) { |
|
|
|
|
|
|
|
$allow=TRUE; |
|
|
|
|
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
|
|
|
|
$allow= fedora_fesl_check_roles($object_pid,'write'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($allow) { |
|
|
|
|
|
|
|
$dataStreamBody .= drupal_get_form('add_stream_form', $object_pid); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dataStreamBody = '<div class = "fedora_detailed_list">' . $dataStreamBody . '</div>'; |
|
|
|
|
|
|
|
return $dataStreamBody; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Gets a list of datastreams from an object using its pid |
|
|
|
* Gets a list of datastreams from an object using its pid |
|
|
|
* |
|
|
|
* |
|
|
@ -417,60 +470,7 @@ class ObjectHelper { |
|
|
|
$fedoraItem = new Fedora_Item($object_pid); |
|
|
|
$fedoraItem = new Fedora_Item($object_pid); |
|
|
|
|
|
|
|
|
|
|
|
if (user_access(ObjectHelper :: $VIEW_DETAILED_CONTENT_LIST)) { |
|
|
|
if (user_access(ObjectHelper :: $VIEW_DETAILED_CONTENT_LIST)) { |
|
|
|
$availableDataStreamsText = 'Detailed List of Content'; |
|
|
|
$dataStreamBody = $this->getFormattedDatastreamList($object_pid, $contentModels, $fedoraItem); |
|
|
|
//$metaDataText='Description'; |
|
|
|
|
|
|
|
$mainStreamLabel = NULL; |
|
|
|
|
|
|
|
$object = $fedoraItem->get_datastreams_list_as_SimpleXML(); |
|
|
|
|
|
|
|
if (!isset($object)) { |
|
|
|
|
|
|
|
drupal_set_message(t("No datastreams available")); |
|
|
|
|
|
|
|
return ' '; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$hasOBJStream = NULL; |
|
|
|
|
|
|
|
$hasTNStream = FALSE; |
|
|
|
|
|
|
|
$dataStreamBody = "<br /><table>\n"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$cmDatastreams = array(); |
|
|
|
|
|
|
|
if (variable_get('fedora_object_restrict_datastreams', FALSE) == TRUE && ($cm = ContentModel::loadFromObject($object_pid)) !== FALSE) { |
|
|
|
|
|
|
|
$cmDatastreams = $cm->listDatastreams(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dataStreamBody .= $this->get_parent_objects_asHTML($object_pid); |
|
|
|
|
|
|
|
$dataStreamBody .= '<tr><th colspan="4"><h3>' . t("!text", array('!text' => $availableDataStreamsText)) . '</h3></th></tr>'; |
|
|
|
|
|
|
|
foreach ($object as $datastream) { |
|
|
|
|
|
|
|
foreach ($datastream as $datastreamValue) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (variable_get('fedora_object_restrict_datastreams', FALSE) == FALSE || ((isset($user) && in_array('administrator',$user->roles)) || in_array($datastreamValue->ID,$cmDatastreams))) { |
|
|
|
|
|
|
|
if ($datastreamValue->ID == 'OBJ') { |
|
|
|
|
|
|
|
$hasOBJStream = '1'; |
|
|
|
|
|
|
|
$mainStreamLabel = $datastreamValue->label; |
|
|
|
|
|
|
|
$mainStreamLabel = str_replace("_", " ", $mainStreamLabel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($datastreamValue->ID == 'TN') { |
|
|
|
|
|
|
|
$hasTNStream = TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//create the links to each datastream |
|
|
|
|
|
|
|
$dataStreamBody .= $this->create_link_for_ds($object_pid, $datastreamValue); //"<tr><td><b>$key :</b></td><td>$value</td></tr>\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$dataStreamBody .= "</table>\n"; |
|
|
|
|
|
|
|
//if they have access let them add a datastream |
|
|
|
|
|
|
|
if (user_access(ObjectHelper :: $ADD_FEDORA_STREAMS)) { |
|
|
|
|
|
|
|
$allow=TRUE; |
|
|
|
|
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
|
|
|
|
$allow= fedora_fesl_check_roles($object_pid,'write'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($allow) { |
|
|
|
|
|
|
|
$dataStreamBody .= drupal_get_form('add_stream_form', $object_pid); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$fieldset = array( |
|
|
|
|
|
|
|
'#title' => t("!text", array('!text' => $availableDataStreamsText)), |
|
|
|
|
|
|
|
'#collapsible' => TRUE, |
|
|
|
|
|
|
|
'#collapsed' => TRUE, |
|
|
|
|
|
|
|
'#value' => $dataStreamBody |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$dataStreamBody = '<div class = "fedora_detailed_list">' . theme('fieldset', $fieldset) . '</div>'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
$content = ''; |
|
|
|
$content = ''; |
|
|
|
|
|
|
|
|
|
|
|