Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 19
TGridNumberColumn
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 6
56
0.00% covered (danger)
0.00%
0 / 19
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 4
 getEdit
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 9
 setDecimalPlaces
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 getDecimalPlaces
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 setFormatInteger
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 getFormatInteger
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
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 */
41class TGridNumberColumn extends TGridEditColumn
42{
43    private $decimalPlaces;
44    private $formatInteger;
45    /**
46    * Implementa coluna para entrada de dados num?rica
47    *
48    *
49    * @param string $strEditName
50    * @param string $strTitle
51    * @param string $strFieldName
52    * @param integer $intSize
53    * @param integer $intDecimalPlaces
54    * @param boolean $boolFormatInteger
55    * @param string $strWidth
56    * @param string $strAlign
57    * @param boolean $boolReadOnly
58    * @return TGridNumberColumn
59    */
60    public function __construct(string $strEditName
61                               ,string $strTitle
62                               ,string $strFieldName
63                               ,int $intSize
64                               ,$intDecimalPlaces=null
65                               ,$boolFormatInteger=null
66                               ,$strWidth=null,$strAlign=null,$boolReadOnly=null)
67    {
68        parent::__construct($strEditName,$strTitle,$strFieldName,'number',$intSize,$intSize,null,$strWidth,$strAlign,$boolReadOnly);
69        $this->setDecimalPlaces($intDecimalPlaces);
70        $this->setFormatInteger($boolFormatInteger);
71    }
72    //---------------------------------------------------------------------------------------------------
73    public function getEdit()
74    {
75         $edit = new TNumber($this->getEditName().'['.$this->getKeyValue().']',$this->getValue(),$this->getSize(),false,$this->getDecimalPlaces(),null,null,$this->getFormatInteger());
76         $edit->setId($this->getEditName().'_'.$this->getRowNum());
77         $edit->setExampleText(''); // n?o exibir o texto exemplo na frente do campo
78        $edit->setCss($this->getCss());
79        if( is_null( $edit->getCss('border') ) )
80        {
81            $edit->setCss('border','1px solid silver');
82        }
83        $edit->setEvents($this->getEvents());
84
85        // adicionar o nome do campo como attibuto do input
86        $edit->setAttribute('fieldname',$this->getFieldName() );
87        return $edit;
88    }
89    //---------------------------------------------------------------------------------------------------
90    public function setDecimalPlaces($intNewValue=null)
91    {
92        $this->decimalPlaces = $intNewValue;
93    }
94    public function getDecimalPlaces()
95    {
96        return $this->decimalPlaces;
97    }
98    //---------------------------------------------------------------------------------------------------
99    public function setFormatInteger($boolNewValue=null)
100    {
101        $this->formatInteger = $boolNewValue;
102    }
103    public function getFormatInteger()
104    {
105        return $this->formatInteger;
106    }
107}
108?>