From 3d16223dd3985212311f5a7acab0f6b01ae54c02 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 18 Jul 2012 13:18:45 -0400
Subject: [PATCH] Added "powered by" message to Summon controllers.

---
 .../VuFind/Controller/SummonController.php    | 31 ++++++++++++++++---
 .../Controller/SummonrecordController.php     | 30 +++++++++++++++---
 2 files changed, 52 insertions(+), 9 deletions(-)

diff --git a/module/VuFind/src/VuFind/Controller/SummonController.php b/module/VuFind/src/VuFind/Controller/SummonController.php
index 46755025b99..cc85443b0de 100644
--- a/module/VuFind/src/VuFind/Controller/SummonController.php
+++ b/module/VuFind/src/VuFind/Controller/SummonController.php
@@ -28,7 +28,7 @@
 namespace VuFind\Controller;
 use VuFind\Cache\Manager as CacheManager,
     VuFind\Search\Summon\Params as SummonParams,
-    VuFind\Search\Summon\Results as SummonResults;
+    VuFind\Search\Summon\Results as SummonResults, Zend\Mvc\MvcEvent;
 
 /**
  * Summon Controller
@@ -49,13 +49,34 @@ class SummonController extends AbstractSearch
     {
         $this->searchClassId = 'Summon';
         $this->useResultScroller = false;
-        /* TODO
-        $this->view->layout()->poweredBy
-            = 'Powered by Summonâ„¢ from Serials Solutions, a division of ProQuest.';
-         */
         parent::__construct();
     }
 
+    /**
+     * preDispatch -- block access when appropriate.
+     *
+     * @param MvcEvent $e Event object
+     *
+     * @return void
+     */
+    public function preDispatch(MvcEvent $e)
+    {
+        $this->layout()->poweredBy
+            = 'Powered by Summonâ„¢ from Serials Solutions, a division of ProQuest.';
+    }
+
+    /**
+     * Register the default events for this controller
+     *
+     * @return void
+     */
+    protected function attachDefaultListeners()
+    {
+        parent::attachDefaultListeners();
+        $events = $this->getEventManager();
+        $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 1000);
+    }
+
     /**
      * Handle an advanced search
      *
diff --git a/module/VuFind/src/VuFind/Controller/SummonrecordController.php b/module/VuFind/src/VuFind/Controller/SummonrecordController.php
index 486677a63e0..d6f8e825f18 100644
--- a/module/VuFind/src/VuFind/Controller/SummonrecordController.php
+++ b/module/VuFind/src/VuFind/Controller/SummonrecordController.php
@@ -26,6 +26,7 @@
  * @link     http://vufind.org   Main Site
  */
 namespace VuFind\Controller;
+use Zend\Mvc\MvcEvent;
 
 /**
  * Summon Record Controller
@@ -48,12 +49,33 @@ class SummonrecordController extends AbstractRecord
         $this->searchClassId = 'Summon';
         $this->useResultScroller = false;
         $this->defaultTab = 'Description';
-        /* TODO
-        $this->view->layout()->poweredBy
-            = 'Powered by Summonâ„¢ from Serials Solutions, a division of ProQuest.';
-         */
 
         // Call standard record controller initialization:
         parent::__construct();
     }
+
+    /**
+     * preDispatch -- block access when appropriate.
+     *
+     * @param MvcEvent $e Event object
+     *
+     * @return void
+     */
+    public function preDispatch(MvcEvent $e)
+    {
+        $this->layout()->poweredBy
+            = 'Powered by Summonâ„¢ from Serials Solutions, a division of ProQuest.';
+    }
+
+    /**
+     * Register the default events for this controller
+     *
+     * @return void
+     */
+    protected function attachDefaultListeners()
+    {
+        parent::attachDefaultListeners();
+        $events = $this->getEventManager();
+        $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 1000);
+    }
 }
-- 
GitLab