|
|
@ -666,56 +666,6 @@ class ObjectHelper { |
|
|
|
$isCollection = TRUE; |
|
|
|
$isCollection = TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//$label=$content; |
|
|
|
|
|
|
|
$collectionName = $collection; |
|
|
|
|
|
|
|
if (!$pageNumber) { |
|
|
|
|
|
|
|
$pageNumber = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isset($collectionName)) { |
|
|
|
|
|
|
|
$collectionName = variable_get('fedora_repository_name', 'Collection'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$xslContent = $this->getXslContent($pid, $path); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//get collection list and display using xslt------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($content) && $content != FALSE) { |
|
|
|
|
|
|
|
$input = new DomDocument(); |
|
|
|
|
|
|
|
$input->loadXML(trim($content)); |
|
|
|
|
|
|
|
$results = $input->getElementsByTagName('result'); |
|
|
|
|
|
|
|
if ($results->length > 0) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
$proc = new XsltProcessor(); |
|
|
|
|
|
|
|
$proc->setParameter('', 'collectionPid', $collection_pid); |
|
|
|
|
|
|
|
$proc->setParameter('', 'collectionTitle', $collectionName); |
|
|
|
|
|
|
|
$proc->setParameter('', 'baseUrl', $base_url); |
|
|
|
|
|
|
|
$proc->setParameter('', 'path', $base_url . '/' . $path); |
|
|
|
|
|
|
|
$proc->setParameter('', 'hitPage', $pageNumber); |
|
|
|
|
|
|
|
$proc->registerPHPFunctions(); |
|
|
|
|
|
|
|
$xsl = new DomDocument(); |
|
|
|
|
|
|
|
$xsl->loadXML($xslContent); |
|
|
|
|
|
|
|
// php xsl does not seem to work with namespaces so removing it below |
|
|
|
|
|
|
|
// I may have just been being stupid here |
|
|
|
|
|
|
|
// $content = str_ireplace('xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result"', '', $content); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$xsl = $proc->importStylesheet($xsl); |
|
|
|
|
|
|
|
$newdom = $proc->transformToDoc($input); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$objectList = $newdom->saveXML(); //is the xml transformed to html as defined in the xslt associated with the collection object |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$objectList) { |
|
|
|
|
|
|
|
throw new Exception("Invalid XML."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
|
|
|
drupal_set_message(t('!e', array('!e' => $e->getMessage())), 'error'); |
|
|
|
|
|
|
|
return ''; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
drupal_set_message(t("No Objects in this collection or bad query.")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------- |
|
|
|
//-------------------------------------------------------------------------------- |
|
|
|
//show the collections datastreams |
|
|
|
//show the collections datastreams |
|
|
|
if ($results->length > 0 || $isCollection == TRUE) { |
|
|
|
if ($results->length > 0 || $isCollection == TRUE) { |
|
|
@ -739,45 +689,10 @@ class ObjectHelper { |
|
|
|
else { |
|
|
|
else { |
|
|
|
$ingestObject = ' '; |
|
|
|
$ingestObject = ' '; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$datastreams .= $ingestObject; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$objectListOut = ''; |
|
|
|
|
|
|
|
if (isset($objectList)) { |
|
|
|
|
|
|
|
$object_list_fieldset = array( |
|
|
|
|
|
|
|
'#title' => t('Items in this collection'), |
|
|
|
|
|
|
|
'#collapsible' => TRUE, |
|
|
|
|
|
|
|
'#collapsed' => FALSE, |
|
|
|
|
|
|
|
'#value' => (isset($objectList) ? $objectList : ''), //collection list |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$objectListOut = theme('fieldset', $object_list_fieldset); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//$collectionName=''; |
|
|
|
|
|
|
|
$collection_fieldset = array( |
|
|
|
|
|
|
|
'#title' => "", |
|
|
|
|
|
|
|
'#collapsible' => TRUE, |
|
|
|
|
|
|
|
'#collapsed' => FALSE, |
|
|
|
|
|
|
|
'#value' => $datastreams, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$objectListOut = ''; //no collection objects to show so don't show field set |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$output = ''; |
|
|
|
$datastreams .= $ingestObject; |
|
|
|
switch (variable_get('fedora_object_display_title', ObjectHelper::$DISPLAY_ALWAYS)) { |
|
|
|
|
|
|
|
case ObjectHelper :: $DISPLAY_NEVER: break; |
|
|
|
|
|
|
|
case ObjectHelper :: $DISPLAY_NO_MODEL_OUTPUT: |
|
|
|
|
|
|
|
if (trim($datastreams) == '') { |
|
|
|
|
|
|
|
$output .= '<strong>' . $collectionName . '</strong><br/>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case ObjectHelper :: $DISPLAY_ALWAYS: |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
$output .= '<strong>' . $collectionName . '</strong><br/>'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$output .= $datastreams; |
|
|
|
$output .= $datastreams; |
|
|
|
|
|
|
|
|
|
|
@ -808,20 +723,7 @@ class ObjectHelper { |
|
|
|
$output .= theme('fieldset', $fieldset); |
|
|
|
$output .= theme('fieldset', $fieldset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch (variable_get('fedora_collection_display_list', ObjectHelper::$DISPLAY_ALWAYS)) { |
|
|
|
|
|
|
|
case ObjectHelper :: $DISPLAY_NEVER: break; |
|
|
|
|
|
|
|
case ObjectHelper :: $DISPLAY_NO_MODEL_OUTPUT: |
|
|
|
|
|
|
|
if (trim($datastreams) == '') { |
|
|
|
|
|
|
|
$output .= $objectListOut . '<br/>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case ObjectHelper :: $DISPLAY_ALWAYS: |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
$output .= $objectListOut . '<br/>'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $output; |
|
|
|
return $output; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -869,6 +771,85 @@ class ObjectHelper { |
|
|
|
return $parent_collections_HTML; |
|
|
|
return $parent_collections_HTML; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function renderCollection($content, $pid, $dsId, $collection, $pageNumber = NULL) { |
|
|
|
|
|
|
|
$path = drupal_get_path('module', 'fedora_repository'); |
|
|
|
|
|
|
|
global $base_url; |
|
|
|
|
|
|
|
$collection_pid = $pid; //we will be changing the pid later maybe |
|
|
|
|
|
|
|
//module_load_include('php', ''Fedora_Repository'', 'ObjectHelper'); |
|
|
|
|
|
|
|
$objectHelper = $this; |
|
|
|
|
|
|
|
$parsedContent = NULL; |
|
|
|
|
|
|
|
$contentModels = $objectHelper->get_content_models_list($pid); |
|
|
|
|
|
|
|
$isCollection = FALSE; |
|
|
|
|
|
|
|
//if this is a collection object store the $pid in the session as it will come in handy |
|
|
|
|
|
|
|
//after a purge or ingest to return to the correct collection. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$fedoraItem = NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$collectionName = $collection; |
|
|
|
|
|
|
|
if (!$pageNumber) { |
|
|
|
|
|
|
|
$pageNumber = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isset($collectionName)) { |
|
|
|
|
|
|
|
$collectionName = variable_get('fedora_repository_name', 'Collection'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$xslContent = $this->getXslContent($pid, $path); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//get collection list and display using xslt------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($content) && $content != FALSE) { |
|
|
|
|
|
|
|
$input = new DomDocument(); |
|
|
|
|
|
|
|
$input->loadXML(trim($content)); |
|
|
|
|
|
|
|
$results = $input->getElementsByTagName('result'); |
|
|
|
|
|
|
|
if ($results->length > 0) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
$proc = new XsltProcessor(); |
|
|
|
|
|
|
|
$proc->setParameter('', 'collectionPid', $collection_pid); |
|
|
|
|
|
|
|
$proc->setParameter('', 'collectionTitle', $collectionName); |
|
|
|
|
|
|
|
$proc->setParameter('', 'baseUrl', $base_url); |
|
|
|
|
|
|
|
$proc->setParameter('', 'path', $base_url . '/' . $path); |
|
|
|
|
|
|
|
$proc->setParameter('', 'hitPage', $pageNumber); |
|
|
|
|
|
|
|
$proc->registerPHPFunctions(); |
|
|
|
|
|
|
|
$xsl = new DomDocument(); |
|
|
|
|
|
|
|
$xsl->loadXML($xslContent); |
|
|
|
|
|
|
|
// php xsl does not seem to work with namespaces so removing it below |
|
|
|
|
|
|
|
// I may have just been being stupid here |
|
|
|
|
|
|
|
// $content = str_ireplace('xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result"', '', $content); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$xsl = $proc->importStylesheet($xsl); |
|
|
|
|
|
|
|
$newdom = $proc->transformToDoc($input); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$objectList = $newdom->saveXML(); //is the xml transformed to html as defined in the xslt associated with the collection object |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$objectList) { |
|
|
|
|
|
|
|
throw new Exception("Invalid XML."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
|
|
|
drupal_set_message(t('!e', array('!e' => $e->getMessage())), 'error'); |
|
|
|
|
|
|
|
return ''; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
drupal_set_message(t("No Objects in this collection or bad query.")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$object_list_fieldset = array( |
|
|
|
|
|
|
|
'#title' => t('Items in this collection'), |
|
|
|
|
|
|
|
'#collapsible' => TRUE, |
|
|
|
|
|
|
|
'#collapsed' => FALSE, |
|
|
|
|
|
|
|
'#value' => (isset($objectList) ? $objectList : ''),); |
|
|
|
|
|
|
|
$objectListOut = theme('fieldset', $object_list_fieldset); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$output .= $objectListOut . '<br/>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $output; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* gets a list of datastreams and related function that we should use to show datastreams in their own fieldsets |
|
|
|
* gets a list of datastreams and related function that we should use to show datastreams in their own fieldsets |
|
|
|
* from the content model associated with the object |
|
|
|
* from the content model associated with the object |
|
|
|