From 80e231cf17fac58eff22306422b3cad8c9b6eed6 Mon Sep 17 00:00:00 2001 From: pbarroca <pbarroca@afi-sa.fr> Date: Fri, 24 Oct 2014 10:05:05 +0200 Subject: [PATCH] fix #17308 : set view on manually instanciated view helper --- library/ZendAfi/View/Helper/Accueil/Sito.php | 24 +++++++------------- library/ZendAfi/View/Helper/WebThumbnail.php | 1 + 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/library/ZendAfi/View/Helper/Accueil/Sito.php b/library/ZendAfi/View/Helper/Accueil/Sito.php index 0d01a23aecf..4fc3a089dfe 100644 --- a/library/ZendAfi/View/Helper/Accueil/Sito.php +++ b/library/ZendAfi/View/Helper/Accueil/Sito.php @@ -18,9 +18,6 @@ * along with AFI-OPAC 2.0; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// OPAC3 - Class_Module_Sito -> Sitothèque -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base { protected function _renderHeadScriptsOn($script_loader) { @@ -33,17 +30,14 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base });'); } - //--------------------------------------------------------------------- - // CONSTRUCTION du Html - //--------------------------------------------------------------------- + public function getHtml() { extract($this->preferences); $contenu = ''; - // Sélection de catégories ou d'articles if ($this->isTypeAffichageSelection()) { - $sites = Class_Sitotheque::getLoader()->getSitesFromIdsAndCategories( - explode('-', $id_items), - explode('-', $id_categorie)); + $sites = Class_Sitotheque::getSitesFromIdsAndCategories( + explode('-', $id_items), + explode('-', $id_categorie)); shuffle($sites); $contenu.=$this->renderSitesSlice($sites,$nb_aff); @@ -53,7 +47,6 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base $titre); } - // Les plus recents if ($this->isTypeAffichagePlusRecents() && $nb_aff > 0) { $last_sito = Class_Sitotheque::getLoader()->findAllBy(array('limit' => 50)); shuffle($last_sito); @@ -67,6 +60,7 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base $titre); $contenu.=$this->renderSitesSlice($last_sito,$nb_aff); } + $this->titre=$titre; $this->contenu = $contenu; return $this->getHtmlArray(); @@ -84,7 +78,7 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base public function isGroupByCategorie() { - if (!array_isset('group_by_categorie', $this->preferences)) + if (!array_isset('group_by_categorie', $this->preferences)) return false; return $this->preferences['group_by_categorie'] == true; @@ -103,9 +97,6 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base } - //--------------------------------------------------------------------- - // Html pour 1 ou plusieurs sites - //--------------------------------------------------------------------- protected function renderSitesSlice($sites,$nb_aff) { if(!$sites) return ""; @@ -157,7 +148,8 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base public function getThumbnail($url) { if (!isset($this->thumbnails_helper)) - $this->thumbnails_helper = new ZendAfi_View_Helper_WebThumbnail(); + $this->thumbnails_helper = (new ZendAfi_View_Helper_WebThumbnail()) + ->setView($this->view); return $this->thumbnails_helper->webThumbnail($url); } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/WebThumbnail.php b/library/ZendAfi/View/Helper/WebThumbnail.php index d985599dea0..0be5a15f43a 100644 --- a/library/ZendAfi/View/Helper/WebThumbnail.php +++ b/library/ZendAfi/View/Helper/WebThumbnail.php @@ -28,6 +28,7 @@ class ZendAfi_View_Helper_WebThumbnail extends ZendAfi_View_Helper_BaseHelper { public function webThumbnail($url) { + xdebug_break(); $this->checkThumbsDir(); $filename = $this->fileNameFromUrl($url); -- GitLab