From 7eb4000c86a20e885ad6da447a99ec3c4a98abbc Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Wed, 18 Jul 2012 13:14:02 -0400 Subject: [PATCH] Implemented author controller. --- module/VuFind/config/module.config.php | 1 + .../VuFind/Controller/AuthorController.php | 84 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 module/VuFind/src/VuFind/Controller/AuthorController.php diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 409ead97a24..6912bf361b4 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -65,6 +65,7 @@ $config = array( 'admin' => 'VuFind\Controller\AdminController', 'ajax' => 'VuFind\Controller\AjaxController', 'alphabrowse' => 'VuFind\Controller\AlphabrowseController', + 'author' => 'VuFind\Controller\AuthorController', 'cover' => 'VuFind\Controller\CoverController', 'error' => 'VuFind\Controller\ErrorController', 'index' => 'VuFind\Controller\IndexController', diff --git a/module/VuFind/src/VuFind/Controller/AuthorController.php b/module/VuFind/src/VuFind/Controller/AuthorController.php new file mode 100644 index 00000000000..5211d723365 --- /dev/null +++ b/module/VuFind/src/VuFind/Controller/AuthorController.php @@ -0,0 +1,84 @@ +<?php +/** + * Author Search 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; + +/** + * Author Search Options + * + * @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 AuthorController extends AbstractSearch +{ + /** + * Sets the configuration for displaying author results + * + * @return void + */ + public function resultsAction() + { + $this->searchClassId = 'SolrAuthor'; + $this->saveToHistory = false; + return parent::resultsAction(); + } + + /** + * Sets the configuration for performing an author search + * + * @return void + */ + public function searchAction() + { + $this->searchClassId = 'SolrAuthorFacets'; + $this->saveToHistory = false; + $this->useResultScroller = false; + $this->rememberSearch = false; + return parent::resultsAction(); + } + + /** + * Displays the proper page for a search action + * + * @return void + */ + public function homeAction() + { + // If an author was requested, forward to the results page; otherwise, + // display the search form: + $author = $this->params()->fromQuery('author'); + if (!empty($author)) { + return $this->forward() + ->dispatch('Author', array('action' => 'Results')); + } + return $this->createViewModel(); + } +} + -- GitLab