Skip to content
Snippets Groups Projects
Commit bfdbc646 authored by Robert Lange's avatar Robert Lange
Browse files

refs #17407 [fid_bbi] replace bbi specific sources list by amsl values

* replace link in footer
* delete bbi search controller
* remove definition of search controller and sources route in module.config.php
parent d281e08a
Branches
Tags
No related merge requests found
...@@ -38,7 +38,6 @@ $config = [ ...@@ -38,7 +38,6 @@ $config = [
'controllers' => [ 'controllers' => [
'factories' => [ 'factories' => [
'fid_bbi\Controller\FeedbackController' => 'VuFind\Controller\AbstractBaseFactory', 'fid_bbi\Controller\FeedbackController' => 'VuFind\Controller\AbstractBaseFactory',
'fid_bbi\Controller\SearchController' => 'VuFind\Controller\AbstractBaseFactory',
'fid_bbi\Controller\MyResearchController' => 'VuFind\Controller\AbstractBaseFactory', 'fid_bbi\Controller\MyResearchController' => 'VuFind\Controller\AbstractBaseFactory',
'fid_bbi\Controller\RecordController' => 'VuFind\Controller\AbstractBaseWithConfigFactory', 'fid_bbi\Controller\RecordController' => 'VuFind\Controller\AbstractBaseWithConfigFactory',
'fid_bbi\Controller\BrowseController' => 'VuFind\Controller\AbstractBaseWithConfigFactory', 'fid_bbi\Controller\BrowseController' => 'VuFind\Controller\AbstractBaseWithConfigFactory',
...@@ -46,8 +45,6 @@ $config = [ ...@@ -46,8 +45,6 @@ $config = [
'aliases' => [ 'aliases' => [
'feedback' => 'fid_bbi\Controller\FeedbackController', 'feedback' => 'fid_bbi\Controller\FeedbackController',
'Feedback' => 'fid_bbi\Controller\FeedbackController', 'Feedback' => 'fid_bbi\Controller\FeedbackController',
'Search' => 'fid_bbi\Controller\SearchController',
'search' => 'fid_bbi\Controller\SearchController',
'Record' => 'fid_bbi\Controller\RecordController', 'Record' => 'fid_bbi\Controller\RecordController',
'record' => 'fid_bbi\Controller\RecordController', 'record' => 'fid_bbi\Controller\RecordController',
'VuFind\Controller\MyResearchController' => 'fid_bbi\Controller\MyResearchController', 'VuFind\Controller\MyResearchController' => 'fid_bbi\Controller\MyResearchController',
...@@ -192,8 +189,7 @@ $staticRoutes = [ ...@@ -192,8 +189,7 @@ $staticRoutes = [
'MyResearch/Usertags', 'MyResearch/Usertags',
'dds/Home', 'dds/Home',
'dds/Email', 'dds/Email',
'Record/EblLink', 'Record/EblLink'
'Search/Sources'
]; ];
$routeGenerator = new \VuFind\Route\RouteGenerator($nonTabRecordActions); $routeGenerator = new \VuFind\Route\RouteGenerator($nonTabRecordActions);
......
<?php
/**
* Default 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package Controller
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org Main Site
*/
namespace fid_bbi\Controller;
use VuFind\Controller\SearchController as BaseSearchController;
/**
* Redirects the user to the appropriate default VuFind action.
*
* @category VuFind
* @package Controller
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org Main Site
*/
class SearchController extends BaseSearchController
{
/**
* Home action
*
* @return mixed
*/
public function sourcesAction()
{
$homepageFacets = $this->getConfig('facets')->HomePage->toArray();
$facetCache = $this->serviceLocator
->get('VuFind\Search\FacetCache\PluginManager')
->get($this->searchClassId);
$facets = $facetCache->getList('Advanced');
$results = $facetCache->getResults();
$renderer = $this->getViewRenderer();
$facetList = [];
foreach ($homepageFacets as $facet => $label)
{
$facetList = array_merge(
$facetList,
$renderer->sortFacetList(
$results,
$facet,
$this->filterFacets(
$facets[$facet]['list'],
$facet
),
'search-results'
)
);
}
uasort($facetList,function ($a,$b) use ($renderer)
{
return strnatcmp(
ucfirst($renderer->translate('Facet::' . $a)),
ucfirst($renderer->translate('Facet::' . $b))
);
});
$view = $this->createViewModel(
[
'data' => $facetList,
'results' => $results
]
);
$view->setTemplate('search/sources.phtml');
return $view;
}
protected function filterFacets($facetList,$facet)
{
$whitelist = $this->getConfig('facets')->get('AllowFacetValue')->get($facet);
if (!empty($whitelist)) {
$whitelist = $whitelist->toArray();
$facetList
= array_filter(
$facetList,
function ($facet_info) use ($whitelist) {
return in_array($facet_info['value'], $whitelist);
}
);
}
return $facetList;
}
}
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
<p><strong><?=$this->transEsc('Search Options')?></strong></p> <p><strong><?=$this->transEsc('Search Options')?></strong></p>
<ul> <ul>
<li><a href="<?=$this->url('search-advanced')?>"><?=$this->transEsc('Advanced Search')?></a></li> <li><a href="<?=$this->url('search-advanced')?>"><?=$this->transEsc('Advanced Search')?></a></li>
<li><a href="<?=$this->url('search-sources')?>"><?=$this->transEsc('Data Collection')?></a></li> <li><a href="<?=$this->url('resources')?>"><?=$this->translate('Data Collection')?></a></li>
<li><a data-toggle="collapse" data-target="#searchbox-snippet"><?=$this->transEsc('embed_searchbox_button')?></a></li> <li><a data-toggle="collapse" data-target="#searchbox-snippet"><?=$this->transEsc('embed_searchbox_button')?></a></li>
<li><a href="<?=$this->url('resources')?>"><?=$this->translate('Amsl_Resources')?></a></li>
</ul> </ul>
</div> </div>
<div class="footer-column"> <div class="footer-column">
......
<div class="searchHomeContent">
<div class="search-home-facets">
<div class="home-facet?>">
<h2><?=$this->transEsc('browse_sources')?></h2>
<div class="home-facet-container">
<ul class="home-facet-list">
<?php foreach ($data as $url => $value): ?>
<li><a href="<?=$url?>"><?=$this->transEsc('Facet::'.$value)?></a></li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
</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