Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 40 additions & 8 deletions controllers/ResultsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ public function indexAction()
$limit = get_option('per_page_public');
$page = $this->_request->page ? $this->_request->page : 1;
$start = ($page-1) * $limit;

// Set the pagination.
Zend_Registry::set('pagination', array(
'page' => $page,
'total_results' => $results->response->numFound,
'per_page' => $limit
));


// determine whether to display private items or not
Expand All @@ -61,15 +68,40 @@ public function indexAction()
$limitToPublicItems = true;
}

// Execute the query.
$results = $this->_search($start, $limit, $limitToPublicItems);
// Get Collection information in case collection facet has been applied
// This maybe used to display information about a faceted collection along with the result
$collection = false;
$parseFacets = SolrSearch_Helpers_Facet::parseFacets();

// Set the pagination.
Zend_Registry::set('pagination', array(
'page' => $page,
'total_results' => $results->response->numFound,
'per_page' => $limit
));
foreach($parseFacets as $f) {

// Check if contains the facet type: "collection"
if(in_array('collection', $f)) {

// Get collection name
$collectionName = $f[1];

// Get all public collections
$collections = get_records('Collection', array('public' => 1));

// Loop through collections
foreach($collections as $c) {

// Check name with facet name
if(metadata($c, array('Dublin Core', 'Title')) == $collectionName) {

// assign collection
$collection = $c;

}

}

}
}

// Push collection info to view
$this->view->collection = $collection;

// Push results to the view.
$this->view->results = $results;
Expand Down
9 changes: 9 additions & 0 deletions views/shared/results/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@
<h2 id="num-found">
<?php echo $results->response->numFound; ?> results
</h2>

<!-- Display collection info, if collection facet has been applied. -->
<!-- Change location of display and HTML markup tags as desired -->
<?php if($collection) : ?>
<div id="collection-info">
<h2><?php echo metadata($collection, array('Dublin Core', 'Title')); ?></h2>
<p><?php echo metadata($collection, array('Dublin Core', 'Description')); ?></p>
</div>
<?php endif; ?>

<?php foreach ($results->response->docs as $doc): ?>

Expand Down