From e6e90c33d8ec825c0da6647116f5d9aa9f0a91eb Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Sat, 5 Oct 2013 12:40:11 +0000 Subject: [PATCH] =?UTF-8?q?Affichage=20mode=20frise:=20prends=20la=20grand?= =?UTF-8?q?e=20image=20de=20la=20notice=20si=20d=C3=A9finie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/Class/Notice.php | 4 +++- library/Class/Notice/DublinCoreVisitor.php | 2 ++ library/Trait/NoticeVisitor.php | 1 + .../MoteurRecherche/Resultat/TimelineJsonVisitor.php | 7 +++++++ .../MoteurRecherche/Resultat/TimelineJsonVisitorTest.php | 6 ++++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/library/Class/Notice.php b/library/Class/Notice.php index cd10d048047..9075b3c3a6c 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -1628,8 +1628,10 @@ class Class_Notice extends Storm_Model_Abstract { $visitor->visitLangues($this->getLangueCodes()); $visitor->visitTypeDoc($this->getTypeDoc()); $visitor->visitNatureDoc($this->getNatureDocs()); - if ($this->hasVignette()) + if ($this->hasVignette()) { $visitor->visitVignette($this->fetchUrlVignette()); + $visitor->visitImage($this->fetchUrlImage()); + } $visitor->visitIsbn($this->getIsbn()); $visitor->visitEan($this->getEan()); $visitor->visitAlbum($this->getAlbum()); diff --git a/library/Class/Notice/DublinCoreVisitor.php b/library/Class/Notice/DublinCoreVisitor.php index b7ea9af0725..24041b0f815 100644 --- a/library/Class/Notice/DublinCoreVisitor.php +++ b/library/Class/Notice/DublinCoreVisitor.php @@ -20,6 +20,8 @@ */ class Class_Notice_DublinCoreVisitor { + use Trait_NoticeVisitor; + protected $_xml; protected $_builder; protected $_identifier; diff --git a/library/Trait/NoticeVisitor.php b/library/Trait/NoticeVisitor.php index cd3e544c96d..cd7e007b5cd 100644 --- a/library/Trait/NoticeVisitor.php +++ b/library/Trait/NoticeVisitor.php @@ -33,6 +33,7 @@ trait Trait_NoticeVisitor { public function visitTypeDoc($type_doc) {} public function visitNatureDoc($nature_docs) {} public function visitVignette($url_vignette) {} + public function visitImage($url_vignette) {} public function visitIsbn($isbn) {} public function visitEan($ean) {} public function visitAlbum($album) {} diff --git a/library/ZendAfi/View/Helper/MoteurRecherche/Resultat/TimelineJsonVisitor.php b/library/ZendAfi/View/Helper/MoteurRecherche/Resultat/TimelineJsonVisitor.php index cb3c5cbdb02..63d2b967e71 100644 --- a/library/ZendAfi/View/Helper/MoteurRecherche/Resultat/TimelineJsonVisitor.php +++ b/library/ZendAfi/View/Helper/MoteurRecherche/Resultat/TimelineJsonVisitor.php @@ -86,5 +86,12 @@ class ZendAfi_View_Helper_MoteurRecherche_Resultat_TimelineJsonVisitor extends Z $this->_current_date['asset']['thumbnail'] = $url_vignette; $this->_current_date['asset']['media'] = $url_vignette; } + + public function visitImage($url_image) { + if (!$url_image) + return; + + $this->_current_date['asset']['media'] = $url_image; + } } ?> \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/MoteurRecherche/Resultat/TimelineJsonVisitorTest.php b/tests/library/ZendAfi/View/Helper/MoteurRecherche/Resultat/TimelineJsonVisitorTest.php index ec977c2bac9..aa15bbefad6 100644 --- a/tests/library/ZendAfi/View/Helper/MoteurRecherche/Resultat/TimelineJsonVisitorTest.php +++ b/tests/library/ZendAfi/View/Helper/MoteurRecherche/Resultat/TimelineJsonVisitorTest.php @@ -120,6 +120,12 @@ class ZendAfi_View_Helper_MoteurRecherche_Resultat_TimelineJsonVisitorTest exten } + /** @test */ + public function firstNoticeMediaShouldBeHpBigDotPng() { + $this->assertEquals('hp_big.png', $this->_json->timeline->date[0]->asset->media); + } + + /** @test */ public function firstNoticeThumbnailShouldBeSupporAutDotPng() { $this->assertContains('supports/aut_s.png', $this->_json->timeline->date[1]->asset->thumbnail); -- GitLab