From 4a168c8c85f13d032363baa6f19eb46a79aad812 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 3 Oct 2012 12:23:54 -0400
Subject: [PATCH] Updated Summon controller with separate methods for loading
 advanced/homepage facets; these currently load the same data, but this
 provides an integration point for separate lists consistent with VUFIND-348.

---
 .../VuFind/Controller/SummonController.php    | 21 ++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/module/VuFind/src/VuFind/Controller/SummonController.php b/module/VuFind/src/VuFind/Controller/SummonController.php
index 710bbbfadd9..cacc66ec3e8 100644
--- a/module/VuFind/src/VuFind/Controller/SummonController.php
+++ b/module/VuFind/src/VuFind/Controller/SummonController.php
@@ -101,7 +101,7 @@ class SummonController extends AbstractSearch
     public function homeAction()
     {
         return $this->createViewModel(
-            array('results' => $this->getAdvancedFacets())
+            array('results' => $this->getHomePageFacets())
         );
     }
 
@@ -117,8 +117,7 @@ class SummonController extends AbstractSearch
 
     /**
      * Return a Search Results object containing advanced facet information.  This
-     * data may come from the cache, and it is currently shared between the Home
-     * page and the Advanced search screen.
+     * data may come from the cache.
      *
      * @return \VuFind\Search\Summon\Results
      */
@@ -126,7 +125,7 @@ class SummonController extends AbstractSearch
     {
         // Check if we have facet results cached, and build them if we don't.
         $cache = $this->getServiceLocator()->get('CacheManager')->getCache('object');
-        if (!($results = $cache->getItem('summonSearchHomeFacets'))) {
+        if (!($results = $cache->getItem('summonSearchAdvancedFacets'))) {
             $sm = $this->getSearchManager();
             $params = $sm->setSearchClassId('Summon')->getParams();
             $params->addFacet('Language,or,1,20');
@@ -142,7 +141,7 @@ class SummonController extends AbstractSearch
             // Temporarily remove the service manager so we can cache the
             // results (otherwise we'll get errors about serializing closures):
             $results->unsetServiceLocator();
-            $cache->setItem('summonSearchHomeFacets', $results);
+            $cache->setItem('summonSearchAdvancedFacets', $results);
         }
 
         // Restore the real service locator to the object:
@@ -150,6 +149,18 @@ class SummonController extends AbstractSearch
         return $results;
     }
 
+    /**
+     * Return a Search Results object containing homepage facet information.  This
+     * data may come from the cache.
+     *
+     * @return \VuFind\Search\Summon\Results
+     */
+    protected function getHomePageFacets()
+    {
+        // For now, we'll use the same fields as the advanced search screen.
+        return $this->getAdvancedFacets();
+    }
+
     /**
      * Process the facets to be used as limits on the Advanced Search screen.
      *
-- 
GitLab