From 3190703b01e52b2b887f61126dfb6eb9f094eabb Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Thu, 30 Jul 2009 18:20:00 +0000 Subject: [PATCH] Refactoring para coding standards --- ieducar/intranet/include/clsDetalhe.inc.php | 506 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 file changed, 247 insertions(+), 259 deletions(-) diff --git a/ieducar/intranet/include/clsDetalhe.inc.php b/ieducar/intranet/include/clsDetalhe.inc.php index 60acd56..e194de6 100755 --- a/ieducar/intranet/include/clsDetalhe.inc.php +++ b/ieducar/intranet/include/clsDetalhe.inc.php @@ -1,262 +1,250 @@ + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Prefeitura Municipal de Itajaí + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL + * @package Core + * @subpackage UI + * @since Arquivo disponível desde a versão 1.0.0 + * @version $Id$ + */ + +/** + * clsDetalhe class. + * + * Cria um template para a visualização de um registro de alguma tabela do banco + * de dados. + * + * @author Prefeitura Municipal de Itajaí + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL + * @package Core + * @subpackage UI + * @since Classe disponível desde a versão 1.0.0 + * @version $Id$ + */ +class clsDetalhe { - var $titulo; - var $banner = false; - var $bannerLateral = false; - var $titulo_barra; - var $bannerClose = false; - var $largura; - var $detalhe = array(); - - var $url_novo; - var $caption_novo = "Novo"; - var $url_editar; - var $url_cancelar; - var $nome_url_cancelar = "Voltar"; - - var $array_botao; - var $array_botao_url; - var $array_botao_url_script; - - function addBanner( $strBannerUrl = "", $strBannerLateralUrl = "", $strBannerTitulo = "", $boolFechaBanner = true ) - { - if( $strBannerUrl != "" ) - { - $this->banner = $strBannerUrl; - } - if( $strBannerLateralUrl != "" ) - { - $this->bannerLateral = $strBannerLateralUrl; - } - if( $strBannerTitulo != "" ) - { - $this->titulo_barra = $strBannerTitulo; - } - $this->bannerClose = $boolFechaBanner; - } - - function addDetalhe( $detalhe ) - { - $this->detalhe[] = $detalhe; - } - - function Gerar () - { - return false; - } - - function RenderHTML() - { - $this->titulo_barra= "Intranet"; - $this->Gerar(); - - $retorno = ""; - if( $this->banner ) - { - $retorno .= ""; - $retorno .= " - -
bannerLateral}\" align=\"right\" border=\"0\" alt=\"$this->titulo_barra\" title=\"$this->titulo_barra\">"; - } - - $script = explode("/",$_SERVER["PHP_SELF"]); - $script = $script[count($script)-1]; - - $width = empty( $this->largura ) ? "" : "width='$this->largura'"; - - /* - * adiciona os botoes de help para a pagina atual - */ - $url = parse_url($_SERVER['REQUEST_URI']); - $url = ereg_replace( "^/", "", $url["path"] ); - if( strpos($url,"_det.php") !== false ) - { - $tipo = "det"; - } - else if( strpos($url,"_lst.php") !== false ) - { - $tipo = "lst"; - } - else if( strpos($url,"_pdf.php") !== false ) - { - $tipo = "pdf"; - } - else - { - $tipo = "cad"; - } - - $barra = "{$this->titulo}"; - if(class_exists("clsPmiajudaPagina")) - { - $ajudaPagina = new clsPmiajudaPagina(); - $lista = $ajudaPagina->lista(null,null,$url); - if( $lista ) - { - $barra = " - - - - - - - -
\"Bot�o{$this->titulo}\"Bot�o
"; - } - } - - $retorno .= " - - - - - - "; - - if ( empty( $this->detalhe ) ) - { - $retorno .= "\n"; - } - else - { - if (is_array($this->detalhe)) - { - reset( $this->detalhe ); - $campo_anterior = ""; - $md = true; - foreach($this->detalhe as $pardetalhe) - { -// if($pardetalhe[0] && $pardetalhe[1]) -// { - $campo = $pardetalhe[0].":"; - $texto = $pardetalhe[1]; -// } - if ($campo == $campo_anterior) - { - $campo = ""; - } - else - { - $campo_anterior = $campo; - $md = !$md; - } - - if ($campo == "-:") - { - if (empty( $texto )) - $texto = " "; - - $retorno .= "\n"; - } - else - { - $classe = $md ? 'formmdtd' : 'formlttd'; - - $retorno .= "\n"; - } - } - } - } - $retorno .= "\n"; - - if ( !empty( $this->url_editar ) || !empty( $this->url_cancelar ) || $this->array_botao ) - { - $retorno .= " - - "; - - if ($this->array_botao_url || $this->array_botao_url_script) - { - - $retorno .= ""; - } - - $retorno .= ""; - } - $retorno .= " -
{$barra}
Não há informação a ser apresentada.
$texto
$campo$texto
- - "; - - if ($this->url_novo) - { - $retorno .= "  \n"; - } - if ($this->url_editar) - { - $retorno .= "  \n"; - } - if ($this->url_cancelar) - { - $retorno .= "  \n"; - } - $retorno .= "
 
"; - } - - if($this->array_botao_url) - { - for ( $i = 0; $i < count($this->array_botao); $i++) - { - $retorno .= "  \n"; - } - } - elseif ($this->array_botao_url_script) - { - for ( $i = 0; $i < count($this->array_botao); $i++) - { - $retorno .= "  \n"; - } - } - - if ($this->array_botao_url || $this->array_botao_url_script) - { - $retorno .= "
 


- "; - - if( $this->bannerClose ) - { - $retorno .= " - -
- "; - } - - return $retorno; - } -} -?> \ No newline at end of file + var $titulo; + var $banner = FALSE; + var $bannerLateral = FALSE; + var $titulo_barra; + var $bannerClose = FALSE; + var $largura; + var $detalhe = array(); + + var $url_novo; + var $caption_novo = "Novo"; + var $url_editar; + var $url_cancelar; + var $nome_url_cancelar = "Voltar"; + + var $array_botao; + var $array_botao_url; + var $array_botao_url_script; + + function addBanner($strBannerUrl = '', $strBannerLateralUrl = '', + $strBannerTitulo = '', $boolFechaBanner = TRUE) + { + if ($strBannerUrl != '') { + $this->banner = $strBannerUrl; + } + + if ($strBannerLateralUrl != '') { + $this->bannerLateral = $strBannerLateralUrl; + } + + if ($strBannerTitulo != '') { + $this->titulo_barra = $strBannerTitulo; + } + + $this->bannerClose = $boolFechaBanner; + } + + + function addDetalhe($detalhe) { + $this->detalhe[] = $detalhe; + } + + function Gerar() { + return FALSE; + } + + function RenderHTML() + { + $this->titulo_barra= 'Intranet'; + $this->Gerar(); + + $retorno = ''; + if ($this->banner) { + $retorno .= ""; + $retorno .= " + +
bannerLateral}\" align=\"right\" border=\"0\" alt=\"$this->titulo_barra\" title=\"$this->titulo_barra\">"; + } + + $script = explode('/', $_SERVER['PHP_SELF']); + $script = $script[count($script)-1]; + + $width = empty($this->largura) ? '' : 'width=' . $this->largura; + + /* + * adiciona os botoes de help para a pagina atual + */ + $url = parse_url($_SERVER['REQUEST_URI']); + $url = ereg_replace( "^/", "", $url["path"] ); + + if (strpos($url, '_det.php') !== FALSE) { + $tipo = "det"; + } + elseif (strpos($url, '_lst.php') !== FALSE) { + $tipo = 'lst'; + } + elseif (strpos($url, '_pdf.php') !== FALSE) { + $tipo = 'pdf'; + } + else { + $tipo = 'cad'; + } + + $barra = '' . $this->titulo . ''; + if (class_exists('clsPmiajudaPagina')) { + $ajudaPagina = new clsPmiajudaPagina(); + $lista = $ajudaPagina->lista(null,null,$url); + + if ($lista) { + $barra = " + + + + + + + +
\"Bot�o{$this->titulo}\"Bot�o
"; + } + } + + $retorno .= " + + + + + + "; + + if (empty($this->detalhe)) { + $retorno .= "\n"; + } + else { + if (is_array($this->detalhe)) { + reset($this->detalhe); + + $campo_anterior = ""; + $md = TRUE; + + foreach ($this->detalhe as $pardetalhe) { + $campo = $pardetalhe[0].":"; + $texto = $pardetalhe[1]; + + if ($campo == $campo_anterior) { + $campo = ""; + } + else { + $campo_anterior = $campo; + $md = !$md; + } + + if ($campo == "-:") { + if (empty($texto)) { + $texto = ' '; + } + + $retorno .= "\n"; + } + else { + $classe = $md ? 'formmdtd' : 'formlttd'; + $retorno .= "\n"; + } + } + } + } + + $retorno .= "\n"; + + if (!empty($this->url_editar) || !empty($this->url_cancelar) || $this->array_botao) { + $retorno .= " + + "; + + if ($this->array_botao_url || $this->array_botao_url_script) { + $retorno .= ""; + } + + $retorno .= ""; + } + + $retorno .= " +
{$barra}
Não há informação a ser apresentada.
$texto
$campo$texto
+ "; + + if ($this->url_novo) { + $retorno .= "  \n"; + } + + if ($this->url_editar) { + $retorno .= "  \n"; + } + + if ($this->url_cancelar) { + $retorno .= "  \n"; + } + $retorno .= "
 
"; + } + + if ($this->array_botao_url) { + for ($i = 0, $total = count($this->array_botao); $i < $total; $i++) { + $retorno .= "  \n"; + } + } + elseif ($this->array_botao_url_script) { + for ($i = 0, $total = count($this->array_botao); $i < $total; $i++) { + $retorno .= "  \n"; + } + } + + if ($this->array_botao_url || $this->array_botao_url_script) { + $retorno .= "
 


+ "; + + if ($this->bannerClose) { + $retorno .= " + +
"; + } + + return $retorno; + } +} \ No newline at end of file -- libgit2 0.21.2