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 / 10
CRAP
0.00% covered (danger)
0.00%
0 / 31
TOpenDir
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 10
240
0.00% covered (danger)
0.00%
0 / 31
 __construct
0.00% covered (danger)
0.00%
0 / 1
20
0.00% covered (danger)
0.00%
0 / 10
 show
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 9
 getButton
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 setRootDir
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 getRootDir
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 setId
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 setTitle
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 getTitle
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 setCallback
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 getCallback
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 */
41
42/**
43* Classe base para seleção de diretórios
44*/
45class TOpenDir extends TEdit
46{
47    private $btnOpen;
48    private $rootDir;
49    private $title;
50    private $callback;
51    public function __construct($strName, $strRootDir=null, $strValue=null, $intMaxLength=null, $boolRequired=null, $intSize=null, $strTitle=null, $strJsCallBack=null )
52    {
53        $intSize = is_null($intSize) ? '60' : $intSize;
54        $intMaxLength = is_null( $intMaxLength) ? $intSize : $intMaxLength;
55        parent::__construct($strName, $strValue, $intMaxLength, $boolRequired, $intSize );
56        $this->setFieldType('opendir');
57        $strRootDir = is_null($strRootDir) ? './' : $strRootDir;
58        $this->setHint('Selecionar - Clique duas vezes para abrir a caixa de dialogo!');
59        $this->setReadOnly(true);
60        $this->setRootDir($strRootDir);
61        $this->btnOpen = new TButton('btn'.ucfirst($strName),'...',null,'evento',null,'folderOpen.gif','folderopen_desabilitado.gif','Selecionar pasta' );
62    }
63    public function show($print=true)
64    {
65        $btnClear = new TButton('btn'.ucfirst($this->getId()).'_clear', 'x', null, 'jQuery("#'.$this->getId().'").val("");',null,'borracha.gif' );
66        $btnClear->setHint('Apagar');
67        $btn = $this->getButton();
68        $btn->setAction('');
69        if( !$this->getEnabled())
70        {
71            $btn=null;
72        }
73        else
74        {
75            $btn->setEvent('onclick','fwOpenDir("'.$this->getId().'","'.$this->getRootDir().'","'.$this->getCallBack().'","'.$this->getTitle().'")');
76            $this->setEvent('ondblclick',$btn->getEvent('onclick'));
77        }
78        return parent::show($print).( ($btn) ? $btn->show($print).$btnClear->show(false):'');
79    }
80    public function getButton()
81    {
82        return $this->btnOpen;
83    }
84    public function setRootDir($strNewValue=null)
85    {
86        $this->rootDir = $strNewValue;
87    }
88    public function getRootDir()
89    {
90        return $this->rootDir;
91    }
92    public function setId($strNewValue=null)
93    {
94        parent::setId($strNewValue);
95    }
96    public function setTitle($strNewValue=null)
97    {
98        $this->title = $strNewValue;
99    }
100    public function getTitle()
101    {
102        return $this->title;
103    }
104    public function setCallback($strNewValue=null)
105    {
106        $this->callback = $strNewValue;
107    }
108    public function getCallback()
109    {
110        return $this->callback;
111    }
112}
113?>