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 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 18
TTextEditor
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 5
56
0.00% covered (danger)
0.00%
0 / 18
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 getResizeEnabled
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 setResizeEnabled
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 3
 show
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 10
 getValue
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* Classe para implementar campos de entrada de dados de varias linhas (textareas)
43*
44*/
45class TTextEditor extends TMemo
46{
47    private $showCounter;
48    private $onlineSearch;
49    private $resizeEnabled;
50
51    public function __construct(string $strName,string $strValue=null,$intMaxLength,$boolRequired=null,$intColumns=null,$intRows=null,$boolShowCounter=null)
52    {
53        parent::__construct($strName,$strValue,$intMaxLength,$boolRequired,$intColumns,$intRows,$boolShowCounter);
54        parent::setFieldType('textEditor');
55    }
56
57    /**
58     * @return $resizeEnabled
59     */
60    public function getResizeEnabled() {
61        return $this->resizeEnabled;
62    }
63
64    /**
65     * 
66     * @param bool $boolResizeEnabled
67     * @return TTextEditor
68     */
69    public function setResizeEnabled($boolResizeEnabled) {
70        if (is_bool($boolResizeEnabled))
71            $this->resizeEnabled = $boolResizeEnabled;
72        return $this;
73    }
74
75    public function show($print=true) {
76        if ($this->getResizeEnabled()) {
77//            $script=new TElement('<script>');
78//            $script->add('CKEDITOR.config.resize_enabled = false;');
79//            $script->show();
80
81            $div = new TElement('div');
82            $div->setId($this->getId().'_div');
83            $div->add( parent::show(false).$this->getOnlineSearch());
84//            $counter = new TElement('span');
85//            $counter->setId($this->getId().'_counter');
86//            $counter->setCss('border','none');
87//            $counter->setCss('font-size','11');
88//            $counter->setCss('color','#00000');
89//            $div->add('<br>');
90//            $div->add($counter);
91            $script=new TElement('<script>');
92            $script->add('// comentario.');
93            $script->add('CKEDITOR.config.resize_enabled = false;');
94            $div->add($script);
95            return $div->show($print);
96        }
97        return parent::show($print).$this->getOnlineSearch();
98    }
99
100    public function getValue() {
101        return str_replace(chr(147), '"', parent::getValue()); //substitui aspas erradas pelas corretas
102    }
103
104}
105?>