educar_transferencia_solicitacao_cad.php
9.29 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* @author Prefeitura Municipal de Itajaí *
* @updated 29/03/2007 *
* Pacote: i-PLB Software Público Livre e Brasileiro *
* *
* Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
* ctima@itajai.sc.gov.br *
* *
* 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 mais nova. *
* *
* Este programa é distribuído na expectativa de ser útil, mas SEM *
* QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
* ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
* sulte a Licença Pública Geral GNU para obter mais detalhes. *
* *
* Você deve ter recebido uma cópia da Licença Pública Geral GNU *
* junto com este programa. Se não, escreva para a Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
* 02111-1307, USA. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
require_once ("include/clsBase.inc.php");
require_once ("include/clsCadastro.inc.php");
require_once ("include/clsBanco.inc.php");
require_once( "include/pmieducar/geral.inc.php" );
class clsIndexBase extends clsBase
{
function Formular()
{
$this->SetTitulo( "{$this->_instituicao} i-Educar - Transferência Solicitação" );
$this->processoAp = "578";
}
}
class indice extends clsCadastro
{
/**
* Referencia pega da session para o idpes do usuario atual
*
* @var int
*/
var $pessoa_logada;
var $cod_transferencia_solicitacao;
var $ref_cod_transferencia_tipo;
var $ref_usuario_exc;
var $ref_usuario_cad;
var $ref_cod_matricula_entrada;
var $ref_cod_matricula_saida;
var $observacao;
var $data_cadastro;
var $data_exclusao;
var $ativo;
var $data_transferencia;
var $ref_cod_matricula;
var $transferencia_tipo;
var $ref_cod_aluno;
var $nm_aluno;
function Inicializar()
{
$retorno = "Novo";
@session_start();
$this->pessoa_logada = $_SESSION['id_pessoa'];
@session_write_close();
$this->ref_cod_matricula=$_GET["ref_cod_matricula"];
$this->ref_cod_aluno=$_GET["ref_cod_aluno"];
$cancela=$_GET["cancela"];
$obj_permissoes = new clsPermissoes();
$obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}" );
if ( is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_aluno ) && ($cancela == true) )
{
if( $obj_permissoes->permissao_excluir( 578, $this->pessoa_logada, 7 ) )
{
$this->Excluir();
}
}
$this->url_cancelar = "educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}";
$this->nome_url_cancelar = "Cancelar";
return $retorno;
}
function Gerar()
{
// primary keys
$this->campoOculto( "ref_cod_aluno", $this->ref_cod_aluno );
$this->campoOculto( "ref_cod_matricula", $this->ref_cod_matricula );
$obj_aluno = new clsPmieducarAluno();
$lst_aluno = $obj_aluno->lista( $this->ref_cod_aluno,null,null,null,null,null,null,null,null,null,1 );
if ( is_array($lst_aluno) )
{
$det_aluno = array_shift($lst_aluno);
$this->nm_aluno = $det_aluno["nome_aluno"];
$this->campoTexto( "nm_aluno", "Aluno", $this->nm_aluno, 30, 255, false,false,false,"","","","",true );
}
$obj_matricula = new clsPmieducarMatricula($this->ref_cod_matricula);
$det_matricula = $obj_matricula->detalhe();
$ref_cod_escola = $det_matricula['ref_ref_cod_escola'];
$opcoes = array( 1 => "Escola do Sistema",2 => "Escola Externa" );
$this->campoRadio( "transferencia_tipo", "Transferência Tipo", $opcoes, $this->transferencia_tipo );
// foreign keys
$opcoes = array( "" => "Selecione" );
if( class_exists( "clsPmieducarTransferenciaTipo" ) )
{
$objTemp = new clsPmieducarTransferenciaTipo();
$lista = $objTemp->lista(null,null,null,null,null,null,null,null,null,null,$ref_cod_escola);
if ( is_array( $lista ) && count( $lista ) )
{
foreach ( $lista as $registro )
{
$opcoes["{$registro['cod_transferencia_tipo']}"] = "{$registro['nm_tipo']}";
}
}
}
else
{
echo "<!--\nErro\nClasse clsPmieducarTransferenciaTipo nao encontrada\n-->";
$opcoes = array( "" => "Erro na geracao" );
}
$this->campoLista( "ref_cod_transferencia_tipo", "Transferência Motivo", $opcoes, $this->ref_cod_transferencia_tipo );
// text
$this->campoMemo( "observacao", "Observação", $this->observacao, 60, 5, false );
}
function Novo()
{
@session_start();
$this->pessoa_logada = $_SESSION['id_pessoa'];
@session_write_close();
$obj_permissoes = new clsPermissoes();
$obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}" );
// $obj_matricula = new clsPmieducarMatricula();
// $lst_matricula = $obj_matricula->lista( null,null,null,null,null,null,$this->ref_cod_aluno,null,null,null,null,null,1 );
// if ( is_array($lst_matricula) )
// {
// $det_matricula = array_shift($lst_matricula);
// $this->ref_cod_matricula_saida = $det_matricula["cod_matricula"];
if ($this->transferencia_tipo == 2)
{
$this->data_transferencia = date("Y-m-d");
$this->ativo = 1;
$obj_matricula = new clsPmieducarMatricula( $this->ref_cod_matricula );
$det_matricula = $obj_matricula->detalhe();
$aprovado = $det_matricula["aprovado"];
if ($aprovado == 3)
{
$obj = new clsPmieducarMatricula( $this->ref_cod_matricula, null,null,null,$this->pessoa_logada,null,null,4,null,null,1 );
$editou = $obj->edita();
if( !$editou )
{
$this->mensagem = "Não foi possível editar a Matrícula do Aluno.<br>";
return false;
}
$obj_matricula_turma = new clsPmieducarMatriculaTurma();
$lst_matricula_turma = $obj_matricula_turma->lista( $this->ref_cod_matricula, null, null, null, null, null, null, null, 1 );
if( $lst_matricula_turma )
{
$det_matricula_turma = array_shift($lst_matricula_turma);
$obj_matricula_turma = new clsPmieducarMatriculaTurma( $this->ref_cod_matricula, $det_matricula_turma['ref_cod_turma'], $this->pessoa_logada, null, null, null, 0, null, $det_matricula_turma['sequencial'] );
if( !$obj_matricula_turma->edita() )
{
$this->mensagem = "Não foi possível desativar a Matrícula Turma do Aluno.<br>";
return false;
}
}
}
}
$obj = new clsPmieducarTransferenciaSolicitacao( null, $this->ref_cod_transferencia_tipo, null, $this->pessoa_logada, null, $this->ref_cod_matricula, $this->observacao, null, null, $this->ativo, $this->data_transferencia );
$cadastrou = $obj->cadastra();
if( $cadastrou )
{
$this->mensagem .= "Cadastro efetuado com sucesso.<br>";
header( "Location: educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}" );
die();
return true;
}
// }
// else
// {
// $this->mensagem = "Não foi possível encontrar a Matrícula do Aluno.<br>";
// return false;
// }
$this->mensagem = "Cadastro não realizado.<br>";
echo "<!--\nErro ao cadastrar clsPmieducarTransferenciaSolicitacao\nvalores obrigatorios\nis_numeric( $this->ref_cod_transferencia_tipo ) && is_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_cod_aluno )\n-->";
return false;
}
function Excluir()
{
@session_start();
$this->pessoa_logada = $_SESSION['id_pessoa'];
@session_write_close();
$obj_permissoes = new clsPermissoes();
$obj_permissoes->permissao_excluir( 578, $this->pessoa_logada, 7, "educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}" );
$obj_transferencia = new clsPmieducarTransferenciaSolicitacao();
$lst_transferencia = $obj_transferencia->lista( null,null,null,null,null,$this->ref_cod_matricula,null,null,null,null,null,1,null,null,$this->ref_cod_aluno,false );
if ( is_array($lst_transferencia) )
{
$det_transferencia = array_shift($lst_transferencia);
$this->cod_transferencia_solicitacao = $det_transferencia["cod_transferencia_solicitacao"];
$obj = new clsPmieducarTransferenciaSolicitacao($this->cod_transferencia_solicitacao, null, $this->pessoa_logada, null,null,null,null,null,null,0 );
$excluiu = $obj->excluir();
if( $excluiu )
{
$this->mensagem .= "Exclusão efetuada com sucesso.<br>";
header( "Location: educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}" );
die();
return true;
}
}
else
{
$this->mensagem = "Não foi possível encontrar a Solicitação de Transferência do Aluno.<br>";
return false;
}
$this->mensagem = "Exclusão não realizada.<br>";
echo "<!--\nErro ao excluir clsPmieducarTransferenciaSolicitacao\nvalores obrigatorios\nif( is_numeric( $this->cod_transferencia_solicitacao ) && is_numeric( $this->pessoa_logada ) )\n-->";
return false;
}
}
// 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();
?>