Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 12 |
CRAP | |
0.00% |
0 / 38 |
| TGridSelectColumn | |
0.00% |
0 / 1 |
|
0.00% |
0 / 12 |
156 | |
0.00% |
0 / 38 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 7 |
|||
| getEdit | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 16 |
|||
| setOptions | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getOptions | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| setFirstOptionText | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getFirstOptionText | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| setDisplayField | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| setKeyField | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getDisplayField | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| getKeyField | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| setInitialValueField | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getInitialValueField | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| 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 | |
| 42 | class TGridSelectColumn extends TGridEditColumn |
| 43 | { |
| 44 | private $options; |
| 45 | private $firstOptionText; |
| 46 | private $keyField; |
| 47 | private $displayField; |
| 48 | private $initialValueField; |
| 49 | |
| 50 | /** |
| 51 | * Implementa coluna do tipo menuSelect no gride |
| 52 | * |
| 53 | * Ex: addSelectColumn('seq_tipo','TIPO','SEQ_TIPO','1=Um,2=Dois'); |
| 54 | * |
| 55 | * @param string $strEditName - 1: ID do campos |
| 56 | * @param string $strTitle - 2: Titulo que irá aparecer no grid |
| 57 | * @param string $strFieldName - 3: Nome do campo do gride |
| 58 | * @param mixed $mixOptions - 4: Opções caso o Campo do gride não seja um array |
| 59 | * @param string $strWidth - 5: largura do campos em piexel |
| 60 | * @param boolean $boolReadOnly - 6: Somente Leiura |
| 61 | * @param string $strFirstOptionText |
| 62 | * @param string $strFirstOptionValue |
| 63 | * @param string $strKeyField |
| 64 | * @param string $strDisplayField |
| 65 | * @param string $strInitialValueField |
| 66 | * |
| 67 | * @return TGridSelectColumn |
| 68 | */ |
| 69 | public function __construct($strEditName |
| 70 | ,$strTitle |
| 71 | ,$strFieldName |
| 72 | ,$mixOptions=null |
| 73 | ,$strWidth=null |
| 74 | ,$boolReadOnly=null |
| 75 | ,$strFirstOptionText=null |
| 76 | ,$strFirstOptionValue=null |
| 77 | ,$strKeyField=null |
| 78 | ,$strDisplayField=null |
| 79 | ,$strInitialValueField=null) |
| 80 | { |
| 81 | parent::__construct($strEditName,$strTitle,$strFieldName,'select',null,null,null,$strWidth,null,$boolReadOnly); |
| 82 | $this->setOptions($mixOptions); |
| 83 | $this->setFirstOptionText($strFirstOptionText); |
| 84 | $this->setDisplayField($strDisplayField); |
| 85 | $this->setKeyField($strKeyField); |
| 86 | $this->setInitialValueField($strInitialValueField); |
| 87 | } |
| 88 | ///--------------------------------------------------------------------------------------------------- |
| 89 | public function getEdit() |
| 90 | { |
| 91 | $strName = strtolower($this->getEditName()).'['.$this->getKeyValue().']'; |
| 92 | $edit = new TSelect($strName |
| 93 | ,$this->getOptions() |
| 94 | ,$this->getValue() |
| 95 | ,false |
| 96 | ,false |
| 97 | ,null |
| 98 | ,$this->getWidth() |
| 99 | ,$this->getFirstOptionText(),null,$this->getKeyField(),$this->getDisplayField()); |
| 100 | $id = strtolower($this->getEditName()).'_'.$this->getRowNum(); |
| 101 | $edit->setId( $id ); |
| 102 | $edit->setCss($this->getCss()); |
| 103 | $edit->setEvents($this->getEvents()); |
| 104 | // adicionar o nome do campo como attibuto do input |
| 105 | $edit->setAttribute('fieldname',$this->getFieldName() ); |
| 106 | $edit->setAttribute('fwName',$this->getEditName() ); |
| 107 | return $edit; |
| 108 | } |
| 109 | //--------------------------------------------------------------------------------------------- |
| 110 | public function setOptions($arrNewValues=null) |
| 111 | { |
| 112 | $this->options = $arrNewValues; |
| 113 | } |
| 114 | //--------------------------------------------------------------------------------------------- |
| 115 | public function getOptions() |
| 116 | { |
| 117 | return $this->options; |
| 118 | } |
| 119 | //--------------------------------------------------------------------------------------------- |
| 120 | public function setFirstOptionText($strFirstOptionText=null) |
| 121 | { |
| 122 | $this->firstOptionText = $strFirstOptionText; |
| 123 | } |
| 124 | //--------------------------------------------------------------------------------------------- |
| 125 | public function getFirstOptionText() |
| 126 | { |
| 127 | return $this->firstOptionText; |
| 128 | } |
| 129 | //---------------------------------------------------------------------------------------- |
| 130 | public function setDisplayField($strNewValue=null) |
| 131 | { |
| 132 | $this->displayField = $strNewValue; |
| 133 | } |
| 134 | //---------------------------------------------------------------------------------------- |
| 135 | public function setKeyField($strNewValue=null) |
| 136 | { |
| 137 | $this->keyField = $strNewValue; |
| 138 | } |
| 139 | //---------------------------------------------------------------------------------------- |
| 140 | public function getDisplayField() |
| 141 | { |
| 142 | return $this->displayField; |
| 143 | } |
| 144 | //---------------------------------------------------------------------------------------- |
| 145 | public function getKeyField() |
| 146 | { |
| 147 | return $this->keyField; |
| 148 | } |
| 149 | //---------------------------------------------------------------------------------------- |
| 150 | public function setInitialValueField($strNewValue=null) |
| 151 | { |
| 152 | $this->initialValueField = $strNewValue; |
| 153 | } |
| 154 | //---------------------------------------------------------------------------------------- |
| 155 | public function getInitialValueField() |
| 156 | { |
| 157 | return $this->initialValueField; |
| 158 | } |
| 159 | } |
| 160 | ?> |