From 8b96384f81fc7b858b93289d3473cd37a42cbbaa Mon Sep 17 00:00:00 2001 From: Ghislain Loas <ghislo@sandbox.pergame.net> Date: Wed, 5 Nov 2014 10:30:20 +0100 Subject: [PATCH] dev #16652 use dedicated Zend View Helpers for formElements + fix css --- .../opac/controllers/BibController.php | 1 + .../opac/views/scripts/bib/selection.phtml | 15 +++------- library/ZendAfi/View/Helper/TagInput.php | 29 ------------------- .../View/Helper/TagRechercheSimple.php | 4 +-- public/opac/css/global.css | 19 ++++++++++++ 5 files changed, 25 insertions(+), 43 deletions(-) delete mode 100644 library/ZendAfi/View/Helper/TagInput.php diff --git a/application/modules/opac/controllers/BibController.php b/application/modules/opac/controllers/BibController.php index 7123dc1e0b9..6dd31c5fce5 100644 --- a/application/modules/opac/controllers/BibController.php +++ b/application/modules/opac/controllers/BibController.php @@ -88,6 +88,7 @@ class BibController extends ZendAfi_Controller_Action { function selectionAction() { + xdebug_break(); $this->view->titre = $this->view->_('Sélection de bibliothèques pour la recherche'); $this->view->zones = Class_Zone::findAll(); $this->view->id_bibs_session = []; diff --git a/application/modules/opac/views/scripts/bib/selection.phtml b/application/modules/opac/views/scripts/bib/selection.phtml index d48c613ed85..a4369d215c5 100644 --- a/application/modules/opac/views/scripts/bib/selection.phtml +++ b/application/modules/opac/views/scripts/bib/selection.phtml @@ -2,15 +2,13 @@ $this->openBoite($this->titre); echo $this->tag('p', $this->_('Vous pouvez sélectionner une ou plusieurs bibliothèques pour effectuer une recherche ')); - +echo ('<form name="selection" method="post">'); +echo $this->formSubmit('Valider', $this->_('Valider la sélection')); echo $this->tagAnchor('javascript:selectall()', $this->_('Tout cocher')); echo $this->tagAnchor('javascript:deselectall()', $this->_('Tout décocher')); -?> -<form name="selection" method="post"> -<?php echo ('<ul>'); foreach($this->zones as $zone ) { @@ -21,17 +19,12 @@ foreach($this->zones as $zone ) foreach($bibs as $bib) { $coche = in_array($bib->getId(), $this->id_bibs_session) ? ['checked' => 'checked'] : []; echo $this->tag('li', - $this->tag('span', $bib->getLibelle()). - $this->tagInput(['type' => 'checkbox', - 'name' => 'bib_select[]', - 'value' => $bib->getIdSite()] + $coche)); + $this->formCheckbox('bib_select[]', $bib->getIdSite(), $coche + ['id' => 'bib_select_' . $bib->getId()]). + $this->tag('span', $bib->getLibelle())); } echo('</ul></li>'); } echo ('</ul>'); -echo $this->tagInput(['type' => 'submit', - 'value' => $this->_('Valider la sélection'), - 'name' => 'Valider']); echo ('</form>'); $this->closeBoite(); ?> diff --git a/library/ZendAfi/View/Helper/TagInput.php b/library/ZendAfi/View/Helper/TagInput.php deleted file mode 100644 index 91d0af629dd..00000000000 --- a/library/ZendAfi/View/Helper/TagInput.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/** - * Copyright (c) 2012-2014, 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 - */ - - -class ZendAfi_View_Helper_TagInput extends Zend_View_Helper_HtmlElement { - public function tagInput($attribs) { - $html = '<input ' . $this->_htmlAttribs($attribs); - return $html . '>'; - } -} -?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/TagRechercheSimple.php b/library/ZendAfi/View/Helper/TagRechercheSimple.php index 0d0ad5e02b4..9866315b278 100644 --- a/library/ZendAfi/View/Helper/TagRechercheSimple.php +++ b/library/ZendAfi/View/Helper/TagRechercheSimple.php @@ -61,9 +61,7 @@ class ZendAfi_View_Helper_TagRechercheSimple extends Zend_View_Helper_HtmlElemen $bib_ids = array_key_exists('id_bibs', $_SESSION['selection_bib']) ? $_SESSION['selection_bib']['id_bibs'] : '' ; - $input = $this->view->tagInput(['type' => 'hidden', - 'name' => 'bib_select', - 'value' => implode(',',$bib_ids)]); + $input = $this->view->formHidden('bib_select', implode(',',$bib_ids)); $anchor = $this->view->tagAnchor($this->view->url(['module' => 'opac', 'controller' => 'bib', diff --git a/public/opac/css/global.css b/public/opac/css/global.css index f3a94627f21..b7adf7d198d 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -2883,4 +2883,23 @@ a.loan-export { .boite.rech_simple .selected_bibs_info span { display: block; +} + + +.bib_selection #colContenuInner ul, +.bib_selection #colContenuInner li { + margin: 0; + padding: 0; +} + + +.bib_selection #colContenuInner form > ul > li { + margin: 10px 0; +} + + +.bib_selection #colContenuInner input + a, +.bib_selection #colContenuInner input + a + a, +.bib_selection #colContenuInner input + span { + margin-left: 5px; } \ No newline at end of file -- GitLab