From b0b26f49f24bbe82b2dceb772d3ffa2e5eb8d0a8 Mon Sep 17 00:00:00 2001
From: lbrun <leo@sandbox.pergame.net>
Date: Wed, 18 Nov 2015 15:16:45 +0100
Subject: [PATCH] dev#23223_sito_widget_pagination: disable cache on pagination

---
 .../modules/opac/controllers/SitoController.php     |  1 +
 library/ZendAfi/View/Helper/Accueil/Sito.php        | 13 ++++++++++++-
 public/opac/css/global.css                          |  3 +++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/application/modules/opac/controllers/SitoController.php b/application/modules/opac/controllers/SitoController.php
index b5a0a6eb072..767cff1bce9 100644
--- a/application/modules/opac/controllers/SitoController.php
+++ b/application/modules/opac/controllers/SitoController.php
@@ -107,6 +107,7 @@ class SitoController extends Zend_Controller_Action {
     $helper = new ZendAfi_View_Helper_Accueil_Sito($id_module, $module_params);
     $helper->setPage($page);
     $helper->setView($this->view);
+    $helper->disableCache();
 
     $this->view->sito_helper = $helper;
     $viewRenderer = $this->getHelper('ViewRenderer');
diff --git a/library/ZendAfi/View/Helper/Accueil/Sito.php b/library/ZendAfi/View/Helper/Accueil/Sito.php
index d9d1f2ba741..ee340700e3b 100644
--- a/library/ZendAfi/View/Helper/Accueil/Sito.php
+++ b/library/ZendAfi/View/Helper/Accueil/Sito.php
@@ -27,13 +27,20 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base
   const DISPLAY_GROUPED = 2;
   const DISPLAY_HIERARCHY = 3;
 
-  protected $strategy, $page;
+  protected $strategy, $page, $disable_cache = false;
 
   protected function _renderHeadScriptsOn($script_loader) {
     $this->getStrategy()->renderHeadScriptsOn($script_loader);
   }
 
 
+  public function shouldCacheContent() {
+    if ($this->disable_cache)
+      return false;
+    return parent::shouldCacheContent();
+  }
+
+
   protected function getStrategy() {
     if($this->strategy)
       return $this->strategy;
@@ -91,6 +98,10 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base
     $this->page = $page;
     return $this;
   }
+
+  public function disableCache() {
+    $this->disable_cache = true;
+  }
 }
 
 
diff --git a/public/opac/css/global.css b/public/opac/css/global.css
index 52599c01988..71f4800ba20 100644
--- a/public/opac/css/global.css
+++ b/public/opac/css/global.css
@@ -717,6 +717,9 @@ select{color:#666666;font-family:Arial;font-size:1em;}
     font-weight: bold;
 }
 
+.sitotheque, .boite.sito .paginationControl {
+    clear: both;
+}
 
 .sitotheque img {
     float: left;
-- 
GitLab