diff --git a/application/modules/opac/controllers/JavaController.php b/application/modules/opac/controllers/JavaController.php index 9429a20642d99ef910162821a2153b2a76e48927..afcb5cee0ba277780070ea571840fd37d5ed65fe 100644 --- a/application/modules/opac/controllers/JavaController.php +++ b/application/modules/opac/controllers/JavaController.php @@ -70,4 +70,17 @@ class JavaController extends Zend_Controller_Action { $this->getHelper('ViewRenderer')->setNoRender(); echo $this->view->_('Kiosque de notices'); } + + + + public function pageAction() { + $page = $this->_getParam('no'); + $id_module = $this->_getParam('id_module'); + $helper = ZendAfi_View_Helper_Accueil_Base::getModuleHelper($id_module); + + $html = $helper->getKiosqueHtml($page); + + $this->getHelper('ViewRenderer')->setNoRender(); + $this->_response->setBody($html); + } } \ No newline at end of file diff --git a/library/Class/ListeNotices.php b/library/Class/ListeNotices.php index 9e02793da8a2a621258c3c946c483758b425a468..7fd873925d0da93433deb7539b7f146f1b64ae74 100644 --- a/library/Class/ListeNotices.php +++ b/library/Class/ListeNotices.php @@ -54,8 +54,8 @@ class Class_ListeNotices { $req.=$limit; } else { - $debut_limit=($page-1) * $this->nb_par_page; - $fin_limit=$this->nb_par_page; + $debut_limit = ($page-1) * $this->nb_par_page; + $fin_limit = $this->nb_par_page; } // Execute la requete diff --git a/library/ZendAfi/View/Helper/Accueil/Kiosque.php b/library/ZendAfi/View/Helper/Accueil/Kiosque.php index c6428c0c794cff8e306ba35f49c5135e367c6820..d7f584415fa232bdaaa5f878c37320b32f293a38 100644 --- a/library/ZendAfi/View/Helper/Accueil/Kiosque.php +++ b/library/ZendAfi/View/Helper/Accueil/Kiosque.php @@ -146,12 +146,20 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba } - public function getKiosqueHtml() { + public function getKiosqueHtml($page = 1) { $catalogue=new Class_Catalogue(); + + $nombre_notices_par_page = $this->preferences['nb_notices']; + $this->preferences['nb_notices'] = 0; + $this->preferences['nb_analyse'] = 0; $requetes = $catalogue->getRequetes($this->preferences); - $notices = (new Class_ListeNotices($this->preferences['nb_notices']))->getListe($requetes['req_liste']); - switch($this->preferences["style_liste"]) { + + $nombre_total_notices = fetchOne($requetes['req_comptage']); + + $notices = (new Class_ListeNotices($nombre_notices_par_page))->getListe($requetes['req_liste'], $page); + + switch($style_liste = $this->preferences["style_liste"]) { case 'vignettes': $html = $this->view->getHelper('ListeNotices')->listeVignette($notices, 'TAE'); break; @@ -160,6 +168,19 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba break; } - return $html; + return $this->getPagerHtml($page, $nombre_notices_par_page, $nombre_total_notices).$html; + } + + + public function getPagerHtml($page, $nombre_notices_par_page, $nombre_total_notices) { + $next_page = ($page * $nombre_notices_par_page < $nombre_total_notices) ? $page + 1 : 1; + $previous_page = ($page > 1) ? $page - 1 : (int)(($nombre_total_notices + $nombre_notices_par_page)/ max($nombre_notices_par_page, 1)); + + + $onclick = 'var contenu = $(this).parents(\'.contenu\');contenu.fadeOut();contenu.load($(this).attr(\'href\'), function(){contenu.fadeIn(); initializeNoticeMurAnimation()}); return false'; + return '<div class="controls">' + .'<a href="'.$this->view->url(['controller' => 'java', 'action' => 'page', 'no' => $previous_page, 'id_module' => $this->id_module]).'" onclick="'.$onclick.'"></a>' + .'<a href="'.$this->view->url(['controller' => 'java', 'action' => 'page', 'no' => $next_page, 'id_module' => $this->id_module]).'" onclick="'.$onclick.'"></a>' + .'</div>'; } } \ No newline at end of file diff --git a/public/opac/css/global.css b/public/opac/css/global.css index 20f7c1f4e35707adfaf78cddb432f45d883462c6..ef8c8be26a0816ed3c9c630e0fee8f365bf79043 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -641,8 +641,11 @@ div.rss { } -.kiosque .liste_mur { +.kiosque .liste_mur, +.kiosque .liste_vignette { float: none; + margin: 0px auto; + padding: 0px 20px; } @@ -653,14 +656,20 @@ div.rss { .kiosque .titre .rss { position: absolute; - top: 10px; + top: 4px; } -.kiosque .titre { +.kiosque .titre, +.kiosque .contenu { position: relative; } +.boite.kiosque .controls { + top: 30%; + position: absolute; +} + /** bib numerique */ .slideshow .medias { @@ -900,7 +909,8 @@ div.ui-sortable-placeholder { -.slideshow .controls { +.slideshow .controls, +.kiosque .controls { width: 100%; height: 0px; overflow: visible; @@ -908,12 +918,14 @@ div.ui-sortable-placeholder { opacity: 0.3; } -.slideshow:hover .controls { +.slideshow:hover .controls, +.kiosque:hover .controls { opacity: 1; } -.slideshow .controls a { +.slideshow .controls a, +.kiosque .controls a { display: block; width: 20px; height: 80px; @@ -921,21 +933,25 @@ div.ui-sortable-placeholder { position: absolute; } -.slideshow .controls a:first-child { +.slideshow .controls a:first-child, +.kiosque .controls a:first-child { background: transparent url(../java/slide_show/arrow_left.gif) center center no-repeat; } -.slideshow .controls a:first-child:hover { +.slideshow .controls a:first-child:hover, +.kiosque .controls a:first-child:hover { background-image: url(../java/slide_show/arrow_left_over.gif); } -.slideshow .controls a:last-child { +.slideshow .controls a:last-child, +.kiosque .controls a:last-child { right: 0px; background: transparent url(../java/slide_show/arrow_right.gif) center center no-repeat; } -.slideshow .controls a:last-child:hover { +.slideshow .controls a:last-child:hover, +.kiosque .controls a:last-child:hover { background-image: url(../java/slide_show/arrow_right_over.gif); } @@ -1157,7 +1173,7 @@ body.abonne_multimedia-hold-view .actions a { float: left; height: 150px; width: 100px; - margin: 10px 10px 0px 0px; + margin: 10px auto 0px auto; border: 5px solid transparent; } diff --git a/tests/application/modules/opac/controllers/JavaControllerTest.php b/tests/application/modules/opac/controllers/JavaControllerTest.php index 33a3138f294d9c1924d3c88d89f879f2f0922eca..3486b4c395918d195fd4ec4948a827d362dd6eb8 100644 --- a/tests/application/modules/opac/controllers/JavaControllerTest.php +++ b/tests/application/modules/opac/controllers/JavaControllerTest.php @@ -20,7 +20,7 @@ */ require_once 'AbstractControllerTestCase.php'; -class JavaControllerTestCase extends AbstractControllerTestCase { +class JavaControllerWidthDefaultKiosqueTest extends AbstractControllerTestCase { public function setUp() { parent::setUp(); $cfg_accueil = ['modules' => ['1' => ['division' => 1, @@ -55,4 +55,33 @@ class JavaControllerTestCase extends AbstractControllerTestCase { } + +class JavaControllerWithKiosqueMurPageTest extends AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + $cfg_accueil = ['modules' => ['1' => ['division' => 1, + 'type_module' => 'KIOSQUE', + 'preferences' => ['style_liste' => 'mur', + 'nb_notices' => 10, + 'nb_analyse' => 50]]]]; + + Class_Profil::getCurrentProfil()->setCfgAccueil($cfg_accueil); + + $this->dispatch('java/page/no/2/id_module/1', true); + } + + + /** @test */ + public function firstControlShouldLinkToPageOne() { + $this->assertXPath('//div[@class="controls"]/a[1][contains(@href, "java/page/no/1/id_module/1")]'); + } + + + /** @test */ + public function lastControlShouldLinkToPageThree() { + $this->assertXPath('//div[@class="controls"]/a[2][contains(@href, "java/page/no/3/id_module/1")]'); + } +} + + ?> \ No newline at end of file