Commit c08cdee3801fe13da781c00d7ef6eb6a0c9f5290
1 parent
f08cbf14
Exists in
master
Refactoring para coding standards
Showing
4 changed files
with
1427 additions
and
1485 deletions
Show diff stats
ieducar/intranet/educar_dispensa_disciplina_cad.php
1 | 1 | <?php |
2 | + | |
2 | 3 | /** |
4 | + * i-Educar - Sistema de gestão escolar | |
3 | 5 | * |
4 | - * @version SVN: $Id$ | |
5 | - * @author Prefeitura Municipal de Itajaí | |
6 | - * @updated 29/03/2007 | |
7 | - * Pacote: i-PLB Software Público Livre e Brasileiro | |
8 | - * | |
9 | - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí | |
10 | - * ctima@itajai.sc.gov.br | |
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
7 | + * <ctima@itajai.sc.gov.br> | |
11 | 8 | * |
12 | - * Este programa é software livre, você pode redistribuí-lo e/ou | |
13 | - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme | |
14 | - * publicada pela Free Software Foundation, tanto a versão 2 da | |
15 | - * Licença como (a seu critério) qualquer versão mais nova. | |
9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
12 | + * qualquer versão posterior. | |
16 | 13 | * |
17 | - * Este programa é distribuído na expectativa de ser útil, mas SEM | |
18 | - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- | |
19 | - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- | |
20 | - * sulte a Licença Pública Geral GNU para obter mais detalhes. | |
14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
17 | + * do GNU para mais detalhes. | |
21 | 18 | * |
22 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU | |
23 | - * junto com este programa. Se não, escreva para a Free Software | |
24 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
25 | - * 02111-1307, USA. | |
19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
26 | 22 | * |
23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package iEd_Pmieducar | |
27 | + * @since Arquivo disponível desde a versão 1.0.0 | |
28 | + * @version $Id$ | |
27 | 29 | */ |
28 | 30 | |
29 | -require_once('include/clsBase.inc.php'); | |
30 | -require_once('include/clsCadastro.inc.php'); | |
31 | -require_once('include/clsBanco.inc.php'); | |
32 | -require_once('include/pmieducar/geral.inc.php'); | |
31 | +require_once 'include/clsBase.inc.php'; | |
32 | +require_once 'include/clsCadastro.inc.php'; | |
33 | +require_once 'include/clsBanco.inc.php'; | |
34 | +require_once 'include/pmieducar/geral.inc.php'; | |
33 | 35 | |
36 | +/** | |
37 | + * clsIndexBase class. | |
38 | + * | |
39 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
40 | + * @category i-Educar | |
41 | + * @license @@license@@ | |
42 | + * @package iEd_Pmieducar | |
43 | + * @since Classe disponível desde a versão 1.0.0 | |
44 | + * @version @@package_version@@ | |
45 | + */ | |
34 | 46 | class clsIndexBase extends clsBase |
35 | 47 | { |
36 | - function Formular() | |
37 | - { | |
38 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Dispensa Disciplina" ); | |
39 | - $this->processoAp = "578"; | |
40 | - } | |
48 | + function Formular() | |
49 | + { | |
50 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Disciplina'); | |
51 | + $this->processoAp = 578; | |
52 | + } | |
41 | 53 | } |
42 | 54 | |
55 | +/** | |
56 | + * indice class. | |
57 | + * | |
58 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
59 | + * @category i-Educar | |
60 | + * @license @@license@@ | |
61 | + * @package iEd_Pmieducar | |
62 | + * @since Classe disponível desde a versão 1.0.0 | |
63 | + * @version @@package_version@@ | |
64 | + */ | |
43 | 65 | class indice extends clsCadastro |
44 | 66 | { |
45 | - /** | |
46 | - * Referencia pega da session para o idpes do usuario atual | |
47 | - * | |
48 | - * @var int | |
49 | - */ | |
50 | - var $pessoa_logada; | |
51 | - | |
52 | - /*var $ref_ref_cod_turma; | |
53 | - var $ref_ref_cod_matricula;*/ | |
54 | - | |
55 | - /*var $disc_ref_ref_cod_turma; | |
56 | - var $disc_ref_ref_cod_serie; | |
57 | - var $disc_ref_ref_cod_escola; | |
58 | - var $disc_ref_ref_cod_disciplina; | |
59 | - */ | |
60 | - var $ref_usuario_exc; | |
61 | - var $ref_usuario_cad; | |
62 | - var $ref_cod_tipo_dispensa; | |
63 | - var $data_cadastro; | |
64 | - var $data_exclusao; | |
65 | - var $ativo; | |
66 | - var $observacao; | |
67 | - | |
68 | - var $ref_cod_matricula; | |
69 | - var $ref_cod_turma; | |
70 | - var $ref_cod_serie; | |
71 | - var $ref_cod_disciplina; | |
72 | - var $ref_sequencial; | |
73 | - var $ref_cod_instituicao; | |
74 | - var $ref_cod_escola; | |
75 | - | |
76 | - function Inicializar() | |
77 | - { | |
78 | - $retorno = "Novo"; | |
79 | - @session_start(); | |
80 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
81 | - @session_write_close(); | |
82 | - | |
83 | - $this->ref_cod_disciplina = $_GET["ref_cod_disciplina"]; | |
84 | - $this->ref_cod_matricula = $_GET['ref_cod_matricula']; | |
85 | - | |
86 | - $obj_permissoes = new clsPermissoes(); | |
87 | - $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_dispensa_disciplina_lst.php?ref_ref_cod_matricula={$this->ref_cod_matricula}" ); | |
88 | - | |
89 | - if (is_numeric($this->ref_cod_matricula)) | |
90 | - { | |
91 | - $obj_matricula = new clsPmieducarMatricula($this->ref_cod_matricula,null,null,null,null,null,null,null,null,null,1); | |
92 | - $det_matricula = $obj_matricula->detalhe(); | |
93 | - if(!$det_matricula) | |
94 | - { | |
95 | - header("location: educar_matricula_lst.php"); | |
96 | - die; | |
97 | - } | |
98 | - | |
99 | - $this->ref_cod_escola = $det_matricula['ref_ref_cod_escola']; | |
100 | - $this->ref_cod_serie = $det_matricula['ref_ref_cod_serie']; | |
101 | - } | |
102 | - else | |
103 | - { | |
104 | - header("location: educar_matricula_lst.php"); | |
105 | - die; | |
106 | - } | |
107 | - | |
108 | - if (is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) ) | |
109 | - { | |
110 | - $obj = new clsPmieducarDispensaDisciplina( $this->ref_cod_matricula, $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina ); | |
111 | - $registro = $obj->detalhe(); | |
112 | - if ($registro) | |
113 | - { | |
114 | - foreach ($registro as $campo => $val) // passa todos os valores obtidos no registro para atributos do objeto | |
115 | - { | |
67 | + var $pessoa_logada; | |
68 | + | |
69 | + var $ref_usuario_exc; | |
70 | + var $ref_usuario_cad; | |
71 | + var $ref_cod_tipo_dispensa; | |
72 | + var $data_cadastro; | |
73 | + var $data_exclusao; | |
74 | + var $ativo; | |
75 | + var $observacao; | |
76 | + | |
77 | + var $ref_cod_matricula; | |
78 | + var $ref_cod_turma; | |
79 | + var $ref_cod_serie; | |
80 | + var $ref_cod_disciplina; | |
81 | + var $ref_sequencial; | |
82 | + var $ref_cod_instituicao; | |
83 | + var $ref_cod_escola; | |
84 | + | |
85 | + function Inicializar() | |
86 | + { | |
87 | + $retorno = 'Novo'; | |
88 | + @session_start(); | |
89 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
90 | + @session_write_close(); | |
91 | + | |
92 | + $this->ref_cod_disciplina = $_GET['ref_cod_disciplina']; | |
93 | + $this->ref_cod_matricula = $_GET['ref_cod_matricula']; | |
94 | + | |
95 | + $obj_permissoes = new clsPermissoes(); | |
96 | + $obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7, | |
97 | + 'educar_dispensa_disciplina_lst.php?ref_ref_cod_matricula=' . $this->ref_cod_matricula); | |
98 | + | |
99 | + if (is_numeric($this->ref_cod_matricula)) { | |
100 | + $obj_matricula = new clsPmieducarMatricula($this->ref_cod_matricula, NULL, | |
101 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
102 | + | |
103 | + $det_matricula = $obj_matricula->detalhe(); | |
104 | + | |
105 | + if (!$det_matricula) { | |
106 | + header('Location: educar_matricula_lst.php'); | |
107 | + die(); | |
108 | + } | |
109 | + | |
110 | + $this->ref_cod_escola = $det_matricula['ref_ref_cod_escola']; | |
111 | + $this->ref_cod_serie = $det_matricula['ref_ref_cod_serie']; | |
112 | + } | |
113 | + else { | |
114 | + header('Location: educar_matricula_lst.php'); | |
115 | + die(); | |
116 | + } | |
117 | + | |
118 | + if (is_numeric($this->ref_cod_matricula) && is_numeric($this->ref_cod_serie) && | |
119 | + is_numeric($this->ref_cod_escola) && is_numeric($this->ref_cod_disciplina) | |
120 | + ) { | |
121 | + $obj = new clsPmieducarDispensaDisciplina($this->ref_cod_matricula, | |
122 | + $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina); | |
123 | + | |
124 | + $registro = $obj->detalhe(); | |
125 | + | |
126 | + if ($registro) { | |
127 | + // passa todos os valores obtidos no registro para atributos do objeto | |
128 | + foreach ($registro as $campo => $val) { | |
116 | 129 | $this->$campo = $val; |
117 | 130 | } |
118 | 131 | |
119 | - $obj_permissoes = new clsPermissoes(); | |
120 | - if ($obj_permissoes->permissao_excluir(578, $this->pessoa_logada, 7)) | |
121 | - { | |
122 | - $this->fexcluir = true; | |
123 | - } | |
124 | - | |
125 | - $retorno = "Editar"; | |
126 | - } | |
127 | - } | |
128 | - | |
129 | - $this->url_cancelar = ($retorno == "Editar") ? "educar_dispensa_disciplina_det.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_serie={$registro["ref_cod_serie"]}&ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}" : "educar_dispensa_disciplina_lst.php?ref_cod_matricula={$this->ref_cod_matricula}"; | |
130 | - $this->nome_url_cancelar = "Cancelar"; | |
131 | - return $retorno; | |
132 | - } | |
133 | - | |
134 | - function Gerar() | |
135 | - { | |
136 | - /** | |
137 | - * Busca dados da matricula | |
138 | - */ | |
139 | - if( class_exists( "clsPmieducarMatricula" ) ) | |
140 | - { | |
141 | - $obj_ref_cod_matricula = new clsPmieducarMatricula(); | |
142 | - $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista($this->ref_cod_matricula)); | |
143 | - } | |
144 | - else | |
145 | - { | |
146 | - $registro["ref_cod_matricula"] = "Erro na geracao"; | |
147 | - echo "<!--\nErro\nClasse nao existente: clsPmieducarMatricula\n-->"; | |
148 | - } | |
149 | - | |
150 | -// echo "<pre>";print_r($detalhe_aluno); | |
151 | - | |
152 | - $obj_aluno = new clsPmieducarAluno(); | |
153 | - $det_aluno = array_shift($det_aluno = $obj_aluno->lista($detalhe_aluno['ref_cod_aluno'],null,null,null,null,null,null,null,null,null,1)); | |
154 | - | |
155 | - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola,null,null,null,null,null,null,null,null,null,1); | |
156 | - $det_escola = $obj_escola->detalhe(); | |
157 | - $this->ref_cod_instituicao = $det_escola["ref_cod_instituicao"]; | |
158 | - | |
159 | - | |
160 | - $this->campoRotulo("nm_aluno","Nome do Aluno",$det_aluno['nome_aluno']); | |
161 | - | |
162 | -// echo $this->ref_cod_matricula; | |
163 | -// echo $this->ref_cod_turma; | |
164 | - $obj_matricula_turma = new clsPmieducarMatriculaTurma(); | |
165 | - $lst_matricula_turma = $obj_matricula_turma->lista( $this->ref_cod_matricula,null,null,null,null,null,null,null,1,$this->ref_cod_serie,null,$this->ref_cod_escola ); | |
166 | - if (is_array($lst_matricula_turma)) | |
167 | - { | |
168 | - $det = array_shift($lst_matricula_turma); | |
169 | - $this->ref_cod_turma = $det["ref_cod_turma"]; | |
170 | - $this->ref_sequencial = $det["sequencial"]; | |
171 | - | |
172 | - } | |
173 | -// echo $this->ref_cod_turma; | |
174 | -// echo "seq".$this->ref_sequencial; | |
175 | - | |
176 | - /** | |
177 | - * | |
178 | - */ | |
179 | - | |
180 | - // primary keys | |
181 | - //$this->campoOculto( "ref_cod_turma", $this->ref_ref_cod_turma ); | |
182 | - $this->campoOculto( "ref_cod_matricula", $this->ref_cod_matricula ); | |
183 | -// $this->campoOculto( "ref_cod_turma", $this->ref_cod_turma ); | |
184 | - $this->campoOculto( "ref_cod_serie", $this->ref_cod_serie ); | |
185 | - $this->campoOculto( "ref_cod_escola", $this->ref_cod_escola ); | |
186 | -// $this->campoOculto( "ref_sequencial", $this->ref_sequencial ); | |
187 | - | |
188 | - $opcoes = array( "" => "Selecione" ); | |
189 | - if( class_exists( "clsPmieducarEscolaSerieDisciplina" ) ) | |
190 | - { | |
191 | - $objTemp = new clsPmieducarEscolaSerieDisciplina(); | |
192 | - $lista = $objTemp->lista( $this->ref_cod_serie,$this->ref_cod_escola,null,1 ); | |
193 | - if ( is_array( $lista ) && count( $lista ) ) | |
194 | - { | |
195 | - foreach ( $lista as $registro ) | |
196 | - { | |
197 | - $obj_disciplina = new clsPmieducarDisciplina($registro['ref_cod_disciplina'],null,null,null,null,null,null,null,null,null,1); | |
198 | - $det_disciplina = $obj_disciplina->detalhe(); | |
199 | - $opcoes["{$registro['ref_cod_disciplina']}"] = "{$det_disciplina['nm_disciplina']}"; | |
200 | - } | |
201 | - } | |
202 | - } | |
203 | - else | |
204 | - { | |
205 | - echo "<!--\nErro\nClasse clsPmieducarTurmaDisciplina nao encontrada\n-->"; | |
206 | - $opcoes = array( "" => "Erro na geracao" ); | |
207 | - } | |
208 | - if ($this->ref_cod_disciplina) | |
209 | - { | |
210 | - $this->campoRotulo( "nm_disciplina", "Disciplina", $opcoes[$this->ref_cod_disciplina] ); | |
211 | - $this->campoOculto( "ref_cod_disciplina", $this->ref_cod_disciplina ); | |
212 | - } | |
213 | - else | |
214 | - $this->campoLista( "ref_cod_disciplina", "Disciplina", $opcoes, $this->ref_cod_disciplina ); | |
215 | - | |
216 | - $opcoes = array( "" => "Selecione" ); | |
217 | - if( class_exists( "clsPmieducarTipoDispensa" ) ) | |
218 | - { | |
219 | - $objTemp = new clsPmieducarTipoDispensa(); | |
220 | - if ($this->ref_cod_instituicao) | |
221 | - $lista = $objTemp->lista( null,null,null,null,null,null,null,null,null,1,$this->ref_cod_instituicao ); | |
222 | - else | |
223 | - $lista = $objTemp->lista( null,null,null,null,null,null,null,null,null,1 ); | |
224 | - if ( is_array( $lista ) && count( $lista ) ) | |
225 | - { | |
226 | - foreach ( $lista as $registro ) | |
227 | - { | |
228 | - $opcoes["{$registro['cod_tipo_dispensa']}"] = "{$registro['nm_tipo']}"; | |
229 | - } | |
230 | - } | |
231 | - } | |
232 | - else | |
233 | - { | |
234 | - echo "<!--\nErro\nClasse clsPmieducarTipoDispensa nao encontrada\n-->"; | |
235 | - $opcoes = array( "" => "Erro na geracao" ); | |
236 | - } | |
237 | - $this->campoLista( "ref_cod_tipo_dispensa", "Tipo Dispensa", $opcoes, $this->ref_cod_tipo_dispensa ); | |
238 | - | |
239 | - // text | |
240 | - $this->campoMemo( "observacao", "Observação", $this->observacao, 60, 10, false ); | |
241 | - | |
242 | - // data | |
243 | - | |
244 | - } | |
245 | - | |
246 | - function Novo() | |
247 | - { | |
248 | - @session_start(); | |
249 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
250 | - @session_write_close(); | |
251 | - | |
252 | - $obj_permissoes = new clsPermissoes(); | |
253 | - $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_dispensa_disciplina_lst.php?ref_cod_matricula={$this->ref_cod_matricula}" ); | |
254 | - | |
255 | - $sql = "SELECT MAX(cod_dispensa) + 1 FROM pmieducar.dispensa_disciplina"; | |
256 | - $db = new clsBanco(); | |
257 | - $max_cod_dispensa = $db->CampoUnico($sql); | |
258 | - | |
259 | - // Caso não exista nenhuma dispensa, atribui o código 1, tabela não utiliza sequences | |
260 | - $max_cod_dispensa = $max_cod_dispensa > 0 ? $max_cod_dispensa : 1; | |
261 | - | |
262 | - $obj = new clsPmieducarDispensaDisciplina( $this->ref_cod_matricula, $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina, null, $this->pessoa_logada, $this->ref_cod_tipo_dispensa, null, null, 1, $this->observacao, $max_cod_dispensa ); | |
263 | - if($obj->existe()) | |
264 | - { | |
265 | - $obj = new clsPmieducarDispensaDisciplina( $this->ref_cod_matricula, $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina, $this->pessoa_logada, null, $this->ref_cod_tipo_dispensa, null, null, 1, $this->observacao ); | |
266 | - $obj->edita(); | |
267 | - header( "Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula={$this->ref_cod_matricula}" ); | |
268 | - die(); | |
269 | - } | |
270 | - | |
271 | - $cadastrou = $obj->cadastra(); | |
272 | - if( $cadastrou ) | |
273 | - { | |
274 | - $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; | |
275 | - header( "Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula={$this->ref_cod_matricula}" ); | |
276 | - die(); | |
277 | - return true; | |
278 | - } | |
279 | - | |
280 | - $this->mensagem = "Cadastro não realizado.<br>"; | |
281 | - echo "<!--\nErro ao cadastrar clsPmieducarDispensaDisciplina\nvalores obrigatorios\n is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) && is_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_cod_tipo_dispensa )\n-->"; | |
282 | - return false; | |
283 | - } | |
284 | - | |
285 | - function Editar() | |
286 | - { | |
287 | - @session_start(); | |
288 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
289 | - @session_write_close(); | |
290 | - | |
291 | - $obj_permissoes = new clsPermissoes(); | |
292 | - $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "educar_dispensa_disciplina_lst.php?ref_cod_matricula={$this->ref_cod_matricula}" ); | |
293 | - | |
294 | - $obj = new clsPmieducarDispensaDisciplina( $this->ref_cod_matricula, $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina, $this->pessoa_logada, null, $this->ref_cod_tipo_dispensa, null, null, 1, $this->observacao); | |
295 | - $editou = $obj->edita(); | |
296 | - if( $editou ) | |
297 | - { | |
298 | - $this->mensagem .= "Edição efetuada com sucesso.<br>"; | |
299 | - header( "Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula={$this->ref_cod_matricula}" ); | |
300 | - die(); | |
301 | - return true; | |
302 | - } | |
303 | - | |
304 | - $this->mensagem = "Edição não realizada.<br>"; | |
305 | - echo "<!--\nErro ao editar clsPmieducarDispensaDisciplina\nvalores obrigatorios\nif( is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) && is_numeric( $this->pessoa_logada ) )\n-->"; | |
306 | - return false; | |
307 | - } | |
308 | - | |
309 | - function Excluir() | |
310 | - { | |
311 | - @session_start(); | |
312 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
313 | - @session_write_close(); | |
314 | - | |
315 | - $obj_permissoes = new clsPermissoes(); | |
316 | - $obj_permissoes->permissao_excluir( 578, $this->pessoa_logada, 7, "educar_dispensa_disciplina_lst.php?ref_cod_matricula={$this->ref_cod_matricula}" ); | |
317 | - | |
318 | - | |
319 | - $obj = new clsPmieducarDispensaDisciplina( $this->ref_cod_matricula, $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina, $this->pessoa_logada, null, $this->ref_cod_tipo_dispensa, null, null, 0, $this->observacao ); | |
320 | - $excluiu = $obj->excluir(); | |
321 | - if( $excluiu ) | |
322 | - { | |
323 | - $this->mensagem .= "Exclusão efetuada com sucesso.<br>"; | |
324 | - header( "Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula={$this->ref_cod_matricula}" ); | |
325 | - die(); | |
326 | - return true; | |
327 | - } | |
328 | - | |
329 | - $this->mensagem = "Exclusão não realizada.<br>"; | |
330 | - echo "<!--\nErro ao excluir clsPmieducarDispensaDisciplina\nvalores obrigatorios\nif( is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) && is_numeric( $this->pessoa_logada ) )\n-->"; | |
331 | - return false; | |
332 | - } | |
132 | + $obj_permissoes = new clsPermissoes(); | |
133 | + | |
134 | + if ($obj_permissoes->permissao_excluir(578, $this->pessoa_logada, 7)) { | |
135 | + $this->fexcluir = TRUE; | |
136 | + } | |
137 | + | |
138 | + $retorno = 'Editar'; | |
139 | + } | |
140 | + } | |
141 | + | |
142 | + $this->url_cancelar = $retorno == 'Editar' ? | |
143 | + sprintf('educar_dispensa_disciplina_det.php?ref_cod_matricula=%d&ref_cod_serie=%d&ref_cod_escola=%d&ref_cod_disciplina=%d', | |
144 | + $registro['ref_cod_matricula'], $registro['ref_cod_serie'], | |
145 | + $registro['ref_cod_escola'], $registro['ref_cod_disciplina']) : | |
146 | + 'educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula; | |
147 | + | |
148 | + $this->nome_url_cancelar = 'Cancelar'; | |
149 | + return $retorno; | |
150 | + } | |
151 | + | |
152 | + function Gerar() | |
153 | + { | |
154 | + /** | |
155 | + * Busca dados da matricula | |
156 | + */ | |
157 | + if (class_exists('clsPmieducarMatricula')) { | |
158 | + $obj_ref_cod_matricula = new clsPmieducarMatricula(); | |
159 | + $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista( | |
160 | + $this->ref_cod_matricula) | |
161 | + ); | |
162 | + } | |
163 | + else { | |
164 | + $registro['ref_cod_matricula'] = 'Erro na geracao'; | |
165 | + echo "<!--\nErro\nClasse nao existente: clsPmieducarMatricula\n-->"; | |
166 | + } | |
167 | + | |
168 | + $obj_aluno = new clsPmieducarAluno(); | |
169 | + $det_aluno = array_shift($det_aluno = $obj_aluno->lista($detalhe_aluno['ref_cod_aluno'], | |
170 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1)); | |
171 | + | |
172 | + $obj_escola = new clsPmieducarEscola($this->ref_cod_escola, NULL, NULL, NULL, | |
173 | + NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
174 | + | |
175 | + $det_escola = $obj_escola->detalhe(); | |
176 | + $this->ref_cod_instituicao = $det_escola["ref_cod_instituicao"]; | |
177 | + | |
178 | + $this->campoRotulo("nm_aluno", "Nome do Aluno", $det_aluno['nome_aluno']); | |
179 | + | |
180 | + $obj_matricula_turma = new clsPmieducarMatriculaTurma(); | |
181 | + $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, | |
182 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie, NULL, | |
183 | + $this->ref_cod_escola); | |
184 | + | |
185 | + if (is_array($lst_matricula_turma)) { | |
186 | + $det = array_shift($lst_matricula_turma); | |
187 | + $this->ref_cod_turma = $det['ref_cod_turma']; | |
188 | + $this->ref_sequencial = $det['sequencial']; | |
189 | + } | |
190 | + | |
191 | + // primary keys | |
192 | + $this->campoOculto('ref_cod_matricula', $this->ref_cod_matricula); | |
193 | + $this->campoOculto('ref_cod_serie', $this->ref_cod_serie); | |
194 | + $this->campoOculto('ref_cod_escola', $this->ref_cod_escola); | |
195 | + | |
196 | + $opcoes = array('' => 'Selecione'); | |
197 | + if (class_exists('clsPmieducarEscolaSerieDisciplina')) { | |
198 | + $objTemp = new clsPmieducarEscolaSerieDisciplina(); | |
199 | + $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1); | |
200 | + | |
201 | + if (is_array($lista) && count($lista)) { | |
202 | + foreach ($lista as $registro) { | |
203 | + $obj_disciplina = new clsPmieducarDisciplina( | |
204 | + $registro['ref_cod_disciplina'], NULL, NULL, NULL, NULL, NULL, NULL, | |
205 | + NULL, NULL, NULL, 1); | |
206 | + | |
207 | + $det_disciplina = $obj_disciplina->detalhe(); | |
208 | + $opcoes[$registro['ref_cod_disciplina']] = $det_disciplina['nm_disciplina']; | |
209 | + } | |
210 | + } | |
211 | + } | |
212 | + else { | |
213 | + echo "<!--\nErro\nClasse clsPmieducarTurmaDisciplina nao encontrada\n-->"; | |
214 | + $opcoes = array('' => 'Erro na geracao'); | |
215 | + } | |
216 | + | |
217 | + if ($this->ref_cod_disciplina) { | |
218 | + $this->campoRotulo('nm_disciplina', 'Disciplina', $opcoes[$this->ref_cod_disciplina]); | |
219 | + $this->campoOculto('ref_cod_disciplina', $this->ref_cod_disciplina ); | |
220 | + } | |
221 | + else { | |
222 | + $this->campoLista('ref_cod_disciplina', 'Disciplina', $opcoes, | |
223 | + $this->ref_cod_disciplina); | |
224 | + } | |
225 | + | |
226 | + $opcoes = array('' => 'Selecione'); | |
227 | + | |
228 | + if (class_exists('clsPmieducarTipoDispensa')) { | |
229 | + $objTemp = new clsPmieducarTipoDispensa(); | |
230 | + | |
231 | + if ($this->ref_cod_instituicao) { | |
232 | + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
233 | + NULL, 1, $this->ref_cod_instituicao); | |
234 | + } | |
235 | + else { | |
236 | + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
237 | + } | |
238 | + | |
239 | + if (is_array($lista) && count($lista)) { | |
240 | + foreach ($lista as $registro) { | |
241 | + $opcoes[$registro['cod_tipo_dispensa']] = $registro['nm_tipo']; | |
242 | + } | |
243 | + } | |
244 | + } | |
245 | + else { | |
246 | + echo "<!--\nErro\nClasse clsPmieducarTipoDispensa nao encontrada\n-->"; | |
247 | + $opcoes = array('' => 'Erro na geracao'); | |
248 | + } | |
249 | + | |
250 | + $this->campoLista('ref_cod_tipo_dispensa', 'Tipo Dispensa', $opcoes, | |
251 | + $this->ref_cod_tipo_dispensa); | |
252 | + | |
253 | + $this->campoMemo('observacao', 'Observação', $this->observacao, 60, 10, FALSE); | |
254 | + } | |
255 | + | |
256 | + function Novo() | |
257 | + { | |
258 | + @session_start(); | |
259 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
260 | + @session_write_close(); | |
261 | + | |
262 | + $obj_permissoes = new clsPermissoes(); | |
263 | + $obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7, | |
264 | + 'educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); | |
265 | + | |
266 | + $sql = 'SELECT MAX(cod_dispensa) + 1 FROM pmieducar.dispensa_disciplina'; | |
267 | + $db = new clsBanco(); | |
268 | + $max_cod_dispensa = $db->CampoUnico($sql); | |
269 | + | |
270 | + // Caso não exista nenhuma dispensa, atribui o código 1, tabela não utiliza sequences | |
271 | + $max_cod_dispensa = $max_cod_dispensa > 0 ? $max_cod_dispensa : 1; | |
272 | + | |
273 | + $obj = new clsPmieducarDispensaDisciplina($this->ref_cod_matricula, | |
274 | + $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina, NULL, | |
275 | + $this->pessoa_logada, $this->ref_cod_tipo_dispensa, NULL, NULL, 1, | |
276 | + $this->observacao, $max_cod_dispensa); | |
277 | + | |
278 | + if ($obj->existe()) { | |
279 | + $obj = new clsPmieducarDispensaDisciplina($this->ref_cod_matricula, | |
280 | + $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina, | |
281 | + $this->pessoa_logada, NULL, $this->ref_cod_tipo_dispensa, NULL, NULL, 1, | |
282 | + $this->observacao); | |
283 | + | |
284 | + $obj->edita(); | |
285 | + header('Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); | |
286 | + die(); | |
287 | + } | |
288 | + | |
289 | + $cadastrou = $obj->cadastra(); | |
290 | + if ($cadastrou) { | |
291 | + $this->mensagem .= 'Cadastro efetuado com sucesso.<br />'; | |
292 | + header('Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); | |
293 | + die(); | |
294 | + } | |
295 | + | |
296 | + $this->mensagem = 'Cadastro não realizado.<br />'; | |
297 | + echo "<!--\nErro ao cadastrar clsPmieducarDispensaDisciplina\nvalores obrigatorios\n is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) && is_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_cod_tipo_dispensa )\n-->"; | |
298 | + return FALSE; | |
299 | + } | |
300 | + | |
301 | + function Editar() | |
302 | + { | |
303 | + @session_start(); | |
304 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
305 | + @session_write_close(); | |
306 | + | |
307 | + $obj_permissoes = new clsPermissoes(); | |
308 | + $obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7, | |
309 | + 'educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); | |
310 | + | |
311 | + $obj = new clsPmieducarDispensaDisciplina($this->ref_cod_matricula, | |
312 | + $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina, | |
313 | + $this->pessoa_logada, NULL, $this->ref_cod_tipo_dispensa, NULL, NULL, 1, | |
314 | + $this->observacao); | |
315 | + | |
316 | + $editou = $obj->edita(); | |
317 | + if ($editou) { | |
318 | + $this->mensagem .= 'Edição efetuada com sucesso.<br />'; | |
319 | + header('Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); | |
320 | + die(); | |
321 | + } | |
322 | + | |
323 | + $this->mensagem = 'Edição não realizada.<br />'; | |
324 | + echo "<!--\nErro ao editar clsPmieducarDispensaDisciplina\nvalores obrigatorios\nif( is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) && is_numeric( $this->pessoa_logada ) )\n-->"; | |
325 | + return FALSE; | |
326 | + } | |
327 | + | |
328 | + function Excluir() | |
329 | + { | |
330 | + @session_start(); | |
331 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
332 | + @session_write_close(); | |
333 | + | |
334 | + $obj_permissoes = new clsPermissoes(); | |
335 | + $obj_permissoes->permissao_excluir(578, $this->pessoa_logada, 7, | |
336 | + 'educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); | |
337 | + | |
338 | + $obj = new clsPmieducarDispensaDisciplina($this->ref_cod_matricula, | |
339 | + $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina, | |
340 | + $this->pessoa_logada, null, $this->ref_cod_tipo_dispensa, NULL, NULL, 0, | |
341 | + $this->observacao); | |
342 | + | |
343 | + $excluiu = $obj->excluir(); | |
344 | + | |
345 | + if ($excluiu) { | |
346 | + $this->mensagem .= 'Exclusão efetuada com sucesso.<br />'; | |
347 | + header('Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); | |
348 | + die(); | |
349 | + } | |
350 | + | |
351 | + $this->mensagem = 'Exclusão não realizada.<br />'; | |
352 | + echo "<!--\nErro ao excluir clsPmieducarDispensaDisciplina\nvalores obrigatorios\nif( is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) && is_numeric( $this->pessoa_logada ) )\n-->"; | |
353 | + return FALSE; | |
354 | + } | |
333 | 355 | } |
334 | 356 | |
335 | -// cria uma extensao da classe base | |
357 | +// Instancia objeto de página | |
336 | 358 | $pagina = new clsIndexBase(); |
337 | -// cria o conteudo | |
359 | + | |
360 | +// Instancia objeto de conteúdo | |
338 | 361 | $miolo = new indice(); |
339 | -// adiciona o conteudo na clsBase | |
340 | -$pagina->addForm( $miolo ); | |
341 | -// gera o html | |
342 | -$pagina->MakeAll(); | |
343 | -?> | |
344 | -<script> | |
345 | -var campoTurma = document.getElementById('ref_cod_turma'); | |
346 | -var campoDisciplina = document.getElementById('ref_cod_disciplina'); | |
347 | -campoTurma.onchange = function(){ | |
348 | - campoDisciplina.options.length = 1; | |
349 | - for(var ct=0;ct<disciplina.length;ct++){ | |
350 | - if((campoTurma.options[campoTurma.selectedIndex].value.split("-"))[0] == disciplina[ct][0]) | |
351 | - campoDisciplina.options[campoDisciplina.length] = new Option(disciplina[ct][2],disciplina[ct][1],false,false); | |
352 | - } | |
353 | - }; | |
354 | -</script> | |
362 | + | |
363 | +// Atribui o conteúdo à página | |
364 | +$pagina->addForm($miolo); | |
365 | + | |
366 | +// Gera o código HTML | |
367 | +$pagina->MakeAll(); | |
355 | 368 | \ No newline at end of file | ... | ... |
ieducar/intranet/educar_dispensa_disciplina_det.php
1 | 1 | <?php |
2 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
3 | - * * | |
4 | - * @author Prefeitura Municipal de Itajaí * | |
5 | - * @updated 29/03/2007 * | |
6 | - * Pacote: i-PLB Software Público Livre e Brasileiro * | |
7 | - * * | |
8 | - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí * | |
9 | - * ctima@itajai.sc.gov.br * | |
10 | - * * | |
11 | - * Este programa é software livre, você pode redistribuí-lo e/ou * | |
12 | - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme * | |
13 | - * publicada pela Free Software Foundation, tanto a versão 2 da * | |
14 | - * Licença como (a seu critério) qualquer versão mais nova. * | |
15 | - * * | |
16 | - * Este programa é distribuído na expectativa de ser útil, mas SEM * | |
17 | - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- * | |
18 | - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- * | |
19 | - * sulte a Licença Pública Geral GNU para obter mais detalhes. * | |
20 | - * * | |
21 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU * | |
22 | - * junto com este programa. Se não, escreva para a Free Software * | |
23 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * | |
24 | - * 02111-1307, USA. * | |
25 | - * * | |
26 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
27 | -require_once ("include/clsBase.inc.php"); | |
28 | -require_once ("include/clsDetalhe.inc.php"); | |
29 | -require_once ("include/clsBanco.inc.php"); | |
30 | -require_once( "include/pmieducar/geral.inc.php" ); | |
31 | 2 | |
3 | +/** | |
4 | + * i-Educar - Sistema de gestão escolar | |
5 | + * | |
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
7 | + * <ctima@itajai.sc.gov.br> | |
8 | + * | |
9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
12 | + * qualquer versão posterior. | |
13 | + * | |
14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
17 | + * do GNU para mais detalhes. | |
18 | + * | |
19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
22 | + * | |
23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package iEd_Pmieducar | |
27 | + * @since Arquivo disponível desde a versão 1.0.0 | |
28 | + * @version $Id$ | |
29 | + */ | |
30 | + | |
31 | +require_once "include/clsBase.inc.php"; | |
32 | +require_once "include/clsDetalhe.inc.php"; | |
33 | +require_once "include/clsBanco.inc.php"; | |
34 | +require_once "include/pmieducar/geral.inc.php"; | |
35 | + | |
36 | +/** | |
37 | + * clsIndexBase class. | |
38 | + * | |
39 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
40 | + * @category i-Educar | |
41 | + * @license @@license@@ | |
42 | + * @package iEd_Pmieducar | |
43 | + * @since Classe disponível desde a versão 1.0.0 | |
44 | + * @version @@package_version@@ | |
45 | + */ | |
32 | 46 | class clsIndexBase extends clsBase |
33 | 47 | { |
34 | - function Formular() | |
35 | - { | |
36 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Dispensa Disciplina" ); | |
37 | - $this->processoAp = "578"; | |
38 | - } | |
48 | + function Formular() | |
49 | + { | |
50 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Disciplina'); | |
51 | + $this->processoAp = 578; | |
52 | + } | |
39 | 53 | } |
40 | 54 | |
55 | +/** | |
56 | + * indice class. | |
57 | + * | |
58 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
59 | + * @category i-Educar | |
60 | + * @license @@license@@ | |
61 | + * @package iEd_Pmieducar | |
62 | + * @since Classe disponível desde a versão 1.0.0 | |
63 | + * @version @@package_version@@ | |
64 | + */ | |
41 | 65 | class indice extends clsDetalhe |
42 | 66 | { |
43 | - /** | |
44 | - * Titulo no topo da pagina | |
45 | - * | |
46 | - * @var int | |
47 | - */ | |
48 | - var $titulo; | |
49 | - | |
50 | - var $ref_cod_matricula; | |
51 | - var $ref_cod_turma; | |
52 | - var $ref_cod_serie; | |
53 | - var $ref_cod_escola; | |
54 | - var $ref_cod_disciplina; | |
55 | - var $ref_usuario_exc; | |
56 | - var $ref_usuario_cad; | |
57 | - var $ref_cod_tipo_dispensa; | |
58 | - var $data_cadastro; | |
59 | - var $data_exclusao; | |
60 | - var $ativo; | |
61 | - var $observacao; | |
62 | - var $ref_sequencial; | |
63 | - | |
64 | - function Gerar() | |
65 | - { | |
66 | - @session_start(); | |
67 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
68 | - session_write_close(); | |
69 | - | |
70 | - $this->titulo = "Dispensa Disciplina - Detalhe"; | |
71 | - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | |
72 | - | |
73 | - $this->ref_cod_disciplina=$_GET["ref_cod_disciplina"]; | |
74 | - $this->ref_cod_matricula=$_GET["ref_cod_matricula"]; | |
75 | -// $this->ref_cod_turma=$_GET["ref_cod_turma"]; | |
76 | - $this->ref_cod_serie=$_GET["ref_cod_serie"]; | |
77 | - $this->ref_cod_disciplina=$_GET["ref_cod_disciplina"]; | |
78 | - $this->ref_cod_escola=$_GET["ref_cod_escola"]; | |
79 | -// $this->ref_sequencial=$_GET["ref_sequencial"]; | |
80 | - | |
81 | - | |
82 | - $tmp_obj = new clsPmieducarDispensaDisciplina( $this->ref_cod_matricula, $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina ); | |
83 | - $registro = $tmp_obj->detalhe(); | |
84 | - | |
85 | - if( !$registro ) | |
86 | - { | |
87 | - header( "location: educar_dispensa_disciplina_lst.php?ref_cod_matricula={$this->ref_cod_matricula}" ); | |
88 | - die(); | |
89 | - } | |
90 | - //** | |
91 | - | |
92 | - if( class_exists( "clsPmieducarSerie" ) ) | |
93 | - { | |
94 | - $obj_serie = new clsPmieducarSerie( $this->ref_cod_serie ); | |
95 | - $det_serie = $obj_serie->detalhe(); | |
96 | - $registro["ref_ref_cod_serie"] = $det_serie["nm_serie"]; | |
97 | - } | |
98 | - else | |
99 | - { | |
100 | - $registro["ref_ref_cod_serie"] = "Erro na geracao"; | |
101 | - echo "<!--\nErro\nClasse nao existente: clsPmieducarSerie\n-->"; | |
102 | - } | |
103 | - //** | |
104 | -// if( class_exists( "clsPmieducarMatriculaTurma" ) ) | |
105 | -// { | |
106 | -// $obj_ref_ref_cod_turma = new clsPmieducarMatriculaTurma( $registro["ref_cod_matricula"], $registro["ref_cod_turma"],null,null,null,null,null,null,$this->ref_sequencial ); | |
107 | -// $det_ref_ref_cod_turma = $obj_ref_ref_cod_turma->detalhe(); | |
108 | -// $registro["ref_cod_turma"] = $det_ref_ref_cod_turma["ref_cod_turma"]; | |
109 | -// | |
110 | -// $obj_turma = new clsPmieducarTurma($registro["ref_cod_turma"],null,null,null,null,null,null,null,null,null,null,null,1); | |
111 | -// $det_turma = $obj_turma->detalhe(); | |
112 | -// $nm_turma = $det_turma['nm_turma']; | |
113 | - | |
114 | - /** | |
115 | - * Busca dados da matricula | |
116 | - */ | |
117 | - if( class_exists( "clsPmieducarMatricula" ) ) | |
118 | - { | |
119 | - $obj_ref_cod_matricula = new clsPmieducarMatricula(); | |
120 | - $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista($this->ref_cod_matricula)); | |
121 | - } | |
122 | - else | |
123 | - { | |
124 | - $registro["ref_cod_matricula"] = "Erro na geracao"; | |
125 | - echo "<!--\nErro\nClasse nao existente: clsPmieducarMatricula\n-->"; | |
126 | - } | |
127 | - | |
128 | - | |
129 | - $obj_aluno = new clsPmieducarAluno(); | |
130 | - $det_aluno = array_shift($det_aluno = $obj_aluno->lista($detalhe_aluno['ref_cod_aluno'],null,null,null,null,null,null,null,null,null,1)); | |
131 | - | |
132 | - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola,null,null,null,null,null,null,null,null,null,1); | |
133 | - $det_escola = $obj_escola->detalhe(); | |
134 | - | |
135 | - | |
136 | - $nm_aluno = $det_aluno['nome_aluno']; | |
137 | - | |
138 | - /** | |
139 | - * | |
140 | - */ | |
141 | - | |
142 | -// } | |
143 | -// else | |
144 | -// { | |
145 | -// $registro["ref_ref_cod_turma"] = "Erro na geracao"; | |
146 | -// echo "<!--\nErro\nClasse nao existente: clsPmieducarMatriculaTurma\n-->"; | |
147 | -// } | |
148 | - | |
149 | - if( class_exists( "clsPmieducarCurso" ) ) | |
150 | - { | |
151 | - $obj_ref_cod_curso = new clsPmieducarCurso( $detalhe_aluno["ref_cod_curso"] ); | |
152 | - $det_ref_cod_curso = $obj_ref_cod_curso->detalhe(); | |
153 | - $registro["ref_cod_curso"] = $det_ref_cod_curso["nm_curso"]; | |
154 | - } | |
155 | - else | |
156 | - { | |
157 | - $registro["ref_cod_curso"] = "Erro na geracao"; | |
158 | - echo "<!--\nErro\nClasse nao existente: clsPmieducarCurso\n-->"; | |
159 | - } | |
160 | - | |
161 | - if( class_exists( "clsPmieducarTipoDispensa" ) ) | |
162 | - { | |
163 | - $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa( $registro["ref_cod_tipo_dispensa"] ); | |
164 | - $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe(); | |
165 | - $registro["ref_cod_tipo_dispensa"] = $det_ref_cod_tipo_dispensa["nm_tipo"]; | |
166 | - } | |
167 | - else | |
168 | - { | |
169 | - $registro["ref_cod_tipo_dispensa"] = "Erro na geracao"; | |
170 | - echo "<!--\nErro\nClasse nao existente: clsPmieducarTipoDispensa\n-->"; | |
171 | - } | |
172 | - | |
173 | - | |
174 | - if( $registro["ref_cod_matricula"] ) | |
175 | - { | |
176 | - $this->addDetalhe( array( "Matricula", "{$registro["ref_cod_matricula"]}") ); | |
177 | - } | |
178 | - if( $nm_aluno ) | |
179 | - { | |
180 | - $this->addDetalhe( array( "Aluno", "{$nm_aluno}") ); | |
181 | - } | |
182 | - if( $registro["ref_cod_curso"] ) | |
183 | - { | |
184 | - $this->addDetalhe( array( "Curso", "{$registro["ref_cod_curso"] }") ); | |
185 | - } | |
186 | - if( $registro["ref_ref_cod_serie"] ) | |
187 | - { | |
188 | - $this->addDetalhe( array( "Série", "{$registro["ref_ref_cod_serie"]}") ); | |
189 | - } | |
190 | -// if( $nm_turma ) | |
191 | -// { | |
192 | -// $this->addDetalhe( array( "Turma", "{$nm_turma}") ); | |
193 | -// } | |
194 | - | |
195 | - if( $registro["ref_cod_disciplina"] ) | |
196 | - { | |
197 | - $obj_disciplina = new clsPmieducarDisciplina($registro['ref_cod_disciplina'],null,null,null,null,null,null,null,null,null,1); | |
198 | - $det_disciplina = $obj_disciplina->detalhe(); | |
199 | - $this->addDetalhe( array( "Disciplina", "{$det_disciplina["nm_disciplina"]}") ); | |
200 | - } | |
201 | - if( $registro["ref_cod_tipo_dispensa"] ) | |
202 | - { | |
203 | - $this->addDetalhe( array( "Tipo Dispensa", "{$registro["ref_cod_tipo_dispensa"]}") ); | |
204 | - } | |
205 | - if( $registro["observacao"] ) | |
206 | - { | |
207 | - $this->addDetalhe( array( "Observação", "{$registro["observacao"]}") ); | |
208 | - } | |
209 | - | |
210 | - $obj_permissoes = new clsPermissoes(); | |
211 | - if( $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7 ) ) | |
212 | - { | |
213 | - $this->url_novo = "educar_dispensa_disciplina_cad.php?ref_cod_matricula={$this->ref_cod_matricula}"; | |
214 | - $this->url_editar = "educar_dispensa_disciplina_cad.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}"; | |
215 | - } | |
216 | - | |
217 | - $this->url_cancelar = "educar_dispensa_disciplina_lst.php?ref_cod_matricula={$this->ref_cod_matricula}"; | |
218 | - $this->largura = "100%"; | |
219 | - } | |
67 | + var $titulo; | |
68 | + | |
69 | + var $ref_cod_matricula; | |
70 | + var $ref_cod_turma; | |
71 | + var $ref_cod_serie; | |
72 | + var $ref_cod_escola; | |
73 | + var $ref_cod_disciplina; | |
74 | + var $ref_usuario_exc; | |
75 | + var $ref_usuario_cad; | |
76 | + var $ref_cod_tipo_dispensa; | |
77 | + var $data_cadastro; | |
78 | + var $data_exclusao; | |
79 | + var $ativo; | |
80 | + var $observacao; | |
81 | + var $ref_sequencial; | |
82 | + | |
83 | + function Gerar() | |
84 | + { | |
85 | + @session_start(); | |
86 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
87 | + session_write_close(); | |
88 | + | |
89 | + $this->titulo = 'Dispensa Disciplina - Detalhe'; | |
90 | + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', | |
91 | + 'Intranet'); | |
92 | + | |
93 | + $this->ref_cod_disciplina = $_GET['ref_cod_disciplina']; | |
94 | + $this->ref_cod_matricula = $_GET['ref_cod_matricula']; | |
95 | + $this->ref_cod_serie = $_GET['ref_cod_serie']; | |
96 | + $this->ref_cod_disciplina = $_GET['ref_cod_disciplina']; | |
97 | + $this->ref_cod_escola = $_GET['ref_cod_escola']; | |
98 | + | |
99 | + $tmp_obj = new clsPmieducarDispensaDisciplina($this->ref_cod_matricula, | |
100 | + $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_disciplina); | |
101 | + | |
102 | + $registro = $tmp_obj->detalhe(); | |
103 | + | |
104 | + if (!$registro) { | |
105 | + header('Location: educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula); | |
106 | + die(); | |
107 | + } | |
108 | + | |
109 | + if (class_exists('clsPmieducarSerie')) { | |
110 | + $obj_serie = new clsPmieducarSerie($this->ref_cod_serie); | |
111 | + $det_serie = $obj_serie->detalhe(); | |
112 | + $registro['ref_ref_cod_serie'] = $det_serie['nm_serie']; | |
113 | + } | |
114 | + else { | |
115 | + $registro['ref_ref_cod_serie'] = 'Erro na geracao'; | |
116 | + echo "<!--\nErro\nClasse nao existente: clsPmieducarSerie\n-->"; | |
117 | + } | |
118 | + | |
119 | + /** | |
120 | + * Busca dados da matrícula | |
121 | + */ | |
122 | + if (class_exists('clsPmieducarMatricula')) { | |
123 | + $obj_ref_cod_matricula = new clsPmieducarMatricula(); | |
124 | + $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista($this->ref_cod_matricula)); | |
125 | + } | |
126 | + else { | |
127 | + $registro['ref_cod_matricula'] = 'Erro na geracao'; | |
128 | + echo "<!--\nErro\nClasse nao existente: clsPmieducarMatricula\n-->"; | |
129 | + } | |
130 | + | |
131 | + $obj_aluno = new clsPmieducarAluno(); | |
132 | + $det_aluno = array_shift($obj_aluno->lista($detalhe_aluno['ref_cod_aluno'], | |
133 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1)); | |
134 | + | |
135 | + $obj_escola = new clsPmieducarEscola($this->ref_cod_escola, NULL, NULL, | |
136 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
137 | + $det_escola = $obj_escola->detalhe(); | |
138 | + | |
139 | + $nm_aluno = $det_aluno['nome_aluno']; | |
140 | + | |
141 | + if (class_exists('clsPmieducarCurso')) { | |
142 | + $obj_ref_cod_curso = new clsPmieducarCurso( $detalhe_aluno['ref_cod_curso'] ); | |
143 | + $det_ref_cod_curso = $obj_ref_cod_curso->detalhe(); | |
144 | + $registro['ref_cod_curso'] = $det_ref_cod_curso['nm_curso']; | |
145 | + } | |
146 | + else { | |
147 | + $registro['ref_cod_curso'] = 'Erro na geracao'; | |
148 | + echo "<!--\nErro\nClasse nao existente: clsPmieducarCurso\n-->"; | |
149 | + } | |
150 | + | |
151 | + if (class_exists('clsPmieducarTipoDispensa')) { | |
152 | + $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa($registro['ref_cod_tipo_dispensa']); | |
153 | + $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe(); | |
154 | + $registro['ref_cod_tipo_dispensa'] = $det_ref_cod_tipo_dispensa['nm_tipo']; | |
155 | + } | |
156 | + else { | |
157 | + $registro['ref_cod_tipo_dispensa'] = 'Erro na geracao'; | |
158 | + echo "<!--\nErro\nClasse nao existente: clsPmieducarTipoDispensa\n-->"; | |
159 | + } | |
160 | + | |
161 | + if ($registro['ref_cod_matricula']) { | |
162 | + $this->addDetalhe(array('Matricula', $registro['ref_cod_matricula'])); | |
163 | + } | |
164 | + | |
165 | + if ($nm_aluno) { | |
166 | + $this->addDetalhe(array('Aluno', $nm_aluno)); | |
167 | + } | |
168 | + | |
169 | + if ($registro['ref_cod_curso']) { | |
170 | + $this->addDetalhe(array('Curso', $registro['ref_cod_curso'])); | |
171 | + } | |
172 | + | |
173 | + if ($registro['ref_ref_cod_serie']) { | |
174 | + $this->addDetalhe(array('Série', $registro['ref_ref_cod_serie'])); | |
175 | + } | |
176 | + | |
177 | + if ($registro['ref_cod_disciplina']) { | |
178 | + $obj_disciplina = new clsPmieducarDisciplina($registro['ref_cod_disciplina'], | |
179 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
180 | + | |
181 | + $det_disciplina = $obj_disciplina->detalhe(); | |
182 | + $this->addDetalhe(array('Disciplina', $det_disciplina['nm_disciplina'])); | |
183 | + } | |
184 | + | |
185 | + if ($registro['ref_cod_tipo_dispensa']) { | |
186 | + $this->addDetalhe(array('Tipo Dispensa', $registro['ref_cod_tipo_dispensa'])); | |
187 | + } | |
188 | + | |
189 | + if ($registro['observacao']) { | |
190 | + $this->addDetalhe(array('Observação', $registro['observacao'])); | |
191 | + } | |
192 | + | |
193 | + $obj_permissoes = new clsPermissoes(); | |
194 | + | |
195 | + if ($obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7)) { | |
196 | + $this->url_novo = sprintf('educar_dispensa_disciplina_cad.php?ref_cod_matricula=%d', | |
197 | + $this->ref_cod_matricula); | |
198 | + $this->url_editar = sprintf('educar_dispensa_disciplina_cad.php?ref_cod_matricula=%d&ref_cod_disciplina=%d', | |
199 | + $registro['ref_cod_matricula'], $registro['ref_cod_disciplina']); | |
200 | + } | |
201 | + | |
202 | + $this->url_cancelar = 'educar_dispensa_disciplina_lst.php?ref_cod_matricula=' . $this->ref_cod_matricula; | |
203 | + $this->largura = '100%'; | |
204 | + } | |
220 | 205 | } |
221 | 206 | |
222 | -// cria uma extensao da classe base | |
207 | +// Instancia objeto de página | |
223 | 208 | $pagina = new clsIndexBase(); |
224 | -// cria o conteudo | |
209 | + | |
210 | +// Instancia objeto de conteúdo | |
225 | 211 | $miolo = new indice(); |
226 | -// adiciona o conteudo na clsBase | |
227 | -$pagina->addForm( $miolo ); | |
228 | -// gera o html | |
229 | -$pagina->MakeAll(); | |
230 | -?> | |
231 | 212 | \ No newline at end of file |
213 | + | |
214 | +// Atribui o conteúdo à página | |
215 | +$pagina->addForm($miolo); | |
216 | + | |
217 | +// Gera o código HTML | |
218 | +$pagina->MakeAll(); | |
232 | 219 | \ No newline at end of file | ... | ... |
ieducar/intranet/educar_dispensa_disciplina_lst.php
1 | 1 | <?php |
2 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
3 | - * * | |
4 | - * @author Prefeitura Municipal de Itajaí * | |
5 | - * @updated 29/03/2007 * | |
6 | - * Pacote: i-PLB Software Público Livre e Brasileiro * | |
7 | - * * | |
8 | - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí * | |
9 | - * ctima@itajai.sc.gov.br * | |
10 | - * * | |
11 | - * Este programa é software livre, você pode redistribuí-lo e/ou * | |
12 | - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme * | |
13 | - * publicada pela Free Software Foundation, tanto a versão 2 da * | |
14 | - * Licença como (a seu critério) qualquer versão mais nova. * | |
15 | - * * | |
16 | - * Este programa é distribuído na expectativa de ser útil, mas SEM * | |
17 | - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- * | |
18 | - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- * | |
19 | - * sulte a Licença Pública Geral GNU para obter mais detalhes. * | |
20 | - * * | |
21 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU * | |
22 | - * junto com este programa. Se não, escreva para a Free Software * | |
23 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * | |
24 | - * 02111-1307, USA. * | |
25 | - * * | |
26 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
27 | -require_once ("include/clsBase.inc.php"); | |
28 | -require_once ("include/clsListagem.inc.php"); | |
29 | -require_once ("include/clsBanco.inc.php"); | |
30 | -require_once( "include/pmieducar/geral.inc.php" ); | |
31 | 2 | |
3 | +/** | |
4 | + * i-Educar - Sistema de gestão escolar | |
5 | + * | |
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
7 | + * <ctima@itajai.sc.gov.br> | |
8 | + * | |
9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
12 | + * qualquer versão posterior. | |
13 | + * | |
14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
17 | + * do GNU para mais detalhes. | |
18 | + * | |
19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
22 | + * | |
23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package iEd_Pmieducar | |
27 | + * @since Arquivo disponível desde a versão 1.0.0 | |
28 | + * @version $Id$ | |
29 | + */ | |
30 | + | |
31 | +require_once 'include/clsBase.inc.php'; | |
32 | +require_once 'include/clsListagem.inc.php'; | |
33 | +require_once 'include/clsBanco.inc.php'; | |
34 | +require_once 'include/pmieducar/geral.inc.php'; | |
35 | + | |
36 | +/** | |
37 | + * clsIndexBase class. | |
38 | + * | |
39 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
40 | + * @category i-Educar | |
41 | + * @license @@license@@ | |
42 | + * @package iEd_Pmieducar | |
43 | + * @since Classe disponível desde a versão 1.0.0 | |
44 | + * @version @@package_version@@ | |
45 | + */ | |
32 | 46 | class clsIndexBase extends clsBase |
33 | 47 | { |
34 | - function Formular() | |
35 | - { | |
36 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Dispensa Disciplina" ); | |
37 | - $this->processoAp = "578"; | |
38 | - } | |
48 | + function Formular() | |
49 | + { | |
50 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Dispensa Disciplina'); | |
51 | + $this->processoAp = 578; | |
52 | + } | |
39 | 53 | } |
40 | 54 | |
55 | +/** | |
56 | + * indice class. | |
57 | + * | |
58 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
59 | + * @category i-Educar | |
60 | + * @license @@license@@ | |
61 | + * @package iEd_Pmieducar | |
62 | + * @since Classe disponível desde a versão 1.0.0 | |
63 | + * @version @@package_version@@ | |
64 | + */ | |
41 | 65 | class indice extends clsListagem |
42 | 66 | { |
43 | - /** | |
44 | - * Referencia pega da session para o idpes do usuario atual | |
45 | - * | |
46 | - * @var int | |
47 | - */ | |
48 | - var $pessoa_logada; | |
49 | - | |
50 | - /** | |
51 | - * Titulo no topo da pagina | |
52 | - * | |
53 | - * @var int | |
54 | - */ | |
55 | - var $titulo; | |
56 | - | |
57 | - /** | |
58 | - * Quantidade de registros a ser apresentada em cada pagina | |
59 | - * | |
60 | - * @var int | |
61 | - */ | |
62 | - var $limite; | |
63 | - | |
64 | - /** | |
65 | - * Inicio dos registros a serem exibidos (limit) | |
66 | - * | |
67 | - * @var int | |
68 | - */ | |
69 | - var $offset; | |
70 | - | |
71 | - var $ref_cod_matricula; | |
72 | - var $ref_cod_serie; | |
73 | - var $ref_cod_escola; | |
74 | - var $ref_cod_disciplina; | |
75 | - var $ref_usuario_exc; | |
76 | - var $ref_usuario_cad; | |
77 | - var $ref_cod_tipo_dispensa; | |
78 | - var $data_cadastro; | |
79 | - var $data_exclusao; | |
80 | - var $ativo; | |
81 | - var $observacao; | |
82 | - var $ref_sequencial; | |
83 | - | |
84 | - var $ref_cod_instituicao; | |
85 | - var $ref_cod_turma; | |
86 | - | |
87 | - function Gerar() | |
88 | - { | |
89 | - @session_start(); | |
90 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
91 | - session_write_close(); | |
92 | - | |
93 | - $this->titulo = "Dispensa Disciplina - Listagem"; | |
94 | - | |
95 | - foreach( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto | |
96 | - $this->$var = ( $val === "" ) ? null: $val; | |
97 | - | |
98 | - | |
99 | - if(!$_GET['ref_cod_matricula']) | |
100 | - { | |
101 | - header("location: educar_matricula_lst.php"); | |
102 | - die; | |
103 | - } | |
104 | - | |
105 | - $this->ref_cod_matricula = $_GET['ref_cod_matricula']; | |
106 | - | |
107 | - $obj_matricula = new clsPmieducarMatricula(); | |
108 | - $lst_matricula = $obj_matricula->lista( $this->ref_cod_matricula ); | |
109 | - if (is_array($lst_matricula)) | |
110 | - { | |
111 | - $det_matricula = array_shift($lst_matricula); | |
112 | - $this->ref_cod_instituicao = $det_matricula["ref_cod_instituicao"]; | |
113 | - $this->ref_cod_escola = $det_matricula["ref_ref_cod_escola"]; | |
114 | - $this->ref_cod_serie = $det_matricula["ref_ref_cod_serie"]; | |
115 | - | |
116 | - $obj_matricula_turma = new clsPmieducarMatriculaTurma(); | |
117 | - $lst_matricula_turma = $obj_matricula_turma->lista( $this->ref_cod_matricula,null,null,null,null,null,null,null,1,$this->ref_cod_serie,null,$this->ref_cod_escola ); | |
118 | - if (is_array($lst_matricula_turma)) | |
119 | - { | |
120 | - $det = array_shift($lst_matricula_turma); | |
121 | - $this->ref_cod_turma = $det["ref_cod_turma"]; | |
122 | - $this->ref_sequencial = $det["sequencial"]; | |
123 | - | |
124 | - } | |
125 | - } | |
126 | - $this->campoOculto( "ref_cod_turma", $this->ref_cod_turma ); | |
127 | - | |
128 | - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | |
129 | - | |
130 | - $this->addCabecalhos( array( | |
131 | - "Disciplina", | |
132 | - "Tipo Dispensa", | |
133 | - "Data Dispensa" | |
134 | - ) ); | |
135 | - | |
136 | - // Filtros de Foreign Keys | |
137 | - $opcoes = array( "" => "Selecione" ); | |
138 | - if( class_exists( "clsPmieducarTipoDispensa" ) ) | |
139 | - { | |
140 | - $objTemp = new clsPmieducarTipoDispensa(); | |
141 | - if ($this->ref_cod_instituicao) | |
142 | - $lista = $objTemp->lista( null,null,null,null,null,null,null,null,null,1,$this->ref_cod_instituicao ); | |
143 | - else | |
144 | - $lista = $objTemp->lista( null,null,null,null,null,null,null,null,null,1 ); | |
145 | - | |
146 | - if ( is_array( $lista ) && count( $lista ) ) | |
147 | - { | |
148 | - foreach ( $lista as $registro ) | |
149 | - { | |
150 | - $opcoes["{$registro['cod_tipo_dispensa']}"] = "{$registro['nm_tipo']}"; | |
151 | - } | |
152 | - } | |
153 | - } | |
154 | - else | |
155 | - { | |
156 | - echo "<!--\nErro\nClasse clsPmieducarTipoDispensa nao encontrada\n-->"; | |
157 | - $opcoes = array( "" => "Erro na geracao" ); | |
158 | - } | |
159 | - $this->campoLista( "ref_cod_tipo_dispensa", "Motivo", $opcoes, $this->ref_cod_tipo_dispensa,"",false,"","",false,false); | |
160 | - | |
161 | - $this->campoOculto("ref_cod_matricula",$this->ref_cod_matricula); | |
162 | - | |
163 | - // outros Filtros | |
164 | - $opcoes = array( "" => "Selecione" ); | |
165 | - if( class_exists( "clsPmieducarEscolaSerieDisciplina" ) ) | |
166 | - { | |
167 | - $objTemp = new clsPmieducarEscolaSerieDisciplina(); | |
168 | - $lista = $objTemp->lista( $this->ref_cod_serie,$this->ref_cod_escola,null,1 ); | |
169 | - if ( is_array( $lista ) && count( $lista ) ) | |
170 | - { | |
171 | - foreach ( $lista as $registro ) | |
172 | - { | |
173 | - $obj_disciplina = new clsPmieducarDisciplina($registro['ref_cod_disciplina'],null,null,null,null,null,null,null,null,null,1); | |
174 | - $det_disciplina = $obj_disciplina->detalhe(); | |
175 | - $opcoes["{$registro['ref_cod_disciplina']}"] = "{$det_disciplina['nm_disciplina']}"; | |
176 | - } | |
177 | - } | |
178 | - } | |
179 | - else | |
180 | - { | |
181 | - echo "<!--\nErro\nClasse clsPmieducarEscolaSerieDisciplina nao encontrada\n-->"; | |
182 | - $opcoes = array( "" => "Erro na geracao" ); | |
183 | - } | |
184 | - | |
185 | - $this->campoLista( "ref_cod_disciplina", "Disciplina", $opcoes, $this->ref_cod_disciplina,"",false,"","",false,false ); | |
186 | - | |
187 | - | |
188 | - // Paginador | |
189 | - $this->limite = 20; | |
190 | - $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->limite-$this->limite: 0; | |
191 | - | |
192 | - $obj_dispensa_disciplina = new clsPmieducarDispensaDisciplina(); | |
193 | - $obj_dispensa_disciplina->setOrderby( "data_cadastro ASC" ); | |
194 | - $obj_dispensa_disciplina->setLimite( $this->limite, $this->offset ); | |
195 | - | |
196 | - $lista = $obj_dispensa_disciplina->lista( | |
197 | - $this->ref_cod_matricula, | |
198 | - null, | |
199 | - null, | |
200 | - $this->ref_cod_disciplina, | |
201 | - null, | |
202 | - null, | |
203 | - $this->ref_cod_tipo_dispensa, | |
204 | - null, | |
205 | - null, | |
206 | - null, | |
207 | - null, | |
208 | - 1 | |
209 | - ); | |
210 | - | |
211 | - $total = $obj_dispensa_disciplina->_total; | |
212 | - | |
213 | - // monta a lista | |
214 | - if( is_array( $lista ) && count( $lista ) ) | |
215 | - { | |
216 | - foreach ( $lista AS $registro ) | |
217 | - { | |
218 | - // muda os campos data | |
219 | - $registro["data_cadastro_time"] = strtotime( substr( $registro["data_cadastro"], 0, 16 ) ); | |
220 | - $registro["data_cadastro_br"] = date( "d/m/Y", $registro["data_cadastro_time"] ); | |
221 | - | |
222 | - if( class_exists( "clsPmieducarTipoDispensa" ) ) | |
223 | - { | |
224 | - $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa( $registro["ref_cod_tipo_dispensa"] ); | |
225 | - $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe(); | |
226 | - $registro["ref_cod_tipo_dispensa"] = $det_ref_cod_tipo_dispensa["nm_tipo"]; | |
227 | - } | |
228 | - else | |
229 | - { | |
230 | - $registro["ref_cod_tipo_dispensa"] = "Erro na geracao"; | |
231 | - echo "<!--\nErro\nClasse nao existente: clsPmieducarTipoDispensa\n-->"; | |
232 | - } | |
233 | - | |
234 | - $obj_disciplina = new clsPmieducarDisciplina($registro['ref_cod_disciplina'],null,null,null,null,null,null,null,null,null,1); | |
235 | - $det_disciplina = $obj_disciplina->detalhe(); | |
236 | - | |
237 | - $this->addLinhas( array( | |
238 | - "<a href=\"educar_dispensa_disciplina_det.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_serie={$registro["ref_cod_serie"]}&ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}\">{$det_disciplina["nm_disciplina"]}</a>", | |
239 | - "<a href=\"educar_dispensa_disciplina_det.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_serie={$registro["ref_cod_serie"]}&ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}\">{$registro["ref_cod_tipo_dispensa"]}</a>", | |
240 | - "<a href=\"educar_dispensa_disciplina_det.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_serie={$registro["ref_cod_serie"]}&ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}\">{$registro["data_cadastro_br"]}</a>" | |
241 | - ) ); | |
242 | - } | |
243 | - } | |
244 | - $this->addPaginador2( "educar_dispensa_disciplina_lst.php", $total, $_GET, $this->nome, $this->limite ); | |
245 | - $obj_permissoes = new clsPermissoes(); | |
246 | - if( $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7 ) ) | |
247 | - { | |
248 | - $this->array_botao_url[] = "educar_dispensa_disciplina_cad.php?ref_cod_matricula={$this->ref_cod_matricula}"; | |
249 | - $this->array_botao[] = "Novo"; | |
250 | - } | |
251 | - | |
252 | - $this->array_botao_url[] = "educar_matricula_det.php?cod_matricula={$this->ref_cod_matricula}"; | |
253 | - $this->array_botao[] = "Voltar"; | |
254 | - | |
255 | - $this->largura = "100%"; | |
256 | - } | |
67 | + var $pessoa_logada; | |
68 | + var $titulo; | |
69 | + var $limite; | |
70 | + var $offset; | |
71 | + | |
72 | + var $ref_cod_matricula; | |
73 | + var $ref_cod_serie; | |
74 | + var $ref_cod_escola; | |
75 | + var $ref_cod_disciplina; | |
76 | + var $ref_usuario_exc; | |
77 | + var $ref_usuario_cad; | |
78 | + var $ref_cod_tipo_dispensa; | |
79 | + var $data_cadastro; | |
80 | + var $data_exclusao; | |
81 | + var $ativo; | |
82 | + var $observacao; | |
83 | + var $ref_sequencial; | |
84 | + | |
85 | + var $ref_cod_instituicao; | |
86 | + var $ref_cod_turma; | |
87 | + | |
88 | + function Gerar() | |
89 | + { | |
90 | + @session_start(); | |
91 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
92 | + session_write_close(); | |
93 | + | |
94 | + $this->titulo = 'Dispensa Disciplina - Listagem'; | |
95 | + | |
96 | + // passa todos os valores obtidos no GET para atributos do objeto | |
97 | + foreach ($_GET as $var => $val) { | |
98 | + $this->$var = ($val === '') ? NULL : $val; | |
99 | + } | |
100 | + | |
101 | + if (!$_GET['ref_cod_matricula']) { | |
102 | + header('Location: educar_matricula_lst.php'); | |
103 | + die(); | |
104 | + } | |
105 | + | |
106 | + $this->ref_cod_matricula = $_GET['ref_cod_matricula']; | |
107 | + | |
108 | + $obj_matricula = new clsPmieducarMatricula(); | |
109 | + $lst_matricula = $obj_matricula->lista($this->ref_cod_matricula); | |
110 | + | |
111 | + if (is_array($lst_matricula)) { | |
112 | + $det_matricula = array_shift($lst_matricula); | |
113 | + $this->ref_cod_instituicao = $det_matricula['ref_cod_instituicao']; | |
114 | + $this->ref_cod_escola = $det_matricula['ref_ref_cod_escola']; | |
115 | + $this->ref_cod_serie = $det_matricula['ref_ref_cod_serie']; | |
116 | + | |
117 | + $obj_matricula_turma = new clsPmieducarMatriculaTurma(); | |
118 | + $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, | |
119 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie, NULL, | |
120 | + $this->ref_cod_escola); | |
121 | + | |
122 | + if (is_array($lst_matricula_turma)) { | |
123 | + $det = array_shift($lst_matricula_turma); | |
124 | + $this->ref_cod_turma = $det['ref_cod_turma']; | |
125 | + $this->ref_sequencial = $det['sequencial']; | |
126 | + } | |
127 | + } | |
128 | + | |
129 | + $this->campoOculto('ref_cod_turma', $this->ref_cod_turma); | |
130 | + | |
131 | + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', | |
132 | + 'Intranet'); | |
133 | + | |
134 | + $this->addCabecalhos(array( | |
135 | + 'Disciplina', | |
136 | + 'Tipo Dispensa', | |
137 | + 'Data Dispensa' | |
138 | + )); | |
139 | + | |
140 | + // Filtros de Foreign Keys | |
141 | + $opcoes = array('' => 'Selecione'); | |
142 | + if (class_exists('clsPmieducarTipoDispensa')) { | |
143 | + $objTemp = new clsPmieducarTipoDispensa(); | |
144 | + | |
145 | + if ($this->ref_cod_instituicao) { | |
146 | + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
147 | + NULL, 1, $this->ref_cod_instituicao); | |
148 | + } | |
149 | + else { | |
150 | + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
151 | + } | |
152 | + | |
153 | + if (is_array($lista) && count($lista)) { | |
154 | + foreach ($lista as $registro) { | |
155 | + $opcoes[$registro['cod_tipo_dispensa']] = $registro['nm_tipo']; | |
156 | + } | |
157 | + } | |
158 | + } | |
159 | + else { | |
160 | + echo "<!--\nErro\nClasse clsPmieducarTipoDispensa nao encontrada\n-->"; | |
161 | + $opcoes = array('' => 'Erro na geração'); | |
162 | + } | |
163 | + | |
164 | + $this->campoLista('ref_cod_tipo_dispensa', 'Motivo', $opcoes, | |
165 | + $this->ref_cod_tipo_dispensa, '', FALSE, '', '', FALSE, FALSE); | |
166 | + | |
167 | + $this->campoOculto('ref_cod_matricula', $this->ref_cod_matricula); | |
168 | + | |
169 | + // outros Filtros | |
170 | + $opcoes = array('' => 'Selecione'); | |
171 | + if (class_exists('clsPmieducarEscolaSerieDisciplina')) { | |
172 | + $objTemp = new clsPmieducarEscolaSerieDisciplina(); | |
173 | + $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1); | |
174 | + | |
175 | + if (is_array($lista) && count($lista)) { | |
176 | + foreach ($lista as $registro) { | |
177 | + $obj_disciplina = new clsPmieducarDisciplina( | |
178 | + $registro['ref_cod_disciplina'], NULL, NULL, NULL, NULL, NULL, NULL, | |
179 | + NULL, NULL, NULL, 1); | |
180 | + | |
181 | + $det_disciplina = $obj_disciplina->detalhe(); | |
182 | + $opcoes[$registro['ref_cod_disciplina']] = $det_disciplina['nm_disciplina']; | |
183 | + } | |
184 | + } | |
185 | + } | |
186 | + else { | |
187 | + echo "<!--\nErro\nClasse clsPmieducarEscolaSerieDisciplina nao encontrada\n-->"; | |
188 | + $opcoes = array('' => 'Erro na geração'); | |
189 | + } | |
190 | + | |
191 | + $this->campoLista('ref_cod_disciplina', 'Disciplina', $opcoes, | |
192 | + $this->ref_cod_disciplina, '', FALSE, '', '', FALSE, FALSE); | |
193 | + | |
194 | + // Paginador | |
195 | + $this->limite = 20; | |
196 | + $this->offset = $_GET['pagina_' . $this->nome] ? | |
197 | + $_GET['pagina_' . $this->nome] * $this->limite - $this->limite : 0; | |
198 | + | |
199 | + $obj_dispensa_disciplina = new clsPmieducarDispensaDisciplina(); | |
200 | + $obj_dispensa_disciplina->setOrderby('data_cadastro ASC'); | |
201 | + $obj_dispensa_disciplina->setLimite($this->limite, $this->offset); | |
202 | + | |
203 | + $lista = $obj_dispensa_disciplina->lista( | |
204 | + $this->ref_cod_matricula, | |
205 | + NULL, | |
206 | + NULL, | |
207 | + $this->ref_cod_disciplina, | |
208 | + NULL, | |
209 | + NULL, | |
210 | + $this->ref_cod_tipo_dispensa, | |
211 | + NULL, | |
212 | + NULL, | |
213 | + NULL, | |
214 | + NULL, | |
215 | + 1 | |
216 | + ); | |
217 | + | |
218 | + $total = $obj_dispensa_disciplina->_total; | |
219 | + | |
220 | + // monta a lista | |
221 | + if (is_array($lista) && count($lista)) { | |
222 | + foreach ($lista as $registro) { | |
223 | + // muda os campos data | |
224 | + $registro['data_cadastro_time'] = strtotime(substr($registro['data_cadastro'], 0, 16)); | |
225 | + $registro['data_cadastro_br'] = date('d/m/Y', $registro['data_cadastro_time']); | |
226 | + | |
227 | + if (class_exists('clsPmieducarTipoDispensa')) { | |
228 | + $obj_ref_cod_tipo_dispensa = new clsPmieducarTipoDispensa($registro['ref_cod_tipo_dispensa']); | |
229 | + $det_ref_cod_tipo_dispensa = $obj_ref_cod_tipo_dispensa->detalhe(); | |
230 | + $registro['ref_cod_tipo_dispensa'] = $det_ref_cod_tipo_dispensa['nm_tipo']; | |
231 | + } | |
232 | + else { | |
233 | + $registro['ref_cod_tipo_dispensa'] = 'Erro na geracao'; | |
234 | + echo "<!--\nErro\nClasse nao existente: clsPmieducarTipoDispensa\n-->"; | |
235 | + } | |
236 | + | |
237 | + $obj_disciplina = new clsPmieducarDisciplina($registro['ref_cod_disciplina'], | |
238 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
239 | + | |
240 | + $det_disciplina = $obj_disciplina->detalhe(); | |
241 | + | |
242 | + $this->addLinhas(array( | |
243 | + "<a href=\"educar_dispensa_disciplina_det.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_serie={$registro["ref_cod_serie"]}&ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}\">{$det_disciplina["nm_disciplina"]}</a>", | |
244 | + "<a href=\"educar_dispensa_disciplina_det.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_serie={$registro["ref_cod_serie"]}&ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}\">{$registro["ref_cod_tipo_dispensa"]}</a>", | |
245 | + "<a href=\"educar_dispensa_disciplina_det.php?ref_cod_matricula={$registro["ref_cod_matricula"]}&ref_cod_serie={$registro["ref_cod_serie"]}&ref_cod_escola={$registro["ref_cod_escola"]}&ref_cod_disciplina={$registro["ref_cod_disciplina"]}\">{$registro["data_cadastro_br"]}</a>" | |
246 | + )); | |
247 | + } | |
248 | + } | |
249 | + | |
250 | + $this->addPaginador2('educar_dispensa_disciplina_lst.php', $total, $_GET, | |
251 | + $this->nome, $this->limite); | |
252 | + | |
253 | + $obj_permissoes = new clsPermissoes(); | |
254 | + | |
255 | + if ($obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7)) { | |
256 | + $this->array_botao_url[] = 'educar_dispensa_disciplina_cad.php?ref_cod_matricula=' . $this->ref_cod_matricula; | |
257 | + $this->array_botao[] = 'Novo'; | |
258 | + } | |
259 | + | |
260 | + $this->array_botao_url[] = 'educar_matricula_det.php?cod_matricula=' . $this->ref_cod_matricula; | |
261 | + $this->array_botao[] = 'Voltar'; | |
262 | + | |
263 | + $this->largura = '100%'; | |
264 | + } | |
257 | 265 | } |
258 | -// cria uma extensao da classe base | |
266 | + | |
267 | +// Instancia objeto de página | |
259 | 268 | $pagina = new clsIndexBase(); |
260 | -// cria o conteudo | |
269 | + | |
270 | +// Instancia objeto de conteúdo | |
261 | 271 | $miolo = new indice(); |
262 | -// adiciona o conteudo na clsBase | |
263 | -$pagina->addForm( $miolo ); | |
264 | -// gera o html | |
265 | -$pagina->MakeAll(); | |
266 | -?> | |
267 | -<script> | |
268 | -var campoTurma = document.getElementById('ref_cod_turma'); | |
269 | -var campoDisciplina = document.getElementById('ref_cod_disciplina'); | |
270 | -campoTurma.onchange = function(){ | |
271 | - campoDisciplina.options.length = 1; | |
272 | - for(var ct=0;ct<disciplina.length;ct++){ | |
273 | - if((campoTurma.options[campoTurma.selectedIndex].value.split("-"))[0] == disciplina[ct][0]) | |
274 | - campoDisciplina.options[campoDisciplina.length] = new Option(disciplina[ct][2],disciplina[ct][1],false,false); | |
275 | - } | |
276 | - }; | |
277 | -</script> | |
278 | 272 | \ No newline at end of file |
273 | + | |
274 | +// Atribui o conteúdo à página | |
275 | +$pagina->addForm($miolo); | |
276 | + | |
277 | +// Gera o código HTML | |
278 | +$pagina->MakeAll(); | |
279 | 279 | \ No newline at end of file | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarDispensaDisciplina.inc.php
1 | 1 | <?php |
2 | + | |
2 | 3 | /** |
4 | + * i-Educar - Sistema de gestão escolar | |
3 | 5 | * |
4 | - * @version SVN: $Id$ | |
5 | - * @author Prefeitura Municipal de Itajaí | |
6 | - * @updated 29/03/2007 | |
7 | - * Pacote: i-PLB Software Público Livre e Brasileiro | |
8 | - * | |
9 | - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí | |
10 | - * ctima@itajai.sc.gov.br | |
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
7 | + * <ctima@itajai.sc.gov.br> | |
11 | 8 | * |
12 | - * Este programa é software livre, você pode redistribuí-lo e/ou | |
13 | - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme | |
14 | - * publicada pela Free Software Foundation, tanto a versão 2 da | |
15 | - * Licença como (a seu critério) qualquer versão mais nova. | |
9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
12 | + * qualquer versão posterior. | |
16 | 13 | * |
17 | - * Este programa é distribuído na expectativa de ser útil, mas SEM | |
18 | - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- | |
19 | - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- | |
20 | - * sulte a Licença Pública Geral GNU para obter mais detalhes. | |
14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
17 | + * do GNU para mais detalhes. | |
21 | 18 | * |
22 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU | |
23 | - * junto com este programa. Se não, escreva para a Free Software | |
24 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
25 | - * 02111-1307, USA. | |
19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
26 | 22 | * |
23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package iEd_Pmieducar | |
27 | + * @since Arquivo disponível desde a versão 1.0.0 | |
28 | + * @version $Id$ | |
27 | 29 | */ |
28 | 30 | |
29 | -require_once('include/pmieducar/geral.inc.php'); | |
31 | +require_once 'include/pmieducar/geral.inc.php'; | |
30 | 32 | |
33 | +/** | |
34 | + * clsPmieducarDispensaDisciplina class. | |
35 | + * | |
36 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
37 | + * @category i-Educar | |
38 | + * @license @@license@@ | |
39 | + * @package iEd_Pmieducar | |
40 | + * @since Classe disponível desde a versão 1.0.0 | |
41 | + * @version @@package_version@@ | |
42 | + */ | |
31 | 43 | class clsPmieducarDispensaDisciplina |
32 | 44 | { |
33 | - var $ref_cod_matricula; | |
34 | - var $ref_cod_serie; | |
35 | - var $ref_cod_escola; | |
36 | - var $ref_cod_disciplina; | |
37 | - var $ref_usuario_exc; | |
38 | - var $ref_usuario_cad; | |
39 | - var $ref_cod_tipo_dispensa; | |
40 | - var $data_cadastro; | |
41 | - var $data_exclusao; | |
42 | - var $ativo; | |
43 | - var $observacao; | |
44 | - var $cod_dispensa; | |
45 | - | |
46 | - // propriedades padrao | |
47 | - | |
48 | - /** | |
49 | - * Armazena o total de resultados obtidos na ultima chamada ao metodo lista | |
50 | - * | |
51 | - * @var int | |
52 | - */ | |
53 | - var $_total; | |
54 | - | |
55 | - /** | |
56 | - * Nome do schema | |
57 | - * | |
58 | - * @var string | |
59 | - */ | |
60 | - var $_schema; | |
61 | - | |
62 | - /** | |
63 | - * Nome da tabela | |
64 | - * | |
65 | - * @var string | |
66 | - */ | |
67 | - var $_tabela; | |
68 | - | |
69 | - /** | |
70 | - * Lista separada por virgula, com os campos que devem ser selecionados na proxima chamado ao metodo lista | |
71 | - * | |
72 | - * @var string | |
73 | - */ | |
74 | - var $_campos_lista; | |
75 | - | |
76 | - /** | |
77 | - * Lista com todos os campos da tabela separados por virgula, padrao para selecao no metodo lista | |
78 | - * | |
79 | - * @var string | |
80 | - */ | |
81 | - var $_todos_campos; | |
82 | - | |
83 | - /** | |
84 | - * Valor que define a quantidade de registros a ser retornada pelo metodo lista | |
85 | - * | |
86 | - * @var int | |
87 | - */ | |
88 | - var $_limite_quantidade; | |
89 | - | |
90 | - /** | |
91 | - * Define o valor de offset no retorno dos registros no metodo lista | |
92 | - * | |
93 | - * @var int | |
94 | - */ | |
95 | - var $_limite_offset; | |
96 | - | |
97 | - /** | |
98 | - * Define o campo padrao para ser usado como padrao de ordenacao no metodo lista | |
99 | - * | |
100 | - * @var string | |
101 | - */ | |
102 | - var $_campo_order_by; | |
103 | - | |
104 | - | |
105 | - /** | |
106 | - * Construtor (PHP 4) | |
107 | - * | |
108 | - * @return object | |
109 | - */ | |
110 | - function clsPmieducarDispensaDisciplina( $ref_cod_matricula = null, $ref_cod_serie = null, $ref_cod_escola = null, $ref_cod_disciplina = null, $ref_usuario_exc = null, $ref_usuario_cad = null, $ref_cod_tipo_dispensa = null, $data_cadastro = null, $data_exclusao = null, $ativo = null, $observacao = null, $cod_dispensa = null ) | |
111 | - { | |
112 | - $db = new clsBanco(); | |
113 | - $this->_schema = "pmieducar."; | |
114 | - $this->_tabela = "{$this->_schema}dispensa_disciplina"; | |
115 | - | |
116 | - $this->_campos_lista = $this->_todos_campos = "ref_cod_matricula, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, ref_usuario_exc, ref_usuario_cad, ref_cod_tipo_dispensa, data_cadastro, data_exclusao, ativo, observacao"; | |
117 | - | |
118 | - if( is_numeric( $ref_usuario_exc ) ) | |
119 | - { | |
120 | - if( class_exists( "clsPmieducarUsuario" ) ) | |
121 | - { | |
122 | - $tmp_obj = new clsPmieducarUsuario( $ref_usuario_exc ); | |
123 | - if( method_exists( $tmp_obj, "existe") ) | |
124 | - { | |
125 | - if( $tmp_obj->existe() ) | |
126 | - { | |
127 | - $this->ref_usuario_exc = $ref_usuario_exc; | |
128 | - } | |
129 | - } | |
130 | - else if( method_exists( $tmp_obj, "detalhe") ) | |
131 | - { | |
132 | - if( $tmp_obj->detalhe() ) | |
133 | - { | |
134 | - $this->ref_usuario_exc = $ref_usuario_exc; | |
135 | - } | |
136 | - } | |
137 | - } | |
138 | - else | |
139 | - { | |
140 | - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.usuario WHERE cod_usuario = '{$ref_usuario_exc}'" ) ) | |
141 | - { | |
142 | - $this->ref_usuario_exc = $ref_usuario_exc; | |
143 | - } | |
144 | - } | |
145 | - } | |
146 | - if( is_numeric( $ref_usuario_cad ) ) | |
147 | - { | |
148 | - if( class_exists( "clsPmieducarUsuario" ) ) | |
149 | - { | |
150 | - $tmp_obj = new clsPmieducarUsuario( $ref_usuario_cad ); | |
151 | - if( method_exists( $tmp_obj, "existe") ) | |
152 | - { | |
153 | - if( $tmp_obj->existe() ) | |
154 | - { | |
155 | - $this->ref_usuario_cad = $ref_usuario_cad; | |
156 | - } | |
157 | - } | |
158 | - else if( method_exists( $tmp_obj, "detalhe") ) | |
159 | - { | |
160 | - if( $tmp_obj->detalhe() ) | |
161 | - { | |
162 | - $this->ref_usuario_cad = $ref_usuario_cad; | |
163 | - } | |
164 | - } | |
165 | - } | |
166 | - else | |
167 | - { | |
168 | - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.usuario WHERE cod_usuario = '{$ref_usuario_cad}'" ) ) | |
169 | - { | |
170 | - $this->ref_usuario_cad = $ref_usuario_cad; | |
171 | - } | |
172 | - } | |
173 | - } | |
174 | - if( is_numeric( $ref_cod_matricula ) ) | |
175 | - { | |
176 | - if( class_exists( "clsPmieducarMatricula" ) ) | |
177 | - { | |
178 | - $tmp_obj = new clsPmieducarMatricula( $ref_cod_matricula ); | |
179 | - if( method_exists( $tmp_obj, "existe") ) | |
180 | - { | |
181 | - if( $tmp_obj->existe() ) | |
182 | - { | |
183 | - $this->ref_cod_matricula = $ref_cod_matricula; | |
184 | - } | |
185 | - } | |
186 | - else if( method_exists( $tmp_obj, "detalhe") ) | |
187 | - { | |
188 | - if( $tmp_obj->detalhe() ) | |
189 | - { | |
190 | - $this->ref_cod_matricula = $ref_cod_matricula; | |
191 | - } | |
192 | - } | |
193 | - } | |
194 | - else | |
195 | - { | |
196 | - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.matricula WHERE ref_cod_matricula = '{$ref_cod_matricula}'" ) ) | |
197 | - { | |
198 | - $this->ref_cod_matricula = $ref_cod_matricula; | |
199 | - } | |
200 | - } | |
201 | - } | |
202 | - if( is_numeric( $ref_cod_tipo_dispensa ) ) | |
203 | - { | |
204 | - if( class_exists( "clsPmieducarTipoDispensa" ) ) | |
205 | - { | |
206 | - $tmp_obj = new clsPmieducarTipoDispensa( $ref_cod_tipo_dispensa ); | |
207 | - if( method_exists( $tmp_obj, "existe") ) | |
208 | - { | |
209 | - if( $tmp_obj->existe() ) | |
210 | - { | |
211 | - $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa; | |
212 | - } | |
213 | - } | |
214 | - else if( method_exists( $tmp_obj, "detalhe") ) | |
215 | - { | |
216 | - if( $tmp_obj->detalhe() ) | |
217 | - { | |
218 | - $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa; | |
219 | - } | |
220 | - } | |
221 | - } | |
222 | - else | |
223 | - { | |
224 | - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.tipo_dispensa WHERE cod_tipo_dispensa = '{$ref_cod_tipo_dispensa}'" ) ) | |
225 | - { | |
226 | - $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa; | |
227 | - } | |
228 | - } | |
229 | - } | |
230 | - if( is_numeric( $ref_cod_disciplina ) && is_numeric( $ref_cod_escola ) && is_numeric( $ref_cod_serie ) ) | |
231 | - { | |
232 | - if( class_exists( "clsPmieducarEscolaSerieDisciplina" ) ) | |
233 | - { | |
234 | - $tmp_obj = new clsPmieducarEscolaSerieDisciplina( $ref_cod_serie, $ref_cod_escola, $ref_cod_disciplina ); | |
235 | - if( method_exists( $tmp_obj, "existe") ) | |
236 | - { | |
237 | - if( $tmp_obj->existe() ) | |
238 | - { | |
239 | - $this->ref_cod_disciplina = $ref_cod_disciplina; | |
240 | - $this->ref_cod_escola = $ref_cod_escola; | |
241 | - $this->ref_cod_serie = $ref_cod_serie; | |
242 | - } | |
243 | - } | |
244 | - else if( method_exists( $tmp_obj, "detalhe") ) | |
245 | - { | |
246 | - if( $tmp_obj->detalhe() ) | |
247 | - { | |
248 | - $this->ref_cod_disciplina = $ref_cod_disciplina; | |
249 | - $this->ref_cod_escola = $ref_cod_escola; | |
250 | - $this->ref_cod_serie = $ref_cod_serie; | |
251 | - } | |
252 | - } | |
253 | - } | |
254 | - else | |
255 | - { | |
256 | - if( $db->CampoUnico( "SELECT 1 FROM pmieducar.escola_serie_disciplina WHERE ref_cod_disciplina = '{$ref_cod_disciplina}' AND ref_cod_escola = '{$ref_cod_escola}' AND ref_cod_serie = '{$ref_cod_serie}'" ) ) | |
257 | - { | |
258 | - $this->ref_cod_disciplina = $ref_cod_disciplina; | |
259 | - $this->ref_cod_escola = $ref_cod_escola; | |
260 | - $this->ref_cod_serie = $ref_cod_serie; | |
261 | - } | |
262 | - } | |
263 | - } | |
264 | - | |
265 | - | |
266 | - if( is_string( $data_cadastro ) ) | |
267 | - { | |
268 | - $this->data_cadastro = $data_cadastro; | |
269 | - } | |
270 | - if( is_string( $data_exclusao ) ) | |
271 | - { | |
272 | - $this->data_exclusao = $data_exclusao; | |
273 | - } | |
274 | - if( is_numeric( $ativo ) ) | |
275 | - { | |
276 | - $this->ativo = $ativo; | |
277 | - } | |
278 | - if( is_string( $observacao ) ) | |
279 | - { | |
280 | - $this->observacao = $observacao; | |
281 | - } | |
282 | - if (is_numeric($cod_dispensa)) | |
283 | - { | |
284 | - $this->cod_dispensa = $cod_dispensa; | |
285 | - } | |
286 | - } | |
287 | - | |
288 | - /** | |
289 | - * Cria um novo registro | |
290 | - * | |
291 | - * @return bool | |
292 | - */ | |
293 | - function cadastra() | |
294 | - { | |
295 | - if (is_numeric($this->ref_cod_matricula) && is_numeric($this->ref_cod_serie) && | |
296 | - is_numeric($this->ref_cod_escola) && is_numeric($this->ref_cod_disciplina) && | |
297 | - is_numeric($this->ref_usuario_cad) && is_numeric($this->ref_cod_tipo_dispensa) && | |
298 | - is_numeric($this->cod_dispensa)) | |
299 | - { | |
300 | - $db = new clsBanco(); | |
301 | - | |
302 | - $campos = ""; | |
303 | - $valores = ""; | |
304 | - $gruda = ""; | |
305 | - | |
306 | - if( is_numeric( $this->ref_cod_matricula ) ) | |
307 | - { | |
308 | - $campos .= "{$gruda}ref_cod_matricula"; | |
309 | - $valores .= "{$gruda}'{$this->ref_cod_matricula}'"; | |
310 | - $gruda = ", "; | |
311 | - } | |
312 | - if( is_numeric( $this->ref_cod_serie ) ) | |
313 | - { | |
314 | - $campos .= "{$gruda}ref_cod_serie"; | |
315 | - $valores .= "{$gruda}'{$this->ref_cod_serie}'"; | |
316 | - $gruda = ", "; | |
317 | - } | |
318 | - if( is_numeric( $this->ref_cod_escola ) ) | |
319 | - { | |
320 | - $campos .= "{$gruda}ref_cod_escola"; | |
321 | - $valores .= "{$gruda}'{$this->ref_cod_escola}'"; | |
322 | - $gruda = ", "; | |
323 | - } | |
324 | - if( is_numeric( $this->ref_cod_disciplina ) ) | |
325 | - { | |
326 | - $campos .= "{$gruda}ref_cod_disciplina"; | |
327 | - $valores .= "{$gruda}'{$this->ref_cod_disciplina}'"; | |
328 | - $gruda = ", "; | |
329 | - } | |
330 | - if( is_numeric( $this->ref_usuario_cad ) ) | |
331 | - { | |
332 | - $campos .= "{$gruda}ref_usuario_cad"; | |
333 | - $valores .= "{$gruda}'{$this->ref_usuario_cad}'"; | |
334 | - $gruda = ", "; | |
335 | - } | |
336 | - if( is_numeric( $this->ref_cod_tipo_dispensa ) ) | |
337 | - { | |
338 | - $campos .= "{$gruda}ref_cod_tipo_dispensa"; | |
339 | - $valores .= "{$gruda}'{$this->ref_cod_tipo_dispensa}'"; | |
340 | - $gruda = ", "; | |
341 | - } | |
342 | - | |
343 | - $campos .= "{$gruda}data_cadastro"; | |
344 | - $valores .= "{$gruda}NOW()"; | |
345 | - $gruda = ", "; | |
346 | - $campos .= "{$gruda}ativo"; | |
347 | - $valores .= "{$gruda}'1'"; | |
348 | - $gruda = ", "; | |
349 | - if( is_string( $this->observacao ) ) | |
350 | - { | |
351 | - $campos .= "{$gruda}observacao"; | |
352 | - $valores .= "{$gruda}'{$this->observacao}'"; | |
353 | - $gruda = ", "; | |
354 | - } | |
355 | - | |
356 | - if( is_numeric( $this->cod_dispensa ) ) | |
357 | - { | |
358 | - $campos .= "{$gruda}cod_dispensa"; | |
359 | - $valores .= "{$gruda}'{$this->cod_dispensa}'"; | |
360 | - $gruda = ", "; | |
361 | - } | |
362 | - | |
363 | - $sql = "INSERT INTO {$this->_tabela} ($campos) VALUES($valores)"; | |
364 | - $db->Consulta($sql); | |
365 | - return true; | |
366 | - } | |
367 | - return false; | |
368 | - } | |
369 | - | |
370 | - /** | |
371 | - * Edita os dados de um registro | |
372 | - * | |
373 | - * @return bool | |
374 | - */ | |
375 | - function edita() | |
376 | - { | |
377 | - if( is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) && is_numeric( $this->ref_usuario_exc ) ) | |
378 | - { | |
379 | - | |
380 | - $db = new clsBanco(); | |
381 | - $set = ""; | |
382 | - | |
383 | - if( is_numeric( $this->ref_usuario_exc ) ) | |
384 | - { | |
385 | - $set .= "{$gruda}ref_usuario_exc = '{$this->ref_usuario_exc}'"; | |
386 | - $gruda = ", "; | |
387 | - } | |
388 | - if( is_numeric( $this->ref_usuario_cad ) ) | |
389 | - { | |
390 | - $set .= "{$gruda}ref_usuario_cad = '{$this->ref_usuario_cad}'"; | |
391 | - $gruda = ", "; | |
392 | - } | |
393 | - if( is_numeric( $this->ref_cod_tipo_dispensa ) ) | |
394 | - { | |
395 | - $set .= "{$gruda}ref_cod_tipo_dispensa = '{$this->ref_cod_tipo_dispensa}'"; | |
396 | - $gruda = ", "; | |
397 | - } | |
398 | - if( is_string( $this->data_cadastro ) ) | |
399 | - { | |
400 | - $set .= "{$gruda}data_cadastro = '{$this->data_cadastro}'"; | |
401 | - $gruda = ", "; | |
402 | - } | |
403 | - $set .= "{$gruda}data_exclusao = NOW()"; | |
404 | - $gruda = ", "; | |
405 | - if( is_numeric( $this->ativo ) ) | |
406 | - { | |
407 | - $set .= "{$gruda}ativo = '{$this->ativo}'"; | |
408 | - $gruda = ", "; | |
409 | - } | |
410 | - if( is_string( $this->observacao ) ) | |
411 | - { | |
412 | - $set .= "{$gruda}observacao = '{$this->observacao}'"; | |
413 | - $gruda = ", "; | |
414 | - } | |
415 | - | |
416 | - if( $set ) | |
417 | - { | |
418 | - $db->Consulta( "UPDATE {$this->_tabela} SET $set WHERE ref_cod_matricula = '{$this->ref_cod_matricula}' AND ref_cod_serie = '{$this->ref_cod_serie}' AND ref_cod_escola = '{$this->ref_cod_escola}' AND ref_cod_disciplina = '{$this->ref_cod_disciplina}'" ); | |
419 | - return true; | |
420 | - } | |
421 | - } | |
422 | - return false; | |
423 | - } | |
424 | - | |
425 | - /** | |
426 | - * Retorna uma lista filtrados de acordo com os parametros | |
427 | - * | |
428 | - * @return array | |
429 | - */ | |
430 | - function lista( $int_ref_cod_matricula = null, $int_ref_cod_serie = null, $int_ref_cod_escola = null, $int_ref_cod_disciplina = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_cod_tipo_dispensa = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $str_observacao = null ) | |
431 | - { | |
432 | - $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}"; | |
433 | - $filtros = ""; | |
434 | - | |
435 | - $whereAnd = " WHERE "; | |
436 | - | |
437 | - if( is_numeric( $int_ref_cod_matricula ) ) | |
438 | - { | |
439 | - $filtros .= "{$whereAnd} ref_cod_matricula = '{$int_ref_cod_matricula}'"; | |
440 | - $whereAnd = " AND "; | |
441 | - } | |
442 | - if( is_numeric( $int_ref_cod_serie ) ) | |
443 | - { | |
444 | - $filtros .= "{$whereAnd} ref_cod_serie = '{$int_ref_cod_serie}'"; | |
445 | - $whereAnd = " AND "; | |
446 | - } | |
447 | - if( is_numeric( $int_ref_cod_escola ) ) | |
448 | - { | |
449 | - $filtros .= "{$whereAnd} ref_cod_escola = '{$int_ref_cod_escola}'"; | |
450 | - $whereAnd = " AND "; | |
451 | - } | |
452 | - if( is_numeric( $int_ref_cod_disciplina ) ) | |
453 | - { | |
454 | - $filtros .= "{$whereAnd} ref_cod_disciplina = '{$int_ref_cod_disciplina}'"; | |
455 | - $whereAnd = " AND "; | |
456 | - } | |
457 | - if( is_numeric( $int_ref_usuario_exc ) ) | |
458 | - { | |
459 | - $filtros .= "{$whereAnd} ref_usuario_exc = '{$int_ref_usuario_exc}'"; | |
460 | - $whereAnd = " AND "; | |
461 | - } | |
462 | - if( is_numeric( $int_ref_usuario_cad ) ) | |
463 | - { | |
464 | - $filtros .= "{$whereAnd} ref_usuario_cad = '{$int_ref_usuario_cad}'"; | |
465 | - $whereAnd = " AND "; | |
466 | - } | |
467 | - if( is_numeric( $int_ref_cod_tipo_dispensa ) ) | |
468 | - { | |
469 | - $filtros .= "{$whereAnd} ref_cod_tipo_dispensa = '{$int_ref_cod_tipo_dispensa}'"; | |
470 | - $whereAnd = " AND "; | |
471 | - } | |
472 | - if( is_string( $date_data_cadastro_ini ) ) | |
473 | - { | |
474 | - $filtros .= "{$whereAnd} data_cadastro >= '{$date_data_cadastro_ini}'"; | |
475 | - $whereAnd = " AND "; | |
476 | - } | |
477 | - if( is_string( $date_data_cadastro_fim ) ) | |
478 | - { | |
479 | - $filtros .= "{$whereAnd} data_cadastro <= '{$date_data_cadastro_fim}'"; | |
480 | - $whereAnd = " AND "; | |
481 | - } | |
482 | - if( is_string( $date_data_exclusao_ini ) ) | |
483 | - { | |
484 | - $filtros .= "{$whereAnd} data_exclusao >= '{$date_data_exclusao_ini}'"; | |
485 | - $whereAnd = " AND "; | |
486 | - } | |
487 | - if( is_string( $date_data_exclusao_fim ) ) | |
488 | - { | |
489 | - $filtros .= "{$whereAnd} data_exclusao <= '{$date_data_exclusao_fim}'"; | |
490 | - $whereAnd = " AND "; | |
491 | - } | |
492 | - if( is_null( $int_ativo ) || $int_ativo ) | |
493 | - { | |
494 | - $filtros .= "{$whereAnd} ativo = '1'"; | |
495 | - $whereAnd = " AND "; | |
496 | - } | |
497 | - else | |
498 | - { | |
499 | - $filtros .= "{$whereAnd} ativo = '0'"; | |
500 | - $whereAnd = " AND "; | |
501 | - } | |
502 | - if( is_string( $str_observacao ) ) | |
503 | - { | |
504 | - $filtros .= "{$whereAnd} observacao LIKE '%{$str_observacao}%'"; | |
505 | - $whereAnd = " AND "; | |
506 | - } | |
507 | - | |
508 | - $db = new clsBanco(); | |
509 | - $countCampos = count( explode( ",", $this->_campos_lista ) ); | |
510 | - $resultado = array(); | |
511 | - | |
512 | - $sql .= $filtros . $this->getOrderby() . $this->getLimite(); | |
513 | - | |
514 | - $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} {$filtros}" ); | |
515 | - $db->Consulta( $sql ); | |
516 | - | |
517 | - if( $countCampos > 1 ) | |
518 | - { | |
519 | - while ( $db->ProximoRegistro() ) | |
520 | - { | |
521 | - $tupla = $db->Tupla(); | |
522 | - | |
523 | - $tupla["_total"] = $this->_total; | |
524 | - $resultado[] = $tupla; | |
525 | - } | |
526 | - } | |
527 | - else | |
528 | - { | |
529 | - while ( $db->ProximoRegistro() ) | |
530 | - { | |
531 | - $tupla = $db->Tupla(); | |
532 | - $resultado[] = $tupla[$this->_campos_lista]; | |
533 | - } | |
534 | - } | |
535 | - if( count( $resultado ) ) | |
536 | - { | |
537 | - return $resultado; | |
538 | - } | |
539 | - return false; | |
540 | - } | |
541 | - | |
542 | - /** | |
543 | - * Retorna um array com os dados de um registro | |
544 | - * | |
545 | - * @return array | |
546 | - */ | |
547 | - function detalhe() | |
548 | - { | |
549 | - if( is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) ) | |
550 | - { | |
551 | - | |
552 | - $db = new clsBanco(); | |
553 | - $db->Consulta( "SELECT {$this->_todos_campos} FROM {$this->_tabela} WHERE ref_cod_matricula = '{$this->ref_cod_matricula}' AND ref_cod_serie = '{$this->ref_cod_serie}' AND ref_cod_escola = '{$this->ref_cod_escola}' AND ref_cod_disciplina = '{$this->ref_cod_disciplina}'" ); | |
554 | - $db->ProximoRegistro(); | |
555 | - return $db->Tupla(); | |
556 | - } | |
557 | - return false; | |
558 | - } | |
559 | - | |
560 | - /** | |
561 | - * Retorna um array com os dados de um registro | |
562 | - * | |
563 | - * @return array | |
564 | - */ | |
565 | - function existe() | |
566 | - { | |
567 | - if( is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) ) | |
568 | - { | |
569 | - | |
570 | - $db = new clsBanco(); | |
571 | - $db->Consulta( "SELECT 1 FROM {$this->_tabela} WHERE ref_cod_matricula = '{$this->ref_cod_matricula}' AND ref_cod_serie = '{$this->ref_cod_serie}' AND ref_cod_escola = '{$this->ref_cod_escola}' AND ref_cod_disciplina = '{$this->ref_cod_disciplina}'" ); | |
572 | - $db->ProximoRegistro(); | |
573 | - return $db->Tupla(); | |
574 | - } | |
575 | - return false; | |
576 | - } | |
577 | - | |
578 | - /** | |
579 | - * Exclui um registro | |
580 | - * | |
581 | - * @return bool | |
582 | - */ | |
583 | - function excluir() | |
584 | - { | |
585 | - if( is_numeric( $this->ref_cod_matricula ) && is_numeric( $this->ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_disciplina ) && is_numeric( $this->ref_usuario_exc ) ) | |
586 | - { | |
587 | - | |
588 | - /* | |
589 | - delete | |
590 | - $db = new clsBanco(); | |
591 | - $db->Consulta( "DELETE FROM {$this->_tabela} WHERE ref_ref_cod_turma = '{$this->ref_ref_cod_turma}' AND ref_cod_matricula = '{$this->ref_cod_matricula}' AND ref_cod_serie = '{$this->ref_cod_serie}' AND ref_cod_escola = '{$this->ref_cod_escola}' AND ref_cod_disciplina = '{$this->ref_cod_disciplina}'" ); | |
592 | - return true; | |
593 | - */ | |
594 | - | |
595 | - $this->ativo = 0; | |
596 | - return $this->edita(); | |
597 | - } | |
598 | - return false; | |
599 | - } | |
600 | - | |
601 | - /** | |
602 | - * Define quais campos da tabela serao selecionados na invocacao do metodo lista | |
603 | - * | |
604 | - * @return null | |
605 | - */ | |
606 | - function setCamposLista( $str_campos ) | |
607 | - { | |
608 | - $this->_campos_lista = $str_campos; | |
609 | - } | |
610 | - | |
611 | - /** | |
612 | - * Define que o metodo Lista devera retornoar todos os campos da tabela | |
613 | - * | |
614 | - * @return null | |
615 | - */ | |
616 | - function resetCamposLista() | |
617 | - { | |
618 | - $this->_campos_lista = $this->_todos_campos; | |
619 | - } | |
620 | - | |
621 | - /** | |
622 | - * Define limites de retorno para o metodo lista | |
623 | - * | |
624 | - * @return null | |
625 | - */ | |
626 | - function setLimite( $intLimiteQtd, $intLimiteOffset = null ) | |
627 | - { | |
628 | - $this->_limite_quantidade = $intLimiteQtd; | |
629 | - $this->_limite_offset = $intLimiteOffset; | |
630 | - } | |
631 | - | |
632 | - /** | |
633 | - * Retorna a string com o trecho da query resposavel pelo Limite de registros | |
634 | - * | |
635 | - * @return string | |
636 | - */ | |
637 | - function getLimite() | |
638 | - { | |
639 | - if( is_numeric( $this->_limite_quantidade ) ) | |
640 | - { | |
641 | - $retorno = " LIMIT {$this->_limite_quantidade}"; | |
642 | - if( is_numeric( $this->_limite_offset ) ) | |
643 | - { | |
644 | - $retorno .= " OFFSET {$this->_limite_offset} "; | |
645 | - } | |
646 | - return $retorno; | |
647 | - } | |
648 | - return ""; | |
649 | - } | |
650 | - | |
651 | - /** | |
652 | - * Define campo para ser utilizado como ordenacao no metolo lista | |
653 | - * | |
654 | - * @return null | |
655 | - */ | |
656 | - function setOrderby( $strNomeCampo ) | |
657 | - { | |
658 | - // limpa a string de possiveis erros (delete, insert, etc) | |
659 | - //$strNomeCampo = eregi_replace(); | |
660 | - | |
661 | - if( is_string( $strNomeCampo ) && $strNomeCampo ) | |
662 | - { | |
663 | - $this->_campo_order_by = $strNomeCampo; | |
664 | - } | |
665 | - } | |
666 | - | |
667 | - /** | |
668 | - * Retorna a string com o trecho da query resposavel pela Ordenacao dos registros | |
669 | - * | |
670 | - * @return string | |
671 | - */ | |
672 | - function getOrderby() | |
673 | - { | |
674 | - if( is_string( $this->_campo_order_by ) ) | |
675 | - { | |
676 | - return " ORDER BY {$this->_campo_order_by} "; | |
677 | - } | |
678 | - return ""; | |
679 | - } | |
680 | - | |
681 | -} | |
682 | -?> | |
45 | + var $ref_cod_matricula; | |
46 | + var $ref_cod_serie; | |
47 | + var $ref_cod_escola; | |
48 | + var $ref_cod_disciplina; | |
49 | + var $ref_usuario_exc; | |
50 | + var $ref_usuario_cad; | |
51 | + var $ref_cod_tipo_dispensa; | |
52 | + var $data_cadastro; | |
53 | + var $data_exclusao; | |
54 | + var $ativo; | |
55 | + var $observacao; | |
56 | + var $cod_dispensa; | |
57 | + | |
58 | + /** | |
59 | + * Armazena o total de resultados obtidos na última chamada ao método lista(). | |
60 | + * @var int | |
61 | + */ | |
62 | + var $_total; | |
63 | + | |
64 | + /** | |
65 | + * Nome do schema. | |
66 | + * @var string | |
67 | + */ | |
68 | + var $_schema; | |
69 | + | |
70 | + /** | |
71 | + * Nome da tabela. | |
72 | + * @var string | |
73 | + */ | |
74 | + var $_tabela; | |
75 | + | |
76 | + /** | |
77 | + * Lista separada por vírgula, com os campos que devem ser selecionados na | |
78 | + * próxima chamado ao método lista(). | |
79 | + * @var string | |
80 | + */ | |
81 | + var $_campos_lista; | |
82 | + | |
83 | + /** | |
84 | + * Lista com todos os campos da tabela separados por vírgula, padrão para | |
85 | + * seleção no método lista. | |
86 | + * @var string | |
87 | + */ | |
88 | + var $_todos_campos; | |
89 | + | |
90 | + /** | |
91 | + * Valor que define a quantidade de registros a ser retornada pelo método lista(). | |
92 | + * @var int | |
93 | + */ | |
94 | + var $_limite_quantidade; | |
95 | + | |
96 | + /** | |
97 | + * Define o valor de offset no retorno dos registros no método lista(). | |
98 | + * @var int | |
99 | + */ | |
100 | + var $_limite_offset; | |
101 | + | |
102 | + /** | |
103 | + * Define o campo para ser usado como padrão de ordenação no método lista(). | |
104 | + * @var string | |
105 | + */ | |
106 | + var $_campo_order_by; | |
107 | + | |
108 | + /** | |
109 | + * Construtor. | |
110 | + */ | |
111 | + function clsPmieducarDispensaDisciplina($ref_cod_matricula = NULL, | |
112 | + $ref_cod_serie = NULL, $ref_cod_escola = NULL, $ref_cod_disciplina = NULL, | |
113 | + $ref_usuario_exc = NULL, $ref_usuario_cad = NULL, $ref_cod_tipo_dispensa = NULL, | |
114 | + $data_cadastro = NULL, $data_exclusao = NULL, $ativo = NULL, $observacao = NULL, | |
115 | + $cod_dispensa = NULL) | |
116 | + { | |
117 | + $db = new clsBanco(); | |
118 | + $this->_schema = "pmieducar."; | |
119 | + $this->_tabela = "{$this->_schema}dispensa_disciplina"; | |
120 | + | |
121 | + $this->_campos_lista = $this->_todos_campos = "ref_cod_matricula, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, ref_usuario_exc, ref_usuario_cad, ref_cod_tipo_dispensa, data_cadastro, data_exclusao, ativo, observacao"; | |
122 | + | |
123 | + if (is_numeric($ref_usuario_exc)) { | |
124 | + if (class_exists("clsPmieducarUsuario")) { | |
125 | + $tmp_obj = new clsPmieducarUsuario($ref_usuario_exc); | |
126 | + if (method_exists($tmp_obj, "existe")) { | |
127 | + if ($tmp_obj->existe()) { | |
128 | + $this->ref_usuario_exc = $ref_usuario_exc; | |
129 | + } | |
130 | + } | |
131 | + elseif (method_exists($tmp_obj, "detalhe")) { | |
132 | + if ($tmp_obj->detalhe()) { | |
133 | + $this->ref_usuario_exc = $ref_usuario_exc; | |
134 | + } | |
135 | + } | |
136 | + } | |
137 | + else { | |
138 | + if ($db->CampoUnico("SELECT 1 FROM pmieducar.usuario WHERE cod_usuario = '{$ref_usuario_exc}'")) { | |
139 | + $this->ref_usuario_exc = $ref_usuario_exc; | |
140 | + } | |
141 | + } | |
142 | + } | |
143 | + | |
144 | + if (is_numeric($ref_usuario_cad)) { | |
145 | + if (class_exists("clsPmieducarUsuario")) { | |
146 | + $tmp_obj = new clsPmieducarUsuario($ref_usuario_cad); | |
147 | + if (method_exists($tmp_obj, "existe")) { | |
148 | + if ($tmp_obj->existe()) { | |
149 | + $this->ref_usuario_cad = $ref_usuario_cad; | |
150 | + } | |
151 | + } | |
152 | + elseif (method_exists($tmp_obj, "detalhe")) { | |
153 | + if ($tmp_obj->detalhe()) { | |
154 | + $this->ref_usuario_cad = $ref_usuario_cad; | |
155 | + } | |
156 | + } | |
157 | + } | |
158 | + else { | |
159 | + if ($db->CampoUnico("SELECT 1 FROM pmieducar.usuario WHERE cod_usuario = '{$ref_usuario_cad}'")) { | |
160 | + $this->ref_usuario_cad = $ref_usuario_cad; | |
161 | + } | |
162 | + } | |
163 | + } | |
164 | + | |
165 | + if (is_numeric($ref_cod_matricula)) { | |
166 | + if (class_exists("clsPmieducarMatricula")) { | |
167 | + $tmp_obj = new clsPmieducarMatricula($ref_cod_matricula); | |
168 | + if (method_exists($tmp_obj, "existe")) { | |
169 | + if ($tmp_obj->existe()) { | |
170 | + $this->ref_cod_matricula = $ref_cod_matricula; | |
171 | + } | |
172 | + } | |
173 | + elseif (method_exists($tmp_obj, "detalhe")) { | |
174 | + if ($tmp_obj->detalhe()) { | |
175 | + $this->ref_cod_matricula = $ref_cod_matricula; | |
176 | + } | |
177 | + } | |
178 | + } | |
179 | + else { | |
180 | + if ($db->CampoUnico("SELECT 1 FROM pmieducar.matricula WHERE ref_cod_matricula = '{$ref_cod_matricula}'")) { | |
181 | + $this->ref_cod_matricula = $ref_cod_matricula; | |
182 | + } | |
183 | + } | |
184 | + } | |
185 | + | |
186 | + if (is_numeric($ref_cod_tipo_dispensa)) { | |
187 | + if (class_exists("clsPmieducarTipoDispensa")) { | |
188 | + $tmp_obj = new clsPmieducarTipoDispensa($ref_cod_tipo_dispensa); | |
189 | + if (method_exists($tmp_obj, "existe")) { | |
190 | + if ($tmp_obj->existe()) { | |
191 | + $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa; | |
192 | + } | |
193 | + } | |
194 | + elseif (method_exists($tmp_obj, "detalhe")) { | |
195 | + if ($tmp_obj->detalhe()) { | |
196 | + $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa; | |
197 | + } | |
198 | + } | |
199 | + } | |
200 | + else { | |
201 | + if ($db->CampoUnico("SELECT 1 FROM pmieducar.tipo_dispensa WHERE cod_tipo_dispensa = '{$ref_cod_tipo_dispensa}'")) { | |
202 | + $this->ref_cod_tipo_dispensa = $ref_cod_tipo_dispensa; | |
203 | + } | |
204 | + } | |
205 | + } | |
206 | + | |
207 | + if (is_numeric($ref_cod_disciplina) && is_numeric($ref_cod_escola) && is_numeric($ref_cod_serie)) { | |
208 | + if (class_exists("clsPmieducarEscolaSerieDisciplina")) { | |
209 | + $tmp_obj = new clsPmieducarEscolaSerieDisciplina($ref_cod_serie, $ref_cod_escola, $ref_cod_disciplina); | |
210 | + if (method_exists($tmp_obj, "existe")) { | |
211 | + if ($tmp_obj->existe()) { | |
212 | + $this->ref_cod_disciplina = $ref_cod_disciplina; | |
213 | + $this->ref_cod_escola = $ref_cod_escola; | |
214 | + $this->ref_cod_serie = $ref_cod_serie; | |
215 | + } | |
216 | + } | |
217 | + elseif (method_exists($tmp_obj, "detalhe")) { | |
218 | + if ($tmp_obj->detalhe()) { | |
219 | + $this->ref_cod_disciplina = $ref_cod_disciplina; | |
220 | + $this->ref_cod_escola = $ref_cod_escola; | |
221 | + $this->ref_cod_serie = $ref_cod_serie; | |
222 | + } | |
223 | + } | |
224 | + } | |
225 | + else { | |
226 | + if ($db->CampoUnico("SELECT 1 FROM pmieducar.escola_serie_disciplina WHERE ref_cod_disciplina = '{$ref_cod_disciplina}' AND ref_cod_escola = '{$ref_cod_escola}' AND ref_cod_serie = '{$ref_cod_serie}'")) { | |
227 | + $this->ref_cod_disciplina = $ref_cod_disciplina; | |
228 | + $this->ref_cod_escola = $ref_cod_escola; | |
229 | + $this->ref_cod_serie = $ref_cod_serie; | |
230 | + } | |
231 | + } | |
232 | + } | |
233 | + | |
234 | + if (is_string($data_cadastro)) { | |
235 | + $this->data_cadastro = $data_cadastro; | |
236 | + } | |
237 | + | |
238 | + if (is_string($data_exclusao)) { | |
239 | + $this->data_exclusao = $data_exclusao; | |
240 | + } | |
241 | + | |
242 | + if (is_numeric($ativo)) { | |
243 | + $this->ativo = $ativo; | |
244 | + } | |
245 | + | |
246 | + if (is_string($observacao)) { | |
247 | + $this->observacao = $observacao; | |
248 | + } | |
249 | + | |
250 | + if (is_numeric($cod_dispensa)) { | |
251 | + $this->cod_dispensa = $cod_dispensa; | |
252 | + } | |
253 | + } | |
254 | + | |
255 | + /** | |
256 | + * Cria um novo registro. | |
257 | + * @return bool | |
258 | + */ | |
259 | + function cadastra() | |
260 | + { | |
261 | + if (is_numeric($this->ref_cod_matricula) && is_numeric($this->ref_cod_serie) && | |
262 | + is_numeric($this->ref_cod_escola) && is_numeric($this->ref_cod_disciplina) && | |
263 | + is_numeric($this->ref_usuario_cad) && is_numeric($this->ref_cod_tipo_dispensa) && | |
264 | + is_numeric($this->cod_dispensa)) | |
265 | + { | |
266 | + $db = new clsBanco(); | |
267 | + | |
268 | + $campos = ''; | |
269 | + $valores = ''; | |
270 | + $gruda = ''; | |
271 | + | |
272 | + if (is_numeric($this->ref_cod_matricula)) { | |
273 | + $campos .= "{$gruda}ref_cod_matricula"; | |
274 | + $valores .= "{$gruda}'{$this->ref_cod_matricula}'"; | |
275 | + $gruda = ', '; | |
276 | + } | |
277 | + | |
278 | + if (is_numeric($this->ref_cod_serie)) { | |
279 | + $campos .= "{$gruda}ref_cod_serie"; | |
280 | + $valores .= "{$gruda}'{$this->ref_cod_serie}'"; | |
281 | + $gruda = ', '; | |
282 | + } | |
283 | + | |
284 | + if (is_numeric($this->ref_cod_escola)) { | |
285 | + $campos .= "{$gruda}ref_cod_escola"; | |
286 | + $valores .= "{$gruda}'{$this->ref_cod_escola}'"; | |
287 | + $gruda = ', '; | |
288 | + } | |
289 | + | |
290 | + if (is_numeric($this->ref_cod_disciplina)) { | |
291 | + $campos .= "{$gruda}ref_cod_disciplina"; | |
292 | + $valores .= "{$gruda}'{$this->ref_cod_disciplina}'"; | |
293 | + $gruda = ', '; | |
294 | + } | |
295 | + | |
296 | + if (is_numeric($this->ref_usuario_cad)) { | |
297 | + $campos .= "{$gruda}ref_usuario_cad"; | |
298 | + $valores .= "{$gruda}'{$this->ref_usuario_cad}'"; | |
299 | + $gruda = ', '; | |
300 | + } | |
301 | + | |
302 | + if (is_numeric($this->ref_cod_tipo_dispensa)) { | |
303 | + $campos .= "{$gruda}ref_cod_tipo_dispensa"; | |
304 | + $valores .= "{$gruda}'{$this->ref_cod_tipo_dispensa}'"; | |
305 | + $gruda = ', '; | |
306 | + } | |
307 | + | |
308 | + $campos .= "{$gruda}data_cadastro"; | |
309 | + $valores .= "{$gruda}NOW()"; | |
310 | + $gruda = ', '; | |
311 | + | |
312 | + $campos .= "{$gruda}ativo"; | |
313 | + $valores .= "{$gruda}'1'"; | |
314 | + $gruda = ', '; | |
315 | + | |
316 | + if (is_string($this->observacao)) { | |
317 | + $campos .= "{$gruda}observacao"; | |
318 | + $valores .= "{$gruda}'{$this->observacao}'"; | |
319 | + $gruda = ', '; | |
320 | + } | |
321 | + | |
322 | + if (is_numeric($this->cod_dispensa)) { | |
323 | + $campos .= "{$gruda}cod_dispensa"; | |
324 | + $valores .= "{$gruda}'{$this->cod_dispensa}'"; | |
325 | + $gruda = ', '; | |
326 | + } | |
327 | + | |
328 | + $sql = "INSERT INTO {$this->_tabela} ($campos) VALUES ($valores)"; | |
329 | + $db->Consulta($sql); | |
330 | + return TRUE; | |
331 | + } | |
332 | + | |
333 | + return FALSE; | |
334 | + } | |
335 | + | |
336 | + /** | |
337 | + * Edita os dados de um registro. | |
338 | + * @return bool | |
339 | + */ | |
340 | + function edita() | |
341 | + { | |
342 | + if (is_numeric($this->ref_cod_matricula) && is_numeric($this->ref_cod_serie) && | |
343 | + is_numeric($this->ref_cod_escola) && is_numeric($this->ref_cod_disciplina) && | |
344 | + is_numeric($this->ref_usuario_exc) | |
345 | + ) { | |
346 | + $db = new clsBanco(); | |
347 | + $set = ''; | |
348 | + | |
349 | + if (is_numeric($this->ref_usuario_exc)) { | |
350 | + $set .= "{$gruda}ref_usuario_exc = '{$this->ref_usuario_exc}'"; | |
351 | + $gruda = ', '; | |
352 | + } | |
353 | + | |
354 | + if (is_numeric($this->ref_usuario_cad)) { | |
355 | + $set .= "{$gruda}ref_usuario_cad = '{$this->ref_usuario_cad}'"; | |
356 | + $gruda = ', '; | |
357 | + } | |
358 | + | |
359 | + if (is_numeric($this->ref_cod_tipo_dispensa)) { | |
360 | + $set .= "{$gruda}ref_cod_tipo_dispensa = '{$this->ref_cod_tipo_dispensa}'"; | |
361 | + $gruda = ', '; | |
362 | + } | |
363 | + | |
364 | + if (is_string($this->data_cadastro)) { | |
365 | + $set .= "{$gruda}data_cadastro = '{$this->data_cadastro}'"; | |
366 | + $gruda = ', '; | |
367 | + } | |
368 | + | |
369 | + $set .= "{$gruda}data_exclusao = NOW()"; | |
370 | + $gruda = ', '; | |
371 | + | |
372 | + if (is_numeric($this->ativo)) { | |
373 | + $set .= "{$gruda}ativo = '{$this->ativo}'"; | |
374 | + $gruda = ', '; | |
375 | + } | |
376 | + | |
377 | + if (is_string($this->observacao)) { | |
378 | + $set .= "{$gruda}observacao = '{$this->observacao}'"; | |
379 | + $gruda = ', '; | |
380 | + } | |
381 | + | |
382 | + if ($set) { | |
383 | + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE ref_cod_matricula = '{$this->ref_cod_matricula}' AND ref_cod_serie = '{$this->ref_cod_serie}' AND ref_cod_escola = '{$this->ref_cod_escola}' AND ref_cod_disciplina = '{$this->ref_cod_disciplina}'"); | |
384 | + return TRUE; | |
385 | + } | |
386 | + } | |
387 | + | |
388 | + return FALSE; | |
389 | + } | |
390 | + | |
391 | + /** | |
392 | + * Retorna uma lista de registros filtrados de acordo com os parâmetros. | |
393 | + * @return array | |
394 | + */ | |
395 | + function lista($int_ref_cod_matricula = NULL, $int_ref_cod_serie = NULL, | |
396 | + $int_ref_cod_escola = NULL, $int_ref_cod_disciplina = NULL, | |
397 | + $int_ref_usuario_exc = NULL, $int_ref_usuario_cad = NULL, | |
398 | + $int_ref_cod_tipo_dispensa = NULL, $date_data_cadastro_ini = NULL, | |
399 | + $date_data_cadastro_fim = NULL, $date_data_exclusao_ini = NULL, | |
400 | + $date_data_exclusao_fim = NULL, $int_ativo = NULL, $str_observacao = NULL) | |
401 | + { | |
402 | + $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}"; | |
403 | + $filtros = ''; | |
404 | + | |
405 | + $whereAnd = ' WHERE '; | |
406 | + | |
407 | + if (is_numeric($int_ref_cod_matricula)) { | |
408 | + $filtros .= "{$whereAnd} ref_cod_matricula = '{$int_ref_cod_matricula}'"; | |
409 | + $whereAnd = ' AND '; | |
410 | + } | |
411 | + | |
412 | + if (is_numeric($int_ref_cod_serie)) { | |
413 | + $filtros .= "{$whereAnd} ref_cod_serie = '{$int_ref_cod_serie}'"; | |
414 | + $whereAnd = ' AND '; | |
415 | + } | |
416 | + | |
417 | + if (is_numeric($int_ref_cod_escola)) { | |
418 | + $filtros .= "{$whereAnd} ref_cod_escola = '{$int_ref_cod_escola}'"; | |
419 | + $whereAnd = ' AND '; | |
420 | + } | |
421 | + | |
422 | + if (is_numeric($int_ref_cod_disciplina)) { | |
423 | + $filtros .= "{$whereAnd} ref_cod_disciplina = '{$int_ref_cod_disciplina}'"; | |
424 | + $whereAnd = ' AND '; | |
425 | + } | |
426 | + | |
427 | + if (is_numeric($int_ref_usuario_exc)) { | |
428 | + $filtros .= "{$whereAnd} ref_usuario_exc = '{$int_ref_usuario_exc}'"; | |
429 | + $whereAnd = ' AND '; | |
430 | + } | |
431 | + | |
432 | + if (is_numeric($int_ref_usuario_cad)) { | |
433 | + $filtros .= "{$whereAnd} ref_usuario_cad = '{$int_ref_usuario_cad}'"; | |
434 | + $whereAnd = ' AND '; | |
435 | + } | |
436 | + | |
437 | + if (is_numeric($int_ref_cod_tipo_dispensa)) { | |
438 | + $filtros .= "{$whereAnd} ref_cod_tipo_dispensa = '{$int_ref_cod_tipo_dispensa}'"; | |
439 | + $whereAnd = ' AND '; | |
440 | + } | |
441 | + | |
442 | + if (is_string($date_data_cadastro_ini)) { | |
443 | + $filtros .= "{$whereAnd} data_cadastro >= '{$date_data_cadastro_ini}'"; | |
444 | + $whereAnd = ' AND '; | |
445 | + } | |
446 | + | |
447 | + if (is_string($date_data_cadastro_fim)) { | |
448 | + $filtros .= "{$whereAnd} data_cadastro <= '{$date_data_cadastro_fim}'"; | |
449 | + $whereAnd = ' AND '; | |
450 | + } | |
451 | + | |
452 | + if (is_string($date_data_exclusao_ini)) { | |
453 | + $filtros .= "{$whereAnd} data_exclusao >= '{$date_data_exclusao_ini}'"; | |
454 | + $whereAnd = ' AND '; | |
455 | + } | |
456 | + | |
457 | + if (is_string($date_data_exclusao_fim)) { | |
458 | + $filtros .= "{$whereAnd} data_exclusao <= '{$date_data_exclusao_fim}'"; | |
459 | + $whereAnd = ' AND '; | |
460 | + } | |
461 | + | |
462 | + if (is_null($int_ativo) || $int_ativo) { | |
463 | + $filtros .= "{$whereAnd} ativo = '1'"; | |
464 | + $whereAnd = ' AND '; | |
465 | + } | |
466 | + else { | |
467 | + $filtros .= "{$whereAnd} ativo = '0'"; | |
468 | + $whereAnd = ' AND '; | |
469 | + } | |
470 | + | |
471 | + if (is_string($str_observacao)) { | |
472 | + $filtros .= "{$whereAnd} observacao LIKE '%{$str_observacao}%'"; | |
473 | + $whereAnd = ' AND '; | |
474 | + } | |
475 | + | |
476 | + $db = new clsBanco(); | |
477 | + $countCampos = count(explode(',', $this->_campos_lista)); | |
478 | + $resultado = array(); | |
479 | + | |
480 | + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); | |
481 | + | |
482 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}"); | |
483 | + $db->Consulta($sql); | |
484 | + | |
485 | + if ($countCampos > 1) { | |
486 | + while ($db->ProximoRegistro()) { | |
487 | + $tupla = $db->Tupla(); | |
488 | + | |
489 | + $tupla["_total"] = $this->_total; | |
490 | + $resultado[] = $tupla; | |
491 | + } | |
492 | + } | |
493 | + else { | |
494 | + while ($db->ProximoRegistro()) { | |
495 | + $tupla = $db->Tupla(); | |
496 | + $resultado[] = $tupla[$this->_campos_lista]; | |
497 | + } | |
498 | + } | |
499 | + | |
500 | + if (count($resultado)) { | |
501 | + return $resultado; | |
502 | + } | |
503 | + | |
504 | + return FALSE; | |
505 | + } | |
506 | + | |
507 | + /** | |
508 | + * Retorna um array com os dados de um registro. | |
509 | + * @return array | |
510 | + */ | |
511 | + function detalhe() | |
512 | + { | |
513 | + if (is_numeric($this->ref_cod_matricula) && is_numeric($this->ref_cod_serie) && | |
514 | + is_numeric($this->ref_cod_escola) && is_numeric($this->ref_cod_disciplina) | |
515 | + ) { | |
516 | + $db = new clsBanco(); | |
517 | + $db->Consulta("SELECT {$this->_todos_campos} FROM {$this->_tabela} WHERE ref_cod_matricula = '{$this->ref_cod_matricula}' AND ref_cod_serie = '{$this->ref_cod_serie}' AND ref_cod_escola = '{$this->ref_cod_escola}' AND ref_cod_disciplina = '{$this->ref_cod_disciplina}'"); | |
518 | + $db->ProximoRegistro(); | |
519 | + return $db->Tupla(); | |
520 | + } | |
521 | + return FALSE; | |
522 | + } | |
523 | + | |
524 | + /** | |
525 | + * Retorna um array com os dados de um registro | |
526 | + * | |
527 | + * @return array | |
528 | + */ | |
529 | + function existe() | |
530 | + { | |
531 | + if (is_numeric($this->ref_cod_matricula) && is_numeric($this->ref_cod_serie) && | |
532 | + is_numeric($this->ref_cod_escola) && is_numeric($this->ref_cod_disciplina) | |
533 | + ) { | |
534 | + $db = new clsBanco(); | |
535 | + $db->Consulta( "SELECT 1 FROM {$this->_tabela} WHERE ref_cod_matricula = '{$this->ref_cod_matricula}' AND ref_cod_serie = '{$this->ref_cod_serie}' AND ref_cod_escola = '{$this->ref_cod_escola}' AND ref_cod_disciplina = '{$this->ref_cod_disciplina}'" ); | |
536 | + $db->ProximoRegistro(); | |
537 | + return $db->Tupla(); | |
538 | + } | |
539 | + return FALSE; | |
540 | + } | |
541 | + | |
542 | + /** | |
543 | + * Exclui um registro. | |
544 | + * @return bool | |
545 | + */ | |
546 | + function excluir() | |
547 | + { | |
548 | + if (is_numeric($this->ref_cod_matricula) && is_numeric($this->ref_cod_serie) && | |
549 | + is_numeric($this->ref_cod_escola) && is_numeric($this->ref_cod_disciplina) && | |
550 | + is_numeric($this->ref_usuario_exc) | |
551 | + ) { | |
552 | + $this->ativo = 0; | |
553 | + return $this->edita(); | |
554 | + } | |
555 | + return FALSE; | |
556 | + } | |
557 | + | |
558 | + /** | |
559 | + * Define quais campos da tabela serão selecionados no método Lista(). | |
560 | + */ | |
561 | + function setCamposLista($str_campos) | |
562 | + { | |
563 | + $this->_campos_lista = $str_campos; | |
564 | + } | |
565 | + | |
566 | + /** | |
567 | + * Define que o método Lista() deverpa retornar todos os campos da tabela. | |
568 | + */ | |
569 | + function resetCamposLista() | |
570 | + { | |
571 | + $this->_campos_lista = $this->_todos_campos; | |
572 | + } | |
573 | + | |
574 | + /** | |
575 | + * Define limites de retorno para o método Lista(). | |
576 | + */ | |
577 | + function setLimite($intLimiteQtd, $intLimiteOffset = NULL) | |
578 | + { | |
579 | + $this->_limite_quantidade = $intLimiteQtd; | |
580 | + $this->_limite_offset = $intLimiteOffset; | |
581 | + } | |
582 | + | |
583 | + /** | |
584 | + * Retorna a string com o trecho da query responsável pelo limite de | |
585 | + * registros retornados/afetados. | |
586 | + * | |
587 | + * @return string | |
588 | + */ | |
589 | + function getLimite() | |
590 | + { | |
591 | + if (is_numeric($this->_limite_quantidade)) { | |
592 | + $retorno = " LIMIT {$this->_limite_quantidade}"; | |
593 | + if (is_numeric($this->_limite_offset)) { | |
594 | + $retorno .= " OFFSET {$this->_limite_offset} "; | |
595 | + } | |
596 | + return $retorno; | |
597 | + } | |
598 | + return ''; | |
599 | + } | |
600 | + | |
601 | + /** | |
602 | + * Define o campo para ser utilizado como ordenação no método Lista(). | |
603 | + */ | |
604 | + function setOrderby($strNomeCampo) | |
605 | + { | |
606 | + if (is_string($strNomeCampo) && $strNomeCampo ) { | |
607 | + $this->_campo_order_by = $strNomeCampo; | |
608 | + } | |
609 | + } | |
610 | + | |
611 | + /** | |
612 | + * Retorna a string com o trecho da query responsável pela Ordenação dos | |
613 | + * registros. | |
614 | + * | |
615 | + * @return string | |
616 | + */ | |
617 | + function getOrderby() | |
618 | + { | |
619 | + if (is_string($this->_campo_order_by)) { | |
620 | + return " ORDER BY {$this->_campo_order_by} "; | |
621 | + } | |
622 | + return ''; | |
623 | + } | |
624 | +} | |
683 | 625 | \ No newline at end of file | ... | ... |