Commit bcf80f1927a62428fc6986bf5fb7e0366e0e164b
1 parent
e9c539a7
Exists in
master
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
Showing
3 changed files
with
77 additions
and
41 deletions
Show diff stats
ieducar/intranet/include/clsCadastro.inc.php
| ... | ... | @@ -34,6 +34,9 @@ if (class_exists('clsPmiajudaPagina')) { |
| 34 | 34 | require_once 'include/pmiajuda/clsPmiajudaPagina.inc.php'; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | +require_once 'Portabilis/View/Helper/Application.php'; | |
| 38 | +require_once 'Portabilis/View/Helper/Inputs.php'; | |
| 39 | + | |
| 37 | 40 | /** |
| 38 | 41 | * clsCadastro class. |
| 39 | 42 | * |
| ... | ... | @@ -217,6 +220,14 @@ class clsCadastro extends clsCampos |
| 217 | 220 | return FALSE; |
| 218 | 221 | } |
| 219 | 222 | |
| 223 | + protected function flashMessage() { | |
| 224 | + if (empty($this->mensagem) && isset($_GET['mensagem']) && $_GET['mensagem'] == 'sucesso') { | |
| 225 | + $this->mensagem = 'Registro incluido com sucesso!'; | |
| 226 | + } | |
| 227 | + | |
| 228 | + return empty($this->mensagem) ? "" : "<p class='form_erro error'>$this->mensagem</p>"; | |
| 229 | + } | |
| 230 | + | |
| 220 | 231 | function RenderHTML() |
| 221 | 232 | { |
| 222 | 233 | $this->_preRender(); |
| ... | ... | @@ -259,7 +270,7 @@ class clsCadastro extends clsCampos |
| 259 | 270 | } |
| 260 | 271 | |
| 261 | 272 | $retorno .= "<center>\n<table class='tablecadastro' $width border='0' cellpadding='2' cellspacing='0'>\n"; |
| 262 | - $titulo = "<b>{$this->tipoacao} {$this->titulo_aplication}</b>"; | |
| 273 | + $titulo = $this->titulo ? $this->titulo : "<b>{$this->tipoacao} {$this->titulo_aplication}</b>"; | |
| 263 | 274 | |
| 264 | 275 | /** |
| 265 | 276 | * Adiciona os botoes de help para a pagina atual |
| ... | ... | @@ -278,7 +289,6 @@ class clsCadastro extends clsCampos |
| 278 | 289 | else { |
| 279 | 290 | $tipo = 'cad'; |
| 280 | 291 | } |
| 281 | - | |
| 282 | 292 | $barra = $titulo; |
| 283 | 293 | |
| 284 | 294 | // @todo Remover código, funcionalidade não existente. |
| ... | ... | @@ -300,18 +310,10 @@ class clsCadastro extends clsCampos |
| 300 | 310 | |
| 301 | 311 | $retorno .= "<tr><td class='formdktd' colspan='2' height='24'>{$barra}</td></tr>"; |
| 302 | 312 | |
| 303 | - if (empty($this->mensagem)) { | |
| 304 | - $this->mensagem = $_GET['mensagem']; | |
| 305 | - if ($this->mensagem == 'sucesso') { | |
| 306 | - $this->mensagem = 'Registro incluido com sucesso!'; | |
| 307 | - } | |
| 308 | - else { | |
| 309 | - $this->mensagem = ''; | |
| 310 | - } | |
| 311 | - } | |
| 313 | + $flashMessage = $this->flashMessage(); | |
| 312 | 314 | |
| 313 | - if (!empty($this->mensagem)) { | |
| 314 | - $retorno .= "<tr><td class='formmdtd' colspan='2' height='24'><span class='form_erro'><b>$this->mensagem</b></span></td></tr>"; | |
| 315 | + if (! empty($flashMessage)) { | |
| 316 | + $retorno .= "<tr><td class='formmdtd' colspan='2' height='24'><div id='flash-container'>{$flashMessage}</div></td></tr>"; | |
| 315 | 317 | } |
| 316 | 318 | |
| 317 | 319 | if (empty($this->campos)) { |
| ... | ... | @@ -656,6 +658,8 @@ class clsCadastro extends clsCampos |
| 656 | 658 | $retorno .= "<script type=\"text/javascript\">{$this->executa_script}</script>"; |
| 657 | 659 | } |
| 658 | 660 | |
| 661 | + Portabilis_View_Helper_Application::embedJavascriptToFixupFieldsWidth($this); | |
| 662 | + | |
| 659 | 663 | return $retorno; |
| 660 | 664 | } |
| 661 | 665 | |
| ... | ... | @@ -719,4 +723,12 @@ class clsCadastro extends clsCampos |
| 719 | 723 | } |
| 720 | 724 | return NULL; |
| 721 | 725 | } |
| 722 | -} | |
| 723 | 726 | \ No newline at end of file |
| 727 | + | |
| 728 | + | |
| 729 | + public function inputsHelper() { | |
| 730 | + if (! isset($this->_inputsHelper)) | |
| 731 | + $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this); | |
| 732 | + | |
| 733 | + return $this->_inputsHelper; | |
| 734 | + } | |
| 735 | +} | ... | ... |
ieducar/intranet/include/clsDetalhe.inc.php
| ... | ... | @@ -156,35 +156,51 @@ class clsDetalhe extends Core_Controller_Page_Abstract |
| 156 | 156 | if (empty($this->detalhe)) { |
| 157 | 157 | $retorno .= "<tr><td class='tableDetalheLinhaSim' colspan='2'>Não há informação a ser apresentada.</td></tr>\n"; |
| 158 | 158 | } |
| 159 | - else { | |
| 160 | - if (is_array($this->detalhe)) { | |
| 159 | + else | |
| 160 | + { | |
| 161 | + if (is_array($this->detalhe)) | |
| 162 | + { | |
| 161 | 163 | reset($this->detalhe); |
| 162 | 164 | |
| 163 | 165 | $campo_anterior = ""; |
| 164 | 166 | $md = TRUE; |
| 165 | 167 | |
| 166 | - foreach ($this->detalhe as $pardetalhe) { | |
| 167 | - $campo = $pardetalhe[0].":"; | |
| 168 | - $texto = $pardetalhe[1]; | |
| 168 | + foreach ($this->detalhe as $pardetalhe) | |
| 169 | + { | |
| 170 | + if (is_array($pardetalhe)) | |
| 171 | + { | |
| 172 | + $campo = $pardetalhe[0].":"; | |
| 173 | + $texto = $pardetalhe[1]; | |
| 169 | 174 | |
| 170 | - if ($campo == $campo_anterior) { | |
| 171 | - $campo = ""; | |
| 172 | - } | |
| 173 | - else { | |
| 174 | - $campo_anterior = $campo; | |
| 175 | - $md = !$md; | |
| 176 | - } | |
| 177 | - | |
| 178 | - if ($campo == "-:") { | |
| 179 | - if (empty($texto)) { | |
| 180 | - $texto = ' '; | |
| 175 | + if ($campo == $campo_anterior) | |
| 176 | + { | |
| 177 | + $campo = ""; | |
| 178 | + } | |
| 179 | + else | |
| 180 | + { | |
| 181 | + $campo_anterior = $campo; | |
| 182 | + $md = !$md; | |
| 181 | 183 | } |
| 182 | 184 | |
| 183 | - $retorno .= "<tr><td colspan='2' class='' width='20%'><span class='form'><b>$texto</b></span></td></tr>\n"; | |
| 185 | + if ($campo == "-:") | |
| 186 | + { | |
| 187 | + if (empty($texto)) | |
| 188 | + { | |
| 189 | + $texto = ' '; | |
| 190 | + } | |
| 191 | + $retorno .= "<tr><td colspan='2' class='' width='20%'><span class='form'><b>$texto</b></span></td></tr>\n"; | |
| 192 | + } | |
| 193 | + else | |
| 194 | + { | |
| 195 | + $classe = $md ? 'formmdtd' : 'formlttd'; | |
| 196 | + $retorno .= "<tr><td class='$classe' width='20%'>$campo</td><td class='$classe'>$texto</td></tr>\n"; | |
| 197 | + } | |
| 184 | 198 | } |
| 185 | - else { | |
| 186 | - $classe = $md ? 'formmdtd' : 'formlttd'; | |
| 187 | - $retorno .= "<tr><td class='$classe' width='20%'>$campo</td><td class='$classe'>$texto</td></tr>\n"; | |
| 199 | + else | |
| 200 | + { | |
| 201 | + | |
| 202 | + $retorno .= "<tr><td colspan='2'>$pardetalhe</td></tr>"; | |
| 203 | + | |
| 188 | 204 | } |
| 189 | 205 | } |
| 190 | 206 | } |
| ... | ... | @@ -251,4 +267,4 @@ class clsDetalhe extends Core_Controller_Page_Abstract |
| 251 | 267 | |
| 252 | 268 | return $retorno; |
| 253 | 269 | } |
| 254 | -} | |
| 255 | 270 | \ No newline at end of file |
| 271 | +} | ... | ... |
ieducar/intranet/include/clsListagem.inc.php
| ... | ... | @@ -34,6 +34,8 @@ if (class_exists('clsPmiajudaPagina')) { |
| 34 | 34 | require_once 'include/pmiajuda/clsPmiajudaPagina.inc.php'; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | +require_once 'Portabilis/View/Helper/Application.php'; | |
| 38 | + | |
| 37 | 39 | define('alTopLeft', 'valign=top align=left'); |
| 38 | 40 | define('alTopCenter', 'valign=top align=center'); |
| 39 | 41 | define('alTopRight', 'valign=top align=right'); |
| ... | ... | @@ -96,6 +98,8 @@ class clsListagem extends clsCampos |
| 96 | 98 | var $campos_ordenacao; |
| 97 | 99 | var $fonte; |
| 98 | 100 | |
| 101 | + var $exibirBotaoSubmit = true; | |
| 102 | + | |
| 99 | 103 | function Gerar() |
| 100 | 104 | { |
| 101 | 105 | return FALSE; |
| ... | ... | @@ -413,11 +417,13 @@ class clsListagem extends clsCampos |
| 413 | 417 | |
| 414 | 418 | $retorno .= "</script>"; |
| 415 | 419 | |
| 416 | - if ($this->botao_submit) { | |
| 417 | - $retorno .= " <input type='submit' class='botaolistagem' value='busca' id='botao_busca'> "; | |
| 418 | - } | |
| 419 | - else { | |
| 420 | - $retorno .= " <input type='button' class='botaolistagem' onclick='javascript:acao{$this->funcAcaoNome}();' value='busca' id='botao_busca'> "; | |
| 420 | + if ($this->exibirBotaoSubmit) { | |
| 421 | + if ($this->botao_submit) { | |
| 422 | + $retorno .= " <input type='submit' class='botaolistagem' value='busca' id='botao_busca'> "; | |
| 423 | + } | |
| 424 | + else { | |
| 425 | + $retorno .= " <input type='button' class='botaolistagem' onclick='javascript:acao{$this->funcAcaoNome}();' value='busca' id='botao_busca'> "; | |
| 426 | + } | |
| 421 | 427 | } |
| 422 | 428 | |
| 423 | 429 | $retorno .= " |
| ... | ... | @@ -725,6 +731,8 @@ class clsListagem extends clsCampos |
| 725 | 731 | "; |
| 726 | 732 | } |
| 727 | 733 | |
| 734 | + Portabilis_View_Helper_Application::embedJavascriptToFixupFieldsWidth($this); | |
| 735 | + | |
| 728 | 736 | return $retorno; |
| 729 | 737 | } |
| 730 | 738 | |
| ... | ... | @@ -737,4 +745,4 @@ class clsListagem extends clsCampos |
| 737 | 745 | { |
| 738 | 746 | die("<div style='width: 300px; height: 100px; font: 700 11px Arial,Helv,Sans; background-color: #f6f6f6; color: #e11; position: absolute; left: 50%; top: 50%; margin-top: -20px; margin-left: -100px; text-align: center; border: solid 1px #a1a1f1;'>{$msg}</div><script>setTimeout('window.location=\'$redir\'',5000);</script>"); |
| 739 | 747 | } |
| 740 | -} | |
| 741 | 748 | \ No newline at end of file |
| 749 | +} | ... | ... |