Skip to content
Snippets Groups Projects
Commit 30589a66 authored by Arthur Suzuki's avatar Arthur Suzuki
Browse files

hotline#95885 : Recherche : fix opening time display for libraries in smartphone view.

parent 016759b7
Branches
Tags
5 merge requests!3297WIP: Master,!3220Master,!3216WIP: Koha pagination le retour,!3212Hotline,!3210hotline#95885 : Recherche : fix opening time display for libraries in smartphone view.
Pipeline #8107 passed with stage
in 34 minutes and 32 seconds
- ticket #95885 : Version Mobile : Affichage des horaires d'ouvertures dans la fiche bibliothèque.
\ No newline at end of file
<?php echo $this->toolbar($this->_("Bib"));?>
<h1><?php echo $this->escape($this->bib->getLibelle());?></h1>
<ul data-role="listview">
<li data-role="list-divider"><?php echo $this->_('Coordonnées')?></li>
<li>
<div style="float:left"><?php echo $this->mapForLieu($this->bib->answersLocation(),
array('size' => '100x100')); ?></div>
<address>
<?php echo nl2br($this->bib->getAdresse());?><br>
<?php echo $this->bib->getCp();?> <?php echo $this->bib->getVille();?>
</address>
<div class="clear"></div>
</li>
<?php if ($this->bib->getTelephone()) { ?>
<li><?php echo $this->bib->getTelephone();?></li>
<?php } ?>
<?php if ($this->bib->getMail()) { ?>
<li><a href="mailto:<?php echo $this->bib->getMail();?>"><?php echo $this->bib->getMail();?></a></li>
<?php } ?>
<?php if ($this->bib->getHoraire()) { ?>
<li data-role="list-divider"><?php echo $this->_('Horaires')?></li>
<li>
<?php echo nl2br(urldecode($this->bib->getHoraire()));?>
</li>
<?php } ?>
</lu>
<?php
echo $this->renderLibrary($this->bib);
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_Telephone_RenderLibrary extends ZendAfi_View_Helper_BaseHelper {
public function renderLibrary($library) {
if (!$library)
return '';
$html = [$this->view->toolbar($this->_("Bib")),
$this->_tag('h1', $this->view->escape($library->getLibelle())),
$this->_libraryInfo($library)
];
return implode($html);
}
protected function _libraryInfo($library) {
$lis = [$this->_tag('li',
$this->_('Coordonnées'),
['data-role' => 'list-divider']),
$this->_tag('li',
$this->view->div(['style' => 'float:left'],
$this->view->mapForLieu($library->answersLocation(),
['size' => '100x100']))
. $this->_tag('address',
nl2br($library->getAdresse())
. BR
. $library->getCp()
. $library->getVille())
. $this->_tag('div', '', ['class' => 'clear'])),
];
if ($phone = $library->getTelephone())
$lis [] = $this->_tag('li', $phone);
if ($mail = $library->getMail())
$lis [] = $this->_tag('li',
$this->view->tagAnchor(sprintf('mailto:%s',
$mail),
$mail));
if ($openings = $this->view->libraryOpenings($library)) {
$lis [] = $this->_tag('li',
$this->_('Horaires'),
['data-role' => 'list-divider']);
$lis [] = $this->_tag('li',
$openings);
}
return $this->_tag('ul',
implode($lis),
['data-role' => 'listview']);
}
}
\ No newline at end of file
......@@ -113,16 +113,25 @@ class Telephone_RechercheControllerSimpleByPertinenceActionTest extends Telephon
class Telephone_RechercheControllerBibliothequeActionTest extends TelephoneAbstractControllerTestCase {
protected $_bib;
public function setUp() {
parent::setUp();
Class_Bib::getLoader()->newInstanceWithId(34)
$this->_bib = Class_Bib::getLoader()
->newInstanceWithId(34)
->setLibelle('La turbine')
->setAdresse('5 av. des Harmonies')
->setCp('74960')
->setVille('Cran-Gevrier')
->setTelephone('04 50 50 50 50')
->setMail('turbine@bib.com')
->setHoraire(urlencode('Tous les jours'));
->setMail('turbine@bib.com');
$this->fixture('Class_Ouverture',
['id' => 1,
'id_site' => 34,
'jour_semaine' => Class_Ouverture::LUNDI,
'label' => 'D\'habitude']);
$this->dispatch('/telephone/recherche/bibliotheque/id/34', true);
}
......@@ -164,8 +173,48 @@ class Telephone_RechercheControllerBibliothequeActionTest extends TelephoneAbstr
/** @test */
public function pageShouldContainHoraires() {
$this->assertXPathContentContains('//li', 'Tous les jours');
public function withOuvertureShouldContainDefaultOpening() {
$this->assertXPathContentContains('//li', 'D\'habitude');
}
}
class Telephone_RechercheControllerBibliothequeOpeningsTest extends TelephoneAbstractControllerTestCase {
protected $_bib;
public function setUp() {
parent::setUp();
$this->_bib = Class_Bib::getLoader()
->newInstanceWithId(34)
->setLibelle('La turbine')
->setAdresse('5 av. des Harmonies')
->setCp('74960')
->setVille('Cran-Gevrier')
->setTelephone('04 50 50 50 50')
->setMail('turbine@bib.com')
->setHoraire('Exceptionnel');
$this->fixture('Class_Ouverture',
['id' => 1,
'id_site' => 34,
'jour_semaine' => Class_Ouverture::LUNDI,
'label' => 'D\'habitude']);
$this->dispatch('/telephone/recherche/bibliotheque/id/34', true);
}
/** @test */
public function shouldContainHoraireExceptionnel() {
$this->assertXPathContentContains('//li', 'Exceptionnel');
}
/** @test */
public function shouldNotContainOpenings() {
$this->assertNotXPathContentContains('//li', 'D\'habitude');
}
}
......
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