Skip to content
Open
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
24 changes: 21 additions & 3 deletions application/controllers/CollectionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,31 @@ public function init()
}

/**
* The show collection action
* The show collection action.
*
* Note -- this also includes aspects of a browseAction in that in showing
* a single collection the action is also browsing items within that collection.
*/
public function showAction()
{
parent::showAction();
$this->view->items = $this->_helper->db->getTable('Item')->findBy(
array('collection' => $this->view->collection->id), $this->_getBrowseRecordsPerPage());
$recordsPerPage = $this->_getBrowseRecordsPerPage();
$currentPage = $this->getParam('page', 1);
$params = array('collection' => $this->view->collection->id);
$records = $this->_helper->db->getTable('Item')->findBy(
$params, $recordsPerPage, $currentPage);
$totalRecords = $this->_helper->db->getTable('Item')->count($params);

// Add pagination data to the registry. Used by pagination_links().
if ($recordsPerPage) {
Zend_Registry::set('pagination', array(
'page' => $currentPage,
'per_page' => $recordsPerPage,
'total_results' => $totalRecords,
));

$this->view->assign(array('items' => $records, 'total_results' => $totalRecords));
}
}

/**
Expand Down