Commit 909b107e authored by llaffont's avatar llaffont
Browse files

Amélioration affichage de l'abonnement sur la fiche abonné

parent a002f0e4
......@@ -3858,6 +3858,7 @@ tests/library/ZendAfi/Form/Element/ImageDeleteTest.php -text
tests/library/ZendAfi/Form/Element/ImageTest.php -text
tests/library/ZendAfi/TranslateTest.php -text
tests/library/ZendAfi/Validate/IsbnTest.php -text
tests/library/ZendAfi/View/Helper/Abonne/AbonnementTest.php -text
tests/library/ZendAfi/View/Helper/Accueil/BibNumeriqueTest.php -text
tests/library/ZendAfi/View/Helper/Accueil/CacheTest.php -text
tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php -text
......
......@@ -20,14 +20,17 @@
*/
class ZendAfi_View_Helper_Abonne_Abonnement extends ZendAfi_View_Helper_Abonne_Abstract {
public function abonne_abonnement($user) {
if (!$user->isAbonne())
$date_fin=formatDate($user->getDateFin(),"1");
if (!$user->isAbonne() || !$date_fin)
return '';
$date_fin=formatDate($user->getDateFin(),"1");
if ($user->isAbonnementValid())
return $this->tagFicheAbonne($this->view->_("Votre abonnement est valide jusqu'au %s.", $date_fin));
return $this->tagFicheAbonne($this->view->_("Votre abonnement est terminé depuis le %s.", $date_fin));
$html = $user->isAbonnementValid()
? $this->tagFicheAbonne($this->view->_("Votre abonnement est valide jusqu'au %s.", $date_fin))
: $this->tagFicheAbonne($this->view->_("Votre abonnement est terminé depuis le %s.", $date_fin));
return '<div class="abonnement">'.$html.'</div>';
}
}
......
......@@ -66,6 +66,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
public function renderSlideShowScripts() {
return $this;
if (!$this->_album)
return $this;
......@@ -169,11 +170,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
null,
true);
$content = $this->view->tagImg($url_media,
array('style' => sprintf('width: %spx',
$this->_preferences['op_largeur_img']),
'title' => htmlspecialchars($media->getTitre()),
'alt' => htmlspecialchars($media->getDescription())));
$content = $this->_mediaTag($url_media, $media);
$datas = array('titre' => $media->getTitre(),
'content' => $content,
......@@ -184,11 +181,11 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
$media->getLinkTo(),
$data);
} else {
$datas['content'] = sprintf('<a href="%s" rel="prettyphoto[%s]" title="%s">%s</a>',
$datas['content'] = sprintf('<a href="%s" rel="prettyPhoto[%s]" title="%s">%s</a>',
$this->view->url(array('module' => 'opac',
'controller' => 'bib-numerique',
'action' => 'get-resource',
'id' => $media->getId())),
'id' => $media->getId())).'.'.$media->getFileExtension(),
htmlentities($media->getAlbum()->getTitre()),
$media->getTitre(),
$content);
......@@ -207,12 +204,24 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
}
protected function _mediaTag($url_media, $media) {
if ($media->isImage())
return $this->view->tagImg($url_media,
['style' => sprintf('width: %spx',
$this->_preferences['op_largeur_img']),
'title' => htmlspecialchars($media->getTitre()),
'alt' => htmlspecialchars($media->getDescription())]);
return '';
}
public function _getMedias($album) {
if (null === $album)
return array();
$medias = $album->getImages();
$medias = $album->getRessources();
if (array_key_exists('order', $this->_preferences)
&& Class_Systeme_ModulesAccueil_BibliothequeNumerique::ORDER_RANDOM == $this->_preferences['order']) {
......
......@@ -1078,6 +1078,12 @@ body.abonne_multimedia-hold-view .actions a {
}
.abonne_fiche .abonnement .abonneFiche {
text-align: center;
width: 100%;
margin-bottom: 10px;
}
#header .share {
position: absolute;
......@@ -1086,4 +1092,5 @@ body.abonne_multimedia-hold-view .actions a {
top: 0px;
cursor: pointer;
z-index: 101;
}
\ No newline at end of file
}
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* AFI-OPAC 2.0 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).
*
* AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php';
class View_Helper_Abonne_AbonnementTest extends ViewHelperTestCase {
/**
* @var ZendAfi_View_Helper_Abonne_Abonnement
*/
private $_helper;
public function setUp() {
parent::setUp();
$this->_helper = new ZendAfi_View_Helper_Abonne_Abonnement();
$this->_helper->setView(new ZendAfi_Controller_Action_Helper_View());
}
/** @test */
public function userWithNoDateFinAbonnementShouldReturnEmpty() {
$this->assertEmpty($this->_helper->abonne_abonnement(Class_Users::newInstanceWithId(3)
->beAbonneSIGB()));
}
/** @test */
public function userDateFinAbonnementShouldReturnAbonnementValid() {
$this->assertXPathContentContains($this->_helper->abonne_abonnement(Class_Users::newInstanceWithId(3)
->beAbonneSIGB()
->setDateFin('2019-08-19')),
'//div[@class="abonnement"]',
'Votre abonnement est valide');
}
}
?>
\ No newline at end of file
Markdown is supported
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