Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 12 |
CRAP | |
0.00% |
0 / 44 |
| TGroupBox | |
0.00% |
0 / 1 |
|
0.00% |
0 / 12 |
506 | |
0.00% |
0 / 44 |
| __construct | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 14 |
|||
| setImageClosed | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| setImageOpened | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| setCloseGroupId | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getCloseGroupId | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
|||
| getImageClosed | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
| getImageOpened | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
| setOpened | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getOpened | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 3 |
|||
| setCloseble | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getCloseble | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| show | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 11 |
|||
| 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 | /** |
| 43 | * Classe para criar grupo de campos identificados com um titulo |
| 44 | * |
| 45 | */ |
| 46 | class TGroupBox Extends TForm |
| 47 | { |
| 48 | private $imageClosed; |
| 49 | private $imageOpened; |
| 50 | private $closeGroupId; |
| 51 | private $opened; |
| 52 | private $closeble; |
| 53 | public function __construct($strName,$strLegend=null,$strHeight=null,$strWidth=null,$boolCloseble=null,$boolOverflowY=null,$boolOverflowX=null) |
| 54 | { |
| 55 | parent::__construct(null,$strHeight,$strWidth,$strName,"",null); |
| 56 | $this->setTagType('fieldset'); |
| 57 | $this->setFieldType('groupbox'); |
| 58 | $this->setClass('fwGroupBox'); |
| 59 | $this->setWidth($strWidth); |
| 60 | $this->setHeight($strHeight); |
| 61 | $legend = new TElement('legend'); |
| 62 | $legend->setClass('fwGroupBoxLegend'); |
| 63 | $legend->add($strLegend); |
| 64 | $this->setLegend($legend); |
| 65 | $this->setOverflowX( ( is_null( $boolOverflowX ) ? false : $boolOverflowX ) ); |
| 66 | $this->setOverflowY( ( is_null( $boolOverflowY ) ? false : $boolOverflowY ) ); |
| 67 | $this->setCloseble($boolCloseble); |
| 68 | //$this->body->add($legend); |
| 69 | } |
| 70 | public function setImageClosed($strNewValue=null) |
| 71 | { |
| 72 | $this->imageClosed = $strNewValue; |
| 73 | } |
| 74 | public function setImageOpened($strNewValue=null) |
| 75 | { |
| 76 | $this->imageOpened = $strNewValue; |
| 77 | } |
| 78 | public function setCloseGroupId($strNewValue=null) |
| 79 | { |
| 80 | $this->closeGroupId = $strNewValue; |
| 81 | } |
| 82 | public function getCloseGroupId() |
| 83 | { |
| 84 | if( is_null($this->closeGroupId ) ) |
| 85 | { |
| 86 | $this->setCloseGroupId( $this->getRandomChars() ); |
| 87 | } |
| 88 | return $this->closeGroupId; |
| 89 | } |
| 90 | public function getImageClosed() |
| 91 | { |
| 92 | return is_null($this->imageClosed) ? 'fwFolderOpen.gif' : $this->imageClosed; |
| 93 | } |
| 94 | public function getImageOpened() |
| 95 | { |
| 96 | return is_null($this->imageOpened) ? 'fwFolder.gif' : $this->imageOpened; |
| 97 | } |
| 98 | public function setOpened($boolNewValue=null) |
| 99 | { |
| 100 | $this->opened = $boolNewValue; |
| 101 | } |
| 102 | public function getOpened() |
| 103 | { |
| 104 | if( $this->getCloseble()) |
| 105 | { |
| 106 | return is_null($this->opened) ? false : $this->opened; |
| 107 | } |
| 108 | else |
| 109 | { |
| 110 | return is_null($this->opened) ? true : $this->opened; |
| 111 | } |
| 112 | } |
| 113 | public function setCloseble($boolNewValue=null) |
| 114 | { |
| 115 | $this->closeble = $boolNewValue; |
| 116 | } |
| 117 | public function getCloseble() |
| 118 | { |
| 119 | return $this->closeble; |
| 120 | } |
| 121 | public function show($print=true, $flat=false ) |
| 122 | { |
| 123 | if( !$this->getLegend()) |
| 124 | { |
| 125 | $this->legend->setcss('display','none'); |
| 126 | } |
| 127 | if( $this->getCloseble() ) |
| 128 | { |
| 129 | //$json=array('closeGroupId'=>$this->getCloseGroupId(),'groupId'=>$this->getId(),'imageOpened'=>$this->getImageOpened(),'imageClosed'=>$this->getImageClosed()); |
| 130 | //$btn = new TButton('btn_'.$this->getId().'_img',null,null,"fwOpenedCloseGroup(".json_encode($json).",this)",null,$this->getImageClosed(),null,'Fechar'); |
| 131 | $btn = new TButton($this->getId().'_img_opened_closed',null,null,"fwOpenCloseGroup('".$this->getId()."')",null,$this->getImageClosed(),null,'Abrir'); |
| 132 | $btn->setClass('fwGroupBoxImage'); |
| 133 | $btn->setProperty('alt','/\\'); |
| 134 | $this->setProperty('closeGroupId',$this->getCloseGroupId()); |
| 135 | $this->setProperty('imageOpened',$this->getImageOpened()); |
| 136 | $this->setProperty('imageClosed',$this->getImageClosed()); |
| 137 | $this->setOpenCloseButton($btn); |
| 138 | } |
| 139 | return parent::show($print); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | /* |
| 144 | $group = new TGroupBox('gpTeste','Cadastro'); |
| 145 | $group->setLegendText('Luis Eugênio'); |
| 146 | $group->addTextField('nom_pessoa','Nome:',50); |
| 147 | $group->show(); |
| 148 | return; |
| 149 | */ |
| 150 | |
| 151 | /* |
| 152 | $group->addTextField('nom_pessoa2','Nome2:',50); |
| 153 | $group->addMemoField('obs','Obs',500,true,80,4,null,null,null,'asasdfasdfasd fçkjasçd flasçdklf asdf'); |
| 154 | $group->setColumns(array(120)); |
| 155 | //$group->legend->setCss('background-color','red'); |
| 156 | $group->setEnabled(false); |
| 157 | */ |
| 158 | /* |
| 159 | $f = new TForm('Teste Grupo Box'); |
| 160 | //$f->setFlat(true); |
| 161 | $g = $f->addGroupField('gpTeste','Dados Funcionais','auto','auto'); |
| 162 | $g->addTextField('nom_pessoa1',"Nome:",20); |
| 163 | $g->addTextField('nom_pessoa2',"Nome:",20); |
| 164 | $g->addTextField('nom_pessoa3',"Nome:",20); |
| 165 | $g->addTextField('nom_pessoa4',"Nome:",20); |
| 166 | $g->addTextField('nom_pessoa5',"Nome:",20); |
| 167 | |
| 168 | $f->closeGroup(); |
| 169 | $g = $f->addGroupField('gpTeste2','Dados Relatório','auto','auto',false); |
| 170 | $g->addTextField('nom_pessoa6',"Nome:",20); |
| 171 | $g->addTextField('nom_pessoa7',"Nome:",20); |
| 172 | $g->addTextField('nom_pessoa8',"Nome:",20); |
| 173 | $g->addTextField('nom_pessoa9',"Nome:",20); |
| 174 | $g->addTextField('nom_pessoa10',"Nome:",20); |
| 175 | |
| 176 | $f->show(); |
| 177 | */ |
| 178 | ?> |