From bcf80f1927a62428fc6986bf5fb7e0366e0e164b Mon Sep 17 00:00:00 2001 From: Lucas D'Avila Date: Thu, 31 Jan 2013 21:36:15 -0200 Subject: [PATCH] Adicionado as supoer classes de formulários, metodo para inputs helper, alterado clsDetalhe para que no detalhamento do cadastro de aluno possa ser exibido a listagem de matriculas de forma expandida --- ieducar/intranet/include/clsCadastro.inc.php | 40 ++++++++++++++++++++++++++-------------- ieducar/intranet/include/clsDetalhe.inc.php | 58 +++++++++++++++++++++++++++++++++++++--------------------- ieducar/intranet/include/clsListagem.inc.php | 20 ++++++++++++++------ 3 files changed, 77 insertions(+), 41 deletions(-) diff --git a/ieducar/intranet/include/clsCadastro.inc.php b/ieducar/intranet/include/clsCadastro.inc.php index d330697..272f10b 100755 --- a/ieducar/intranet/include/clsCadastro.inc.php +++ b/ieducar/intranet/include/clsCadastro.inc.php @@ -34,6 +34,9 @@ if (class_exists('clsPmiajudaPagina')) { require_once 'include/pmiajuda/clsPmiajudaPagina.inc.php'; } +require_once 'Portabilis/View/Helper/Application.php'; +require_once 'Portabilis/View/Helper/Inputs.php'; + /** * clsCadastro class. * @@ -217,6 +220,14 @@ class clsCadastro extends clsCampos return FALSE; } + protected function flashMessage() { + if (empty($this->mensagem) && isset($_GET['mensagem']) && $_GET['mensagem'] == 'sucesso') { + $this->mensagem = 'Registro incluido com sucesso!'; + } + + return empty($this->mensagem) ? "" : "

$this->mensagem

"; + } + function RenderHTML() { $this->_preRender(); @@ -259,7 +270,7 @@ class clsCadastro extends clsCampos } $retorno .= "
\n\n"; - $titulo = "{$this->tipoacao} {$this->titulo_aplication}"; + $titulo = $this->titulo ? $this->titulo : "{$this->tipoacao} {$this->titulo_aplication}"; /** * Adiciona os botoes de help para a pagina atual @@ -278,7 +289,6 @@ class clsCadastro extends clsCampos else { $tipo = 'cad'; } - $barra = $titulo; // @todo Remover código, funcionalidade não existente. @@ -300,18 +310,10 @@ class clsCadastro extends clsCampos $retorno .= ""; - if (empty($this->mensagem)) { - $this->mensagem = $_GET['mensagem']; - if ($this->mensagem == 'sucesso') { - $this->mensagem = 'Registro incluido com sucesso!'; - } - else { - $this->mensagem = ''; - } - } + $flashMessage = $this->flashMessage(); - if (!empty($this->mensagem)) { - $retorno .= ""; + if (! empty($flashMessage)) { + $retorno .= ""; } if (empty($this->campos)) { @@ -656,6 +658,8 @@ class clsCadastro extends clsCampos $retorno .= ""; } + Portabilis_View_Helper_Application::embedJavascriptToFixupFieldsWidth($this); + return $retorno; } @@ -719,4 +723,12 @@ class clsCadastro extends clsCampos } return NULL; } -} \ No newline at end of file + + + public function inputsHelper() { + if (! isset($this->_inputsHelper)) + $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this); + + return $this->_inputsHelper; + } +} diff --git a/ieducar/intranet/include/clsDetalhe.inc.php b/ieducar/intranet/include/clsDetalhe.inc.php index 619dc97..75f8076 100755 --- a/ieducar/intranet/include/clsDetalhe.inc.php +++ b/ieducar/intranet/include/clsDetalhe.inc.php @@ -156,35 +156,51 @@ class clsDetalhe extends Core_Controller_Page_Abstract if (empty($this->detalhe)) { $retorno .= "\n"; } - else { - if (is_array($this->detalhe)) { + else + { + if (is_array($this->detalhe)) + { reset($this->detalhe); $campo_anterior = ""; $md = TRUE; - foreach ($this->detalhe as $pardetalhe) { - $campo = $pardetalhe[0].":"; - $texto = $pardetalhe[1]; + foreach ($this->detalhe as $pardetalhe) + { + if (is_array($pardetalhe)) + { + $campo = $pardetalhe[0].":"; + $texto = $pardetalhe[1]; - if ($campo == $campo_anterior) { - $campo = ""; - } - else { - $campo_anterior = $campo; - $md = !$md; - } - - if ($campo == "-:") { - if (empty($texto)) { - $texto = ' '; + if ($campo == $campo_anterior) + { + $campo = ""; + } + else + { + $campo_anterior = $campo; + $md = !$md; } - $retorno .= "\n"; + if ($campo == "-:") + { + if (empty($texto)) + { + $texto = ' '; + } + $retorno .= "\n"; + } + else + { + $classe = $md ? 'formmdtd' : 'formlttd'; + $retorno .= "\n"; + } } - else { - $classe = $md ? 'formmdtd' : 'formlttd'; - $retorno .= "\n"; + else + { + + $retorno .= ""; + } } } @@ -251,4 +267,4 @@ class clsDetalhe extends Core_Controller_Page_Abstract return $retorno; } -} \ No newline at end of file +} diff --git a/ieducar/intranet/include/clsListagem.inc.php b/ieducar/intranet/include/clsListagem.inc.php index 2294a93..048d2ca 100755 --- a/ieducar/intranet/include/clsListagem.inc.php +++ b/ieducar/intranet/include/clsListagem.inc.php @@ -34,6 +34,8 @@ if (class_exists('clsPmiajudaPagina')) { require_once 'include/pmiajuda/clsPmiajudaPagina.inc.php'; } +require_once 'Portabilis/View/Helper/Application.php'; + define('alTopLeft', 'valign=top align=left'); define('alTopCenter', 'valign=top align=center'); define('alTopRight', 'valign=top align=right'); @@ -96,6 +98,8 @@ class clsListagem extends clsCampos var $campos_ordenacao; var $fonte; + var $exibirBotaoSubmit = true; + function Gerar() { return FALSE; @@ -413,11 +417,13 @@ class clsListagem extends clsCampos $retorno .= ""; - if ($this->botao_submit) { - $retorno .= "  "; - } - else { - $retorno .= "  "; + if ($this->exibirBotaoSubmit) { + if ($this->botao_submit) { + $retorno .= "  "; + } + else { + $retorno .= "  "; + } } $retorno .= " @@ -725,6 +731,8 @@ class clsListagem extends clsCampos "; } + Portabilis_View_Helper_Application::embedJavascriptToFixupFieldsWidth($this); + return $retorno; } @@ -737,4 +745,4 @@ class clsListagem extends clsCampos { die("
{$msg}
"); } -} \ No newline at end of file +} -- libgit2 0.21.2
{$barra}
$this->mensagem
{$flashMessage}
Não há informação a ser apresentada.
$texto
$texto
$campo$texto
$campo$texto
$pardetalhe