diff --git a/VERSIONS_WIP/30273 b/VERSIONS_WIP/30273 new file mode 100644 index 0000000000000000000000000000000000000000..d7b09994f0c4375be6ce0294bb5fad23a805c84a --- /dev/null +++ b/VERSIONS_WIP/30273 @@ -0,0 +1 @@ + - ticket #30273 : création de la boîte "bibliothèque" qui affiche les horaires d'ouverture \ No newline at end of file diff --git a/application/modules/admin/controllers/OuverturesController.php b/application/modules/admin/controllers/OuverturesController.php index 58964ba06789e0807e1be39298e7f16f357300bd..1de8c25eae226a7d9c335ddb7a053173d9cbf528 100644 --- a/application/modules/admin/controllers/OuverturesController.php +++ b/application/modules/admin/controllers/OuverturesController.php @@ -81,7 +81,7 @@ class Admin_OuverturesController extends ZendAfi_Controller_Action { } parent::indexAction(); - $this->formatTitreWithLibelleBib('%s: plages ouvertes à la réservation des postes multimédia'); + $this->formatTitreWithLibelleBib('%s: plages d\'ouverture'); } diff --git a/application/modules/admin/views/scripts/ouvertures/index.phtml b/application/modules/admin/views/scripts/ouvertures/index.phtml index 3d7c4d91edff7b83b2118d270b75766d471ebf2a..a6611f396a124171c16b37492c1cee86dc70fc9c 100644 --- a/application/modules/admin/views/scripts/ouvertures/index.phtml +++ b/application/modules/admin/views/scripts/ouvertures/index.phtml @@ -7,21 +7,28 @@ 'site_id' => 1)) ); - echo $this->tagModelTable($this->ouvertures, + echo $this->bouton('id=back', + 'picto=back.gif', + 'texte=' . $this->traduire('Retour à la liste des bibliothèques'), + 'url=' . $this->url(['controller' => 'bib', + 'action' => 'index']) + ); + + echo $this->tagModelTable($this->ouvertures, - [$this->_('Jour'), - $this->_('Matin'), - '', - $this->_('Après-midi'), + [$this->_('Jour'), + $this->_('Matin'), + '', + $this->_('Après-midi'), ''], - ['formatted_jour', - 'debut_matin', - 'fin_matin', - 'debut_apres_midi', + ['formatted_jour', + 'debut_matin', + 'fin_matin', + 'debut_apres_midi', 'fin_apres_midi'], [ ['action' => 'edit', 'content' => $this->boutonIco('type=edit')], ['action' => 'delete', 'content' => $this->boutonIco('type=del')] ], 'ouvertures'); -?> \ No newline at end of file +?> diff --git a/library/ZendAfi/View/Helper/Accueil/Library.php b/library/ZendAfi/View/Helper/Accueil/Library.php index 21daa702030577d80283c50f93a70f76349dab28..dee04acbc701b9dc511d04adba20a602f9d14ad0 100644 --- a/library/ZendAfi/View/Helper/Accueil/Library.php +++ b/library/ZendAfi/View/Helper/Accueil/Library.php @@ -61,7 +61,7 @@ class ZendAfi_View_Helper_Accueil_Library extends ZendAfi_View_Helper_Accueil_Ba if (!$ouverture = $this->getLibraryOuverture($library)) { return $this->renderClosed( - $this->_('La bibliothèque est fermée.') + $this->_('Fermé.') . $this->renderNextOuvertureForLibrary($library)); } @@ -74,7 +74,7 @@ class ZendAfi_View_Helper_Accueil_Library extends ZendAfi_View_Helper_Accueil_Ba : $ouverture->getDebutMatin(); if ($next_open_hour > $hour) - return $this->renderClosed($this->_('La bibliothèque ouvrira à %s', $next_open_hour)); + return $this->renderClosed($this->_('Ouvrira à %s', $next_open_hour)); $next_close_hour = ($ouverture->isJourneeContinue() || $hour >= $ouverture->getDebutApresMidi()) @@ -83,12 +83,12 @@ class ZendAfi_View_Helper_Accueil_Library extends ZendAfi_View_Helper_Accueil_Ba if ($next_close_hour > $hour) - return $this->renderOpened($this->_('La bibliothèque est ouverte jusqu\'à %s', $next_close_hour)); + return $this->renderOpened($this->_('Ouvert jusqu\'à %s', $next_close_hour)); return $this->renderClosed( - $this->_('La bibliothèque est fermée depuis %s.', $next_close_hour) + $this->_('Fermé depuis %s.', $next_close_hour) . $this->renderNextOuvertureForLibrary($library)); } diff --git a/library/ZendAfi/View/Helper/Admin/HelpLink.php b/library/ZendAfi/View/Helper/Admin/HelpLink.php index 2e7bb3fc863a80d0a2c4d1b8204479d25bf543cc..b52218761b398ca1bb4c5c3bad595962fc55e831 100644 --- a/library/ZendAfi/View/Helper/Admin/HelpLink.php +++ b/library/ZendAfi/View/Helper/Admin/HelpLink.php @@ -120,7 +120,9 @@ class ZendAfi_View_Helper_Admin_HelpLinkBokehWiki 'news' => 'Boite_Article', 'kiosque' => 'Paramétrer_un_kiosque_de_notices', 'sitotheque' => 'Boite_Sitothèque', - 'calendrier' => 'Paramétrer_le_module_Calendrier'], + 'calendrier' => 'Paramétrer_le_module_Calendrier', + 'library' => 'Afficher_les_horaires_d\'ouverture'], + 'ouvertures' => ['index' => 'Afficher_les_horaires_d\'ouverture#D.C3.A9clarer_les_plages_d.27ouverture'], 'album' => ['index' => 'Collections'], 'catalogue' => ['index' => 'Domaines'], 'cms' => ['index' => 'Articles_-_Créer,_rédiger_et_ordonner'], diff --git a/tests/application/modules/admin/controllers/OuverturesControllerTest.php b/tests/application/modules/admin/controllers/OuverturesControllerTest.php index cd50e119a05487fe35ce8a13243c21fed53eec90..22f8bc29df518e870b53af0720fff9f9b5d26d22 100644 --- a/tests/application/modules/admin/controllers/OuverturesControllerTest.php +++ b/tests/application/modules/admin/controllers/OuverturesControllerTest.php @@ -103,9 +103,15 @@ class OuverturesControllerIndexActionSiteCranTest extends OuverturesControllerTe } + /** @test */ + function pageShouldContainsBackButtonToLibraryList() { + $this->assertXPathContentContains('//div[contains(@onclick, "admin/bib/index")]//td', 'Retour à la liste des bibliothèques'); + } + + /** @test */ public function titleShouldBePlagesDouvertureDeLaBibliothequeCranGevrier() { - $this->assertXPathContentContains('//h1', 'Cran-Gévrier: plages ouvertes à la réservation des postes multimédia'); + $this->assertXPathContentContains('//h1', 'Cran-Gévrier: plages d\'ouverture'); } } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/Library.php b/tests/library/ZendAfi/View/Helper/Accueil/Library.php index 5afdc6ae1e7a226fd760a12ba7c61eb4753d33a5..ddbeeaf0ca966b4b69d845323ee5fe1cb3fe999e 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/Library.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/Library.php @@ -88,7 +88,7 @@ class ZendAfi_View_Helper_Accueil_LibraryOnMondayMorningTest extends ZendAfi_Vie public function annecyShouldContainsLibraryOpenedUntil12() { $this->assertXPathContentContains($this->html, '//section[1]/p[@class="opened"]', - utf8_encode('La bibliothèque est ouverte jusqu\'à 12:00')); + utf8_encode('Ouvert jusqu\'à 12:00')); } @@ -96,7 +96,7 @@ class ZendAfi_View_Helper_Accueil_LibraryOnMondayMorningTest extends ZendAfi_Vie public function cranSectionShouldContainsLibraryIsClosed() { $this->assertXPathContentContains($this->html, '//section[2]/p[@class="closed"]', - utf8_encode('La bibliothèque est fermée. Réouverture Mardi à 10:00')); + utf8_encode('Fermé. Réouverture Mardi à 10:00')); } @@ -112,7 +112,7 @@ class ZendAfi_View_Helper_Accueil_LibraryOnMondayMorningTest extends ZendAfi_Vie public function meythetShouldContainsLibraryOpenedUntil18() { $this->assertXPathContentContains($this->html, '//section[3]', - utf8_encode('La bibliothèque est ouverte jusqu\'à 18:00')); + utf8_encode('Ouvert jusqu\'à 18:00')); } } @@ -132,7 +132,7 @@ class ZendAfi_View_Helper_Accueil_LibraryOnMondayAfternoonTest extends ZendAfi_V public function annecyShouldContainsLibraryOpenedUntil18() { $this->assertXPathContentContains($this->html, '//section[1]', - utf8_encode('La bibliothèque est ouverte jusqu\'à 18:00')); + utf8_encode('Ouvert jusqu\'à 18:00')); } @@ -141,7 +141,35 @@ class ZendAfi_View_Helper_Accueil_LibraryOnMondayAfternoonTest extends ZendAfi_V public function meythetShouldContainsLibraryOpenedUntil18() { $this->assertXPathContentContains($this->html, '//section[3]', - utf8_encode('La bibliothèque est ouverte jusqu\'à 18:00')); + utf8_encode('Ouvert jusqu\'à 18:00')); + } +} + + + + +class ZendAfi_View_Helper_Accueil_LibraryOnMondayNoonTest extends ZendAfi_View_Helper_Accueil_LibraryTestCase { + public function setUp() { + parent::setUp(); + ZendAfi_View_Helper_Accueil_Library::setTimeSource(new TimeSourceForTest('2015-10-05 13:00:00')); + $this->html = $this->_helper->getBoite(); + } + + + /** @test */ + public function annecyShouldContainsLibraryWillOpenAt14() { + $this->assertXPathContentContains($this->html, + '//section[1]', + utf8_encode('Ouvrira à 14:00')); + } + + + + /** @test */ + public function meythetShouldContainsLibraryOpenedUntil18() { + $this->assertXPathContentContains($this->html, + '//section[3]', + utf8_encode('Ouvert jusqu\'à 18:00')); } } @@ -161,14 +189,14 @@ class ZendAfi_View_Helper_Accueil_LibraryOnMondayEveningTest extends ZendAfi_Vie public function annecyShouldContainsLibraryIsClosedSince18() { $this->assertXPathContentContains($this->html, '//section[1]', - utf8_encode('La bibliothèque est fermée depuis 18:00')); + utf8_encode('Fermé depuis 18:00')); } /** @test */ public function meythetShouldContainsLibraryWillOpenOnTuesday12() { $this->assertXPathContentContains($this->html, '//section[3]', - utf8_encode('La bibliothèque est fermée depuis 18:00. Réouverture Mardi à 12:00')); + utf8_encode('Fermé depuis 18:00. Réouverture Mardi à 12:00')); } } @@ -188,7 +216,7 @@ class ZendAfi_View_Helper_Accueil_LibraryOnTuesdayAfternoonTest extends ZendAfi_ public function cranShouldContainsLibraryIsClosedSince12() { $this->assertXPathContentContains($this->html, '//section[2]', - utf8_encode('La bibliothèque est fermée depuis 12:00')); + utf8_encode('Fermé depuis 12:00')); } @@ -196,7 +224,7 @@ class ZendAfi_View_Helper_Accueil_LibraryOnTuesdayAfternoonTest extends ZendAfi_ public function meythetShouldContainsLibraryIsClosedSince14() { $this->assertXPathContentContains($this->html, '//section[3]', - utf8_encode('La bibliothèque est fermée depuis 14:00')); + utf8_encode('Fermé depuis 14:00')); } } @@ -216,7 +244,7 @@ class ZendAfi_View_Helper_Accueil_LibraryOnTuesdayMorningTest extends ZendAfi_Vi public function cranShouldContainsLibraryOpenedAt10() { $this->assertXPathContentContains($this->html, '//section[2]', - utf8_encode('La bibliothèque ouvrira à 10:00')); + utf8_encode('Ouvrira à 10:00')); } @@ -224,7 +252,7 @@ class ZendAfi_View_Helper_Accueil_LibraryOnTuesdayMorningTest extends ZendAfi_Vi public function meythetShouldContainsLibraryOpenedAt12() { $this->assertXPathContentContains($this->html, '//section[3]', - utf8_encode('La bibliothèque ouvrira à 12:00')); + utf8_encode('Ouvrira à 12:00')); } } ?> \ No newline at end of file