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 / 24
TPassword
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 6
110
0.00% covered (danger)
0.00%
0 / 24
 __construct
0.00% covered (danger)
0.00%
0 / 1
30
0.00% covered (danger)
0.00%
0 / 15
 enableVirtualKeyborad
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 disableVirtualKeyborad
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 getVirtualKeyboard
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getShowVirtualKeyboardImage
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 setShowVirtualKeyboardImage
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
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 TPassword extends TEdit
43{
44    private $virtualKeyboard;
45    private $showVirtualKeyboardImage;
46
47    /**
48    * Campo para entrada de senhas
49    *
50    * @param string $strName
51    * @param string $strValue
52    * @param integer $intMaxLength
53    * @param boolean $boolRequired
54    * @param integer $intSize
55    * @param boolean $boolUseVirtualKeyboard
56    * @param boolean $boolShowVirtualKeyboardImage
57    * @param boolean $boolReadOnly
58    * @return TPassword
59    */
60    public function __construct(string $strName
61                               ,string $strValue=null
62                               ,$intMaxLength
63                               ,$boolRequired=null,$intSize=null, $boolUseVirtualKeyboard=null, $boolShowVirtualKeyboardImage=null, $boolReadOnly=null )
64    {
65        $intMaxLength = is_null($intMaxLength) ? 20 : $intMaxLength;
66        parent::__construct($strName,$strValue,$intMaxLength,$boolRequired);
67        $this->setFieldType('password');
68        $this->setSize( is_null( $intSize) ? 20 : $intSize );
69        $this->setProperty('type','password');
70        $this->setProperty('autocomplete','off');
71        $this->addEvent('onkeypress','return getCapsLock(event,this);');
72        $this->addEvent('onkeydown','fwDisableCtrlKey(event,"c,v",this)'); // desabilitar ctrl+"v" e "c" no campo senha
73        $this->setReadOnly( $boolReadOnly );
74        if( $boolUseVirtualKeyboard === true )
75        {
76            $this->enableVirtualKeyborad();
77            $this->setShowVirtualKeyboardImage($boolShowVirtualKeyboardImage);
78            if( $boolReadOnly===false)
79            {
80                $this->setReadOnly( false );
81            }
82        }
83    }
84
85    public function enableVirtualKeyborad()
86    {
87        $this->virtualKeyboard = true;
88        $this->setReadOnly(true);
89    }
90
91    public function disableVirtualKeyborad()
92    {
93        $this->virtualKeyboard = false;
94    }
95
96    public function getVirtualKeyboard()
97    {
98        return $this->virtualKeyboard;
99    }
100
101    public function getShowVirtualKeyboardImage()
102    {
103        return $this->showVirtualKeyboardImage;
104    }
105
106    public function setShowVirtualKeyboardImage($boolNewValue=null)
107    {
108        $this->showVirtualKeyboardImage = $boolNewValue;
109    }
110}
111/*
112return;
113$val = new TPassword('des_senha');
114$val->show();
115*/
116?>