Skip to content
Snippets Groups Projects
Commit 357654c0 authored by Demian Katz's avatar Demian Katz
Browse files

Created collection controller; for starters, just an extension of...

Created collection controller; for starters, just an extension of AbstractRecord with a few minor changes and some cloned Solr Record templates.
parent ae281efc
No related merge requests found
......@@ -126,6 +126,7 @@ $config = array(
'authority' => 'VuFind\Controller\AuthorityController',
'browse' => 'VuFind\Controller\BrowseController',
'cart' => 'VuFind\Controller\CartController',
'collection' => 'VuFind\Controller\CollectionController',
'cover' => 'VuFind\Controller\CoverController',
'error' => 'VuFind\Controller\ErrorController',
'help' => 'VuFind\Controller\HelpController',
......@@ -491,6 +492,7 @@ $config = array(
// Define record view routes -- route name => controller
$recordRoutes = array(
'record' => 'Record',
'collection' => 'Collection',
'missingrecord' => 'MissingRecord',
'solrauthrecord' => 'Authority',
'summonrecord' => 'SummonRecord',
......
<?php
/**
* Collection Controller
*
* PHP version 5
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category VuFind2
* @package Controller
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org Main Site
*/
namespace VuFind\Controller;
/**
* Collection Controller
*
* @category VuFind2
* @package Controller
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org Main Site
*/
class CollectionController extends AbstractRecord
{
/**
* Constructor
*/
public function __construct()
{
// Call standard record controller initialization:
parent::__construct();
// TODO: set appropriate default tab
}
/**
* Get the tab configuration for this controller.
*
* @return array
*/
protected function getTabConfiguration()
{
// TODO: fill in
return array();
}
/**
* Display a particular tab.
*
* @param string $tab Name of tab to display
* @param bool $ajax Are we in AJAX mode?
*
* @return mixed
*/
protected function showTab($tab, $ajax = false)
{
$result = parent::showTab($tab, $ajax);
if (!$ajax && $result instanceof \Zend\View\Model\ViewModel) {
$result->setTemplate('collection/view');
}
return $result;
}
}
<?
// Set up standard record scripts:
$this->headScript()->appendFile("record.js");
$this->headScript()->appendFile("check_save_statuses.js");
// Add RDF header link if applicable:
if ($this->driver->supportsExport('RDF')) {
$this->headLink()->appendAlternate($this->recordLink()->getActionUrl($this->driver, 'RDF'), 'application/rdf+xml', 'RDF Representation');
}
// Set up breadcrumbs:
$this->layout()->breadcrumbs = $this->getLastSearchLink($this->transEsc('Search'), '', '<span>&gt;</span>') .
$this->recordLink()->getBreadcrumb($this->driver);
?>
<div class="<?=$this->layoutClass('mainbody')?>">
<?=$this->record($this->driver)->getToolbar()?>
<div class="record recordId source<?=$this->escapeHtml($this->driver->getResourceSource())?>" id="record">
<input type="hidden" value="<?=$this->escapeHtml($this->driver->getUniqueId())?>" class="hiddenId" id="record_id" />
<?=$this->flashmessages()?>
<? if (isset($this->scrollData) && ($this->scrollData['previousRecord'] || $this->scrollData['nextRecord'])): ?>
<div class="resultscroller">
<? if ($this->scrollData['previousRecord']): ?><a href="<?=$this->recordLink()->getUrl($this->scrollData['previousRecord'])?>">&laquo; <?=$this->transEsc('Prev')?></a><? endif; ?>
#<?=$this->escapeHtml($this->scrollData['currentPosition']) . ' ' . $this->transEsc('of') . ' ' . $this->escapeHtml($this->scrollData['resultTotal'])?>
<? if ($this->scrollData['nextRecord']): ?><a href="<?=$this->recordLink()->getUrl($this->scrollData['nextRecord'])?>"><?=$this->transEsc('Next')?> &raquo;</a><? endif; ?>
</div>
<? endif; ?>
<?=$this->record($this->driver)->getCoreMetadata()?>
</div>
<? if (count($this->tabs) > 0): ?>
<div id="tabnav">
<ul>
<? foreach ($this->tabs as $tab => $obj): ?>
<? // add current tab to breadcrumbs if applicable:
$desc = $obj->getDescription();
$isCurrent = (strtolower($this->activeTab) == strtolower($tab));
if ($isCurrent) {
$this->layout()->breadcrumbs .= '<span>&gt;</span><em>' . $this->transEsc($desc) . '</em>';
$activeTabObj = $obj;
}
?>
<li<?=$isCurrent ? ' class="active"' : ''?>>
<a href="<?=$this->recordLink()->getTabUrl($this->driver, $tab)?>#tabnav"><?=$this->transEsc($desc)?></a>
</li>
<? endforeach; ?>
</ul>
<div class="clear"></div>
</div>
<? endif; ?>
<div class="recordsubcontent">
<?=isset($activeTabObj) ? $this->record($this->driver)->getTab($activeTabObj) : '' ?>
</div>
<span class="Z3988" title="<?=$this->escapeHtml($this->driver->getOpenURL())?>"></span>
</div>
<div class="<?=$this->layoutClass('sidebar')?>">
<? foreach ($this->driver->getRelated() as $current): ?>
<?=$this->related($current)?>
<? endforeach; ?>
</div>
<div class="clear"></div>
<?
// Grab tab contents up front -- this will set the page title, which we need to
// do before we display the page header below.
$activeTab = false;
foreach ($this->tabs as $tab => $obj) {
if (strtolower($tab) == strtolower($this->activeTab)) {
$activeTab = $tab;
}
}
$tab = $activeTab ? $this->record($this->driver)->getTab($this->tabs[$activeTab]) : '';
?>
<div data-role="page" id="Record-view">
<?=$this->mobileMenu()->header(array('searchLink' => $this->searchOptions($this->searchClassId)->getSearchHomeAction()))?>
<div class="record" data-role="content" data-record-id="<?=$this->escapeHtml($this->driver->getUniqueId())?>">
<?=$this->flashmessages()?>
<? if ($this->activeTab == $this->defaultTab): ?>
<?=$this->record($this->driver)->getCoreMetadata()?>
<? else: ?>
<h3><?=$this->escapeHtml($this->driver->getBreadcrumb())?></h3>
<? endif; ?>
<?=$tab?>
<?=$this->record($this->driver)->getToolbar()?>
</div>
<?=$this->mobileMenu()->footer()?>
</div>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment