Skip to content
Snippets Groups Projects
Commit 06f071d6 authored by llaffont's avatar llaffont
Browse files

Visu player gallica dans les notices

parent 30f24886
Branches
Tags
No related merge requests found
......@@ -329,6 +329,11 @@ class Class_Album extends Storm_Model_Abstract {
}
public function isOAI() {
return $this->getTypeDocId() == Class_TypeDoc::OAI;
}
/**
* @param Zend_Controller_Request_Http $request
* @return array
......@@ -968,7 +973,14 @@ class Class_Album extends Storm_Model_Abstract {
public function isGallica() {
return false !== strpos($this->getIdOrigine(), 'gallica');
return ($this->isOAI() && (false !== strpos($this->getIdOrigine(), 'gallica')));
}
public function getGallicaArkId() {
if (!$this->isGallica())
return '';
return array_last(explode('/', $this->getIdOrigine()));
}
}
......
......@@ -20,7 +20,12 @@
*/
class ZendAfi_View_Helper_GallicaPlayer extends Zend_View_Helper_HtmlElement {
public function gallicaPlayer($id_ark) {
public function gallicaPlayer($album_or_id_ark) {
if (is_int($album_or_id_ark))
$id_ark = $album_or_id_ark;
else
$id_ark = $album_or_id_ark->getGallicaArkId();
return sprintf(
'<object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
......
......@@ -29,6 +29,8 @@ class ZendAfi_View_Helper_RenderAlbum extends Zend_View_Helper_HtmlElement {
Class_ScriptLoader::getInstance()->loadBooklet($album->getId(), '#resnum');
else if ($album->isDiaporama())
$content = $this->view->tagSlideshow($album);
else if ($album->isGallica())
$content = $this->view->gallicaPlayer($album);
else
$content = $this->view->tagAlbumMediaList($album);
......
......@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_RenderAlbumEPUBTest extends ViewHelperTestCase {
abstract class ZendAfi_View_Helper_RenderAlbumTestCase extends ViewHelperTestCase {
/** @var ZendAfi_View_Helper_RenderForm */
protected $_helper;
......@@ -32,6 +32,14 @@ class ZendAfi_View_Helper_RenderAlbumEPUBTest extends ViewHelperTestCase {
$view = new ZendAfi_Controller_Action_Helper_View();
$this->_helper = new ZendAfi_View_Helper_RenderAlbum();
$this->_helper->setView($view);
}
}
class ZendAfi_View_Helper_RenderAlbumEPUBTest extends ZendAfi_View_Helper_RenderAlbumTestCase {
public function setUp() {
parent::setUp();
$this->_album_epub = Class_Album::getLoader()
->newInstanceWithId(999)
......@@ -58,4 +66,33 @@ class ZendAfi_View_Helper_RenderAlbumEPUBTest extends ViewHelperTestCase {
'//a[contains(@href, "bib-numerique/download-resource/id/123")]',
'versailles.epub');
}
}
\ No newline at end of file
}
class ZendAfi_View_Helper_RenderAlbumGallicaTest extends ZendAfi_View_Helper_RenderAlbumTestCase {
public function setUp() {
parent::setUp();
$this->_album_gallica = Class_Album::getLoader()
->newInstanceWithId(999)
->setLibelle('Fleurs de nice')
->beOAI()
->setIdOrigine('http://gallica.bnf.fr/ark:/1234');
$this->html = $this->_helper->renderAlbum($this->_album_gallica);
}
/** @test */
public function pageShouldContainsGallicaPlayer() {
$this->assertXPath($this->html,
'//object//param[@name="FlashVars"][contains(@value, "1234")]',
$this->html);
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment