Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
48.39% |
15 / 31 |
CRAP | |
47.78% |
43 / 90 |
| TAjuda | |
0.00% |
0 / 1 |
|
48.39% |
15 / 31 |
293.23 | |
47.78% |
43 / 90 |
| __call | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| __construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
14 / 14 |
|||
| setNome | |
0.00% |
0 / 1 |
2.26 | |
60.00% |
3 / 5 |
|||
| getNome | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| setRotulo | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getRotulo | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
|||
| setTexto | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getTexto | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
| setLargura | |
100.00% |
1 / 1 |
2 | |
100.00% |
2 / 2 |
|||
| getLargura | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| setAltura | |
100.00% |
1 / 1 |
2 | |
100.00% |
2 / 2 |
|||
| getAltura | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| setCorFundo | |
100.00% |
1 / 1 |
2 | |
100.00% |
2 / 2 |
|||
| getCorFundo | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setCorFonte | |
100.00% |
1 / 1 |
2 | |
100.00% |
2 / 2 |
|||
| getCorFonte | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setArquivoAjuda | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getArquivoAjuda | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| setPacoteOracle | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getPacoteOracle | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| setColunaChave | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getColunaChave | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| setColunaAjuda | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getColunaAjuda | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| setValorChave | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getValorChave | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| getBase | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 8 |
|||
| setTitulo | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getTitulo | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| getHtml | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 18 |
|||
| scape | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
|||
| 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 TAjuda { |
| 43 | |
| 44 | static public $base; |
| 45 | private $strNome=null; |
| 46 | private $strRotulo=null; // pode ser uma imagem ou texto |
| 47 | private $strTexto=null; |
| 48 | private $intLargura=null; |
| 49 | private $intAltura=null; |
| 50 | private $strCorFundo=null; |
| 51 | private $strCorFonte=null; |
| 52 | private $strArquivoAjuda=null; |
| 53 | private $strPacoteOracle=null; |
| 54 | private $strColunaChave=null; |
| 55 | private $strValorChave=null; |
| 56 | private $strColunaAjuda; |
| 57 | private $strTitulo=null; |
| 58 | public function __call( $strMethod, $arrParameters ) |
| 59 | { |
| 60 | die("O método <b><blink>" . $strMethod . "</blink></b> não foi encontrado na classe <b>" . get_class($this) . "</b>. "); |
| 61 | } |
| 62 | /** |
| 63 | * Emplementa ajuda on-line a um campo |
| 64 | * |
| 65 | * @param mixed $strNome |
| 66 | * @param mixed $strRotulo |
| 67 | * @param mixed $strTexto |
| 68 | * @param mixed $intLargura |
| 69 | * @param mixed $intAltura |
| 70 | * @param mixed $strCorFundo |
| 71 | * @param mixed $strCorFonte |
| 72 | * @param mixed $strArquivoAjuda |
| 73 | * @param mixed $strPacoteOracle |
| 74 | * @param mixed $strColunaChave |
| 75 | * @param mixed $strValorChave |
| 76 | * @param mixed $strColunaAjuda |
| 77 | * @param mixed $strTitulo |
| 78 | * @return TAjuda |
| 79 | */ |
| 80 | public function __construct($strNome=null |
| 81 | ,$strRotulo=null |
| 82 | ,$strTexto=null |
| 83 | ,$intLargura=null |
| 84 | ,$intAltura=null |
| 85 | ,$strCorFundo=null |
| 86 | ,$strCorFonte=null |
| 87 | ,$strArquivoAjuda=null |
| 88 | ,$strPacoteOracle=null |
| 89 | ,$strColunaChave=null |
| 90 | ,$strValorChave=null |
| 91 | ,$strColunaAjuda=null |
| 92 | ,$strTitulo=null ) |
| 93 | { |
| 94 | $this->setNome($strNome); |
| 95 | $this->setRotulo($strRotulo); |
| 96 | $this->setTexto($strTexto); |
| 97 | $this->setLargura($intLargura); |
| 98 | $this->setAltura($intAltura); |
| 99 | $this->setCorFundo($strCorFundo); |
| 100 | $this->setCorFonte($strCorFonte); |
| 101 | $this->setArquivoAjuda($strArquivoAjuda); |
| 102 | $this->setPacoteOracle($strPacoteOracle); |
| 103 | $this->setColunaChave($strColunaChave); |
| 104 | $this->setValorChave($strValorChave); |
| 105 | $this->setColunaAjuda($strColunaAjuda); |
| 106 | $this->setTitulo($strTitulo); |
| 107 | } |
| 108 | public function setNome($strNome=null) |
| 109 | { |
| 110 | if( (string)$strNome == '') |
| 111 | { |
| 112 | $strNome = 'campo_ajuda_'.date('his'); |
| 113 | sleep(1); |
| 114 | } |
| 115 | $this->strNome = $strNome; |
| 116 | } |
| 117 | function getNome() |
| 118 | { |
| 119 | return $this->strNome; |
| 120 | } |
| 121 | //------------------------------------------------------- |
| 122 | public function setRotulo($strRotulo=null) |
| 123 | { |
| 124 | $this->strRotulo = $strRotulo; |
| 125 | } |
| 126 | function getRotulo() |
| 127 | { |
| 128 | if((string)$this->strRotulo=='') |
| 129 | { |
| 130 | $this->strRotulo = $this->getBase().'imagens/fwbtnhelp.gif'; |
| 131 | } |
| 132 | return $this->strRotulo; |
| 133 | } |
| 134 | //------------------------------------------------------- |
| 135 | public function setTexto($strTexto=null) |
| 136 | { |
| 137 | $this->strTexto = $strTexto; |
| 138 | } |
| 139 | function getTexto() |
| 140 | { |
| 141 | $texto = str_replace("'","`",str_replace('"',""",str_replace(chr(10),'<br>',$this->strTexto))); |
| 142 | $texto = str_replace(chr(13),'',$texto); |
| 143 | return $texto; |
| 144 | } |
| 145 | //------------------------------------------------------- |
| 146 | public function setLargura($intLargura=null) |
| 147 | { |
| 148 | $this->intLargura = ((integer)$intLargura<1) ? 400 : (integer)$intLargura; |
| 149 | } |
| 150 | function getLargura() |
| 151 | { |
| 152 | return $this->intLargura; |
| 153 | } |
| 154 | //------------------------------------------------------- |
| 155 | public function setAltura($intAltura=null) |
| 156 | { |
| 157 | $this->intAltura = ((integer)$intAltura<1) ? 200 : (integer)$intAltura; |
| 158 | } |
| 159 | function getAltura() |
| 160 | { |
| 161 | return $this->intAltura; |
| 162 | } |
| 163 | //------------------------------------------------------- |
| 164 | public function setCorFundo($strCorFundo=null) |
| 165 | { |
| 166 | $this->strCorFundo = ((string)$strCorFundo=='') ? '#FFFFE4' : (string)$strCorFundo; |
| 167 | } |
| 168 | function getCorFundo() |
| 169 | { |
| 170 | return $this->strCorFundo; |
| 171 | } |
| 172 | //------------------------------------------------------- |
| 173 | public function setCorFonte($strCorFonte=null) |
| 174 | { |
| 175 | $this->strCorFonte = ((string)$strCorFonte=='') ? '#0000FF' : (string)$strCorFonte; |
| 176 | } |
| 177 | function getCorFonte() |
| 178 | { |
| 179 | return $this->strCorFonte; |
| 180 | } |
| 181 | //------------------------------------------------------- |
| 182 | public function setArquivoAjuda($strArquivoAjuda=null) |
| 183 | { |
| 184 | $this->strArquivoAjuda = (string)$strArquivoAjuda; |
| 185 | } |
| 186 | function getArquivoAjuda() |
| 187 | { |
| 188 | return $this->strArquivoAjuda; |
| 189 | } |
| 190 | //------------------------------------------------------- |
| 191 | public function setPacoteOracle($strPacoteOracle=null) |
| 192 | { |
| 193 | $this->strPacoteOracle = (string)$strPacoteOracle; |
| 194 | } |
| 195 | function getPacoteOracle() |
| 196 | { |
| 197 | return $this->strNomePacote; |
| 198 | } |
| 199 | //------------------------------------------------------- |
| 200 | public function setColunaChave($strColunaChave=null) |
| 201 | { |
| 202 | $this->strColunaChave = (string)$strColunaChave; |
| 203 | } |
| 204 | function getColunaChave() |
| 205 | { |
| 206 | return $this->strColunaChave; |
| 207 | } |
| 208 | //------------------------------------------------------- |
| 209 | public function setColunaAjuda($strColunaAjuda=null) |
| 210 | { |
| 211 | $this->strColunaAjuda = (string)$strColunaAjuda; |
| 212 | } |
| 213 | function getColunaAjuda() |
| 214 | { |
| 215 | return $this->strColunaAjuda; |
| 216 | } |
| 217 | //------------------------------------------------------- |
| 218 | public function setValorChave($strValorChave=null) |
| 219 | { |
| 220 | $this->strValorChave = (string)$strValorChave; |
| 221 | } |
| 222 | function getValorChave() |
| 223 | { |
| 224 | return $this->strValorChave; |
| 225 | } |
| 226 | //------------------------------------------------------- |
| 227 | public function getBase() |
| 228 | { |
| 229 | //if((string)$this->base=="") |
| 230 | if( is_null(self::$base) ) |
| 231 | { |
| 232 | for($i=0;$i<10;$i++) |
| 233 | { |
| 234 | $base = str_repeat('../',$i).'base/'; |
| 235 | if( FileHelper::exists($base) ){ |
| 236 | $i=1000; |
| 237 | //$this->base = $base; |
| 238 | self::$base=$base; |
| 239 | break; |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | return self::$base; |
| 244 | } |
| 245 | //------------------------------------------------------- |
| 246 | public function setTitulo($strTitulo=null) |
| 247 | { |
| 248 | $this->strTitulo = (string)$strTitulo; |
| 249 | } |
| 250 | function getTitulo() |
| 251 | { |
| 252 | return $this->strTitulo; |
| 253 | } |
| 254 | //---------------------------------------------------------- |
| 255 | public function getHtml() |
| 256 | { |
| 257 | $onClick = 'onClick="fwExibirAjuda('. |
| 258 | $this->scape($this->getTexto()).','. |
| 259 | $this->getLargura().','. |
| 260 | $this->getAltura().','. |
| 261 | $this->scape($this->getCorFundo()).','. |
| 262 | $this->scape($this->getCorFonte()).','. |
| 263 | $this->scape($this->getArquivoAjuda()).','. |
| 264 | $this->scape($this->getBase()).','. |
| 265 | $this->scape($this->getPacoteOracle()).','. |
| 266 | $this->scape($this->getColunaChave()).','. |
| 267 | $this->scape($this->getValorChave()).','. |
| 268 | $this->scape($this->getColunaAjuda()).','. |
| 269 | $this->scape($this->getTitulo()).');"'; |
| 270 | $strRotulo = $this->getRotulo(); |
| 271 | if(strpos($strRotulo,'.gif') > 0 ) |
| 272 | { |
| 273 | $strRetorno = '<img style="cursor:pointer;vertical-align:middle;" title ="Ajuda" src="'.$this->getRotulo().'" '.$onClick.'>'; |
| 274 | } |
| 275 | else |
| 276 | { |
| 277 | $strRetorno= '<a style="cursor:pointer;" href="#" '.$onClick.'>'.$strRotulo.'</a>'; //" onMouseOver="this.T_WIDTH=300;this.T_TEXTALIGN=\'left\';return escape('teste do campo ajuda para ver se funciona bem')">Clique aqui para Ajuda on-line</a></span> |
| 278 | } |
| 279 | return $strRetorno; |
| 280 | } |
| 281 | //------------------------------------------------------------------------------------ |
| 282 | public function scape($strValor) |
| 283 | { |
| 284 | if ((string)$strValor=='') |
| 285 | { |
| 286 | return 'null'; |
| 287 | } |
| 288 | else |
| 289 | { |
| 290 | return "'".$strValor."'"; |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | //$campoAjuda = new Ajuda(); |
| 295 | //$campoAjuda->setRotulo('../imagens/ajuda.gif'); |
| 296 | //print $campoAjuda->getHtml(); |
| 297 | ?> |