educar_deficiencia_cad_pop.php
3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
require_once ("include/clsBase.inc.php");
require_once ("include/clsCadastro.inc.php");
require_once ("include/clsBanco.inc.php");
require_once( "include/Geral.inc.php" );
require_once( "include/pmieducar/geral.inc.php" );
class clsIndexBase extends clsBase
{
function Formular()
{
$this->SetTitulo( "{$this->_instituicao} i-Educar - Deficiência" );
$this->processoAp = "631";
$this->renderBanner = false;
$this->renderMenu = false;
$this->renderMenuSuspenso = false;
}
}
class indice extends clsCadastro
{
/**
* Referencia pega da session para o idpes do usuario atual
*
* @var int
*/
var $pessoa_logada;
var $cod_deficiencia;
var $nm_deficiencia;
function Inicializar()
{
$retorno = "Novo";
$this->cod_deficiencia=$_GET["cod_deficiencia"];
$obj_permissoes = new clsPermissoes();
$obj_permissoes->permissao_cadastra( 631, $this->pessoa_logada, 7, "educar_deficiencia_lst.php" );
if( is_numeric( $this->cod_deficiencia ) )
{
$obj = new clsCadastroDeficiencia( $this->cod_deficiencia );
$registro = $obj->detalhe();
if( $registro )
{
foreach( $registro AS $campo => $val ) // passa todos os valores obtidos no registro para atributos do objeto
$this->$campo = $val;
if( $obj_permissoes->permissao_excluir( 631, $this->pessoa_logada, 7 ) )
{
$this->fexcluir = true;
}
$retorno = "Editar";
}
}
// $this->url_cancelar = ($retorno == "Editar") ? "educar_deficiencia_det.php?cod_deficiencia={$registro["cod_deficiencia"]}" : "educar_deficiencia_lst.php";
$this->nome_url_cancelar = "Cancelar";
$this->script_cancelar = "window.parent.fechaExpansivel(\"div_dinamico_\"+(parent.DOM_divs.length-1));";
return $retorno;
}
function Gerar()
{
// primary keys
$this->campoOculto( "cod_deficiencia", $this->cod_deficiencia );
// foreign keys
// text
$this->campoTexto( "nm_deficiencia", "Deficiência", $this->nm_deficiencia, 30, 255, true );
// data
}
function Novo()
{
$obj = new clsCadastroDeficiencia( $this->cod_deficiencia, $this->nm_deficiencia );
$cadastrou = $obj->cadastra();
if( $cadastrou )
{
echo "<script>
parent.document.getElementById('ref_cod_deficiencia').options[parent.document.getElementById('ref_cod_deficiencia').options.length] = new Option('$this->nm_deficiencia', '$cadastrou', false, false);
parent.document.getElementById('ref_cod_deficiencia').value = '$cadastrou';
window.parent.fechaExpansivel('div_dinamico_'+(parent.DOM_divs.length-1));
</script>";
die();
}
$this->mensagem = "Cadastro não realizado.<br>";
return false;
}
function Editar()
{
}
function Excluir()
{
}
}
// cria uma extensao da classe base
$pagina = new clsIndexBase();
// cria o conteudo
$miolo = new indice();
// adiciona o conteudo na clsBase
$pagina->addForm( $miolo );
// gera o html
$pagina->MakeAll();
?>