Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
CRAP | |
30.77% |
4 / 13 |
| TRadio | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
13.30 | |
30.77% |
4 / 13 |
| __construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
4 / 4 |
|||
| show | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 9 |
|||
| 1 | <?php |
| 2 | /* |
| 3 | * Formdin Framework |
| 4 | * Copyright (C) 2012 Ministério do Planejamento |
| 5 | * Criado por Luís Eugênio Barbosa |
| 6 | * Essa versão é um Fork https://github.com/bjverde/formDin |
| 7 | * |
| 8 | * ---------------------------------------------------------------------------- |
| 9 | * This file is part of Formdin Framework. |
| 10 | * |
| 11 | * Formdin Framework is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU Lesser General Public License version 3 |
| 13 | * as published by the Free Software Foundation. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Lesser General Public License version 3 |
| 21 | * along with this program; if not, see <http://www.gnu.org/licenses/> |
| 22 | * or write to the Free Software Foundation, Inc., 51 Franklin Street, |
| 23 | * Fifth Floor, Boston, MA 02110-1301, USA. |
| 24 | * ---------------------------------------------------------------------------- |
| 25 | * Este arquivo é parte do Framework Formdin. |
| 26 | * |
| 27 | * O Framework Formdin é um software livre; você pode redistribuí-lo e/ou |
| 28 | * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação |
| 29 | * do Software Livre (FSF). |
| 30 | * |
| 31 | * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA |
| 32 | * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou |
| 33 | * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português |
| 34 | * para maiores detalhes. |
| 35 | * |
| 36 | * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título |
| 37 | * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> |
| 38 | * ou escreva para a Fundação do Software Livre (FSF) Inc., |
| 39 | * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. |
| 40 | */ |
| 41 | class TRadio extends TOption |
| 42 | { |
| 43 | /** |
| 44 | * Classe para criação de campos do tipo RadioButtons, onde apenas uma opção poderá ser selecionada |
| 45 | * |
| 46 | * @param string $strName |
| 47 | * @param array $arrOptions - 2: array no formato "key=>value" ou nome do pacote oracle e da função a ser executada |
| 48 | * @param array $arrValues - 3: array no formato "key=>key" para identificar a(s) opção(ões) selecionada(s) |
| 49 | * @param boolean $boolRequired - 4: TRUE = Required, FALSE = not Required |
| 50 | * @param integer $intQtdColumns - 5: Quantidade de colunas, valor DEFAULT = 1; |
| 51 | * @param integer $intWidth |
| 52 | * @param integer $intHeight |
| 53 | * @param integer $intPaddingItems |
| 54 | * @example RadioButtons.php |
| 55 | * @return TRadio |
| 56 | */ |
| 57 | public function __construct($strName |
| 58 | ,$arrOptions |
| 59 | ,$arrValues=null |
| 60 | ,$boolRequired=null |
| 61 | ,$intQtdColumns=null |
| 62 | ,$intWidth=null |
| 63 | ,$intHeight=null |
| 64 | ,$intPaddingItems=null |
| 65 | ) |
| 66 | { |
| 67 | parent::__construct($strName |
| 68 | ,$arrOptions |
| 69 | ,$arrValues |
| 70 | ,$boolRequired |
| 71 | ,$intQtdColumns |
| 72 | ,$intWidth |
| 73 | ,$intHeight |
| 74 | ,$intPaddingItems |
| 75 | ,false |
| 76 | ,TOption::RADIO |
| 77 | ); |
| 78 | } |
| 79 | public function show($print=true) |
| 80 | { |
| 81 | // se o controle etiver desativado, gerar um campo oculto com mesmo nome e id para não perder o post e |
| 82 | // renomear o input para "id"_disabled |
| 83 | if( ! $this->getEnabled() ) { |
| 84 | $value = $this->getValue(); |
| 85 | $h = new THidden($this->getId()); |
| 86 | if( $this->getRequired() ) { |
| 87 | $h->setProperty('needed','true'); |
| 88 | } |
| 89 | if( isset($value[0] ) ) { |
| 90 | $h->setValue($value[0]); |
| 91 | } |
| 92 | $this->add($h); |
| 93 | } |
| 94 | return parent::show($print); |
| 95 | } |
| 96 | } |
| 97 | ?> |