|
|
@ -673,49 +673,32 @@ class CollectionClass { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* render collection |
|
|
|
* Assemble results in a somewhat more logical manner... |
|
|
|
* @global type $base_url |
|
|
|
* |
|
|
|
* @param type $content |
|
|
|
* ... Compared to generating a table in XSLT to contain a list (as |
|
|
|
* @param type $pid |
|
|
|
* renderCollection() used to do/does by default). |
|
|
|
* @param type $dsId |
|
|
|
* |
|
|
|
* @param type $collection |
|
|
|
* @param $sparql_results array |
|
|
|
* @param int $pageNumber |
|
|
|
* The array of results as yielded by ObjectHelper::parseSparqlResults() |
|
|
|
* @return type |
|
|
|
* (and those associated functions which make use of it) |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
* An array to be passed to drupal_render, containing a pager, an unordered |
|
|
|
|
|
|
|
* list of items, and another pager. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function renderCollection($content, $pid, $dsId, $collectionName, $pageNumber = NULL) { |
|
|
|
public static function assembleCollectionView($sparql_results) { |
|
|
|
$path = drupal_get_path('module', 'fedora_repository'); |
|
|
|
|
|
|
|
global $base_url; |
|
|
|
|
|
|
|
$collection_pid = $pid; //we will be changing the pid later maybe |
|
|
|
|
|
|
|
$parsedContent = NULL; |
|
|
|
|
|
|
|
$contentModels = $this->collectionObject->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; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($collectionName)) { |
|
|
|
|
|
|
|
$collectionName = menu_get_active_title(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$xslContent = $this->getXslContent($pid, $path); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$objectList = ''; |
|
|
|
|
|
|
|
if (isset($content) && $content != FALSE) { |
|
|
|
|
|
|
|
if (!$xslContent) { //Didn't find an XSLT. |
|
|
|
|
|
|
|
$intermediate_results = ObjectHelper::parse_sparql_results($content); |
|
|
|
|
|
|
|
unset($content); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$per_page = 20; //XXX: Make this configurable. |
|
|
|
$per_page = 20; //XXX: Make this configurable. |
|
|
|
$pager_name = 0; |
|
|
|
$pager_name = 0; |
|
|
|
$total = count($intermediate_results); |
|
|
|
$total = count($sparql_results); |
|
|
|
$pager_page = self::hackPager($pager_name, $per_page, $total); |
|
|
|
$pager_page = self::hackPager($pager_name, $per_page, $total); |
|
|
|
|
|
|
|
|
|
|
|
$results = array(); |
|
|
|
$results = array(); |
|
|
|
foreach (array_slice($intermediate_results, $per_page * $pager_page, $per_page) as $result) { |
|
|
|
foreach (array_slice($sparql_results, $per_page * $pager_page, $per_page) as $result) { |
|
|
|
$title = $result['title']; |
|
|
|
$title = $result['title']; |
|
|
|
$obj_path = "fedora/repository/{$result['object']}"; |
|
|
|
$obj_path = "fedora/repository/{$result['object']}"; |
|
|
|
$thumbnail = theme('image', "$obj_path/TN", $title, $title, array(), FALSE); |
|
|
|
$tn_path = ($result['thumbnail'] ? |
|
|
|
|
|
|
|
"fedora/repository/{$result['thumbnail']}": |
|
|
|
|
|
|
|
"$obj_path/TN"); |
|
|
|
|
|
|
|
$thumbnail = theme('image', $tn_path, $title, $title, array(), FALSE); |
|
|
|
$results[] = array( |
|
|
|
$results[] = array( |
|
|
|
'data' => l($thumbnail, $obj_path, array( |
|
|
|
'data' => l($thumbnail, $obj_path, array( |
|
|
|
'html' => TRUE, |
|
|
|
'html' => TRUE, |
|
|
@ -738,13 +721,64 @@ class CollectionClass { |
|
|
|
'@last' => $last, |
|
|
|
'@last' => $last, |
|
|
|
'@total' => $total, |
|
|
|
'@total' => $total, |
|
|
|
)); |
|
|
|
)); |
|
|
|
//$objectList = '<h3>' . $results_range_text . '</h3>'; |
|
|
|
|
|
|
|
$objectList .= theme('pager', array(), $per_page, $pager_name); |
|
|
|
return array( |
|
|
|
$objectList .= theme('item_list', $results, $result_range_text, 'ul', array( |
|
|
|
array( |
|
|
|
|
|
|
|
'#type' => 'markup', |
|
|
|
|
|
|
|
'#value' => theme('pager', array(), $per_page, $pager_name), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
array( |
|
|
|
|
|
|
|
'#type' => 'markup', |
|
|
|
|
|
|
|
'#value' => theme('item_list', $results, $result_range_text, 'ul', array( |
|
|
|
'class' => 'islandora-collection-results-list', |
|
|
|
'class' => 'islandora-collection-results-list', |
|
|
|
)); |
|
|
|
)) |
|
|
|
$objectList .= theme('pager', array(), $per_page, $pager_name); |
|
|
|
), |
|
|
|
|
|
|
|
array( |
|
|
|
|
|
|
|
'#type' => 'markup', |
|
|
|
|
|
|
|
'#value' => theme('pager', array(), $per_page, $pager_name) |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* render collection |
|
|
|
|
|
|
|
* @global type $base_url |
|
|
|
|
|
|
|
* @param type $content |
|
|
|
|
|
|
|
* @param type $pid |
|
|
|
|
|
|
|
* @param type $dsId |
|
|
|
|
|
|
|
* @param type $collection |
|
|
|
|
|
|
|
* @param int $pageNumber |
|
|
|
|
|
|
|
* @return type |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
function renderCollection($content, $pid, $dsId, $collectionName, $pageNumber = NULL) { |
|
|
|
|
|
|
|
$path = drupal_get_path('module', 'fedora_repository'); |
|
|
|
|
|
|
|
global $base_url; |
|
|
|
|
|
|
|
$collection_pid = $pid; //we will be changing the pid later maybe |
|
|
|
|
|
|
|
$parsedContent = NULL; |
|
|
|
|
|
|
|
$contentModels = $this->collectionObject->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; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($collectionName)) { |
|
|
|
|
|
|
|
$collectionName = menu_get_active_title(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$xslContent = $this->getXslContent($pid, $path); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$objectList = ''; |
|
|
|
|
|
|
|
if (isset($content) && $content != FALSE) { |
|
|
|
|
|
|
|
if (!$xslContent) { //Didn't find an XSLT. |
|
|
|
|
|
|
|
return drupal_render( |
|
|
|
|
|
|
|
self::assembleCollectionView( |
|
|
|
|
|
|
|
$this->collectionObject->parseSparqlResults( |
|
|
|
|
|
|
|
$content |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
if (!$pageNumber) { |
|
|
|
if (!$pageNumber) { |
|
|
|