Commit 7ffc598d88fcd04f66d7bc385f3616e3d36dce81
1 parent
e4c0f026
Exists in
master
Refactoring para coding standards
Showing
2 changed files
with
946 additions
and
945 deletions
Show diff stats
ieducar/intranet/educar_relatorio_diario_classe.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/clsCadastro.inc.php"); | |
29 | -require_once ("include/clsBanco.inc.php"); | |
30 | -require_once( "include/pmieducar/geral.inc.php" ); | |
31 | -require_once ("include/clsPDF.inc.php"); | |
32 | 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/clsCadastro.inc.php'; | |
33 | +require_once 'include/clsBanco.inc.php'; | |
34 | +require_once 'include/pmieducar/geral.inc.php'; | |
35 | +require_once 'include/clsPDF.inc.php'; | |
36 | + | |
37 | +/** | |
38 | + * clsIndexBase class. | |
39 | + * | |
40 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
41 | + * @category i-Educar | |
42 | + * @license @@license@@ | |
43 | + * @package iEd_Pmieducar | |
44 | + * @since Classe disponível desde a versão 1.0.0 | |
45 | + * @version @@package_version@@ | |
46 | + */ | |
33 | 47 | class clsIndexBase extends clsBase |
34 | 48 | { |
35 | - function Formular() | |
36 | - { | |
37 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Diário de Classe" ); | |
38 | - $this->processoAp = "664"; | |
39 | - } | |
49 | + function Formular() | |
50 | + { | |
51 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Diário de Classe'); | |
52 | + $this->processoAp = 664; | |
53 | + } | |
40 | 54 | } |
41 | 55 | |
56 | +/** | |
57 | + * indice class. | |
58 | + * | |
59 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
60 | + * @category i-Educar | |
61 | + * @license @@license@@ | |
62 | + * @package iEd_Pmieducar | |
63 | + * @since Classe disponível desde a versão 1.0.0 | |
64 | + * @version @@package_version@@ | |
65 | + */ | |
42 | 66 | class indice extends clsCadastro |
43 | 67 | { |
68 | + var $pessoa_logada; | |
69 | + | |
70 | + var $ref_cod_instituicao; | |
71 | + var $ref_cod_escola; | |
72 | + var $ref_cod_serie; | |
73 | + var $ref_cod_turma; | |
74 | + | |
75 | + var $ano; | |
76 | + var $mes; | |
44 | 77 | |
78 | + var $nm_escola; | |
79 | + var $nm_instituicao; | |
80 | + var $ref_cod_curso; | |
81 | + var $sequencial; | |
82 | + var $pdf; | |
83 | + var $pagina_atual = 1; | |
84 | + var $total_paginas = 1; | |
85 | + var $nm_professor; | |
86 | + var $nm_turma; | |
87 | + var $nm_serie; | |
88 | + var $nm_disciplina; | |
89 | + | |
90 | + var $page_y = 125; | |
91 | + | |
92 | + var $get_file; | |
93 | + | |
94 | + var $cursos = array(); | |
95 | + | |
96 | + var $get_link; | |
97 | + | |
98 | + var $total; | |
99 | + | |
100 | + var $ref_cod_modulo; | |
101 | + | |
102 | + var $meses_do_ano = array( | |
103 | + 1 => 'JANEIRO', | |
104 | + 2 => 'FEVEREIRO', | |
105 | + 3 => 'MARÇO', | |
106 | + 4 => 'ABRIL', | |
107 | + 5 => 'MAIO', | |
108 | + 6 => 'JUNHO', | |
109 | + 7 => 'JULHO', | |
110 | + 8 => 'AGOSTO', | |
111 | + 9 => 'SETEMBRO', | |
112 | + 10 => 'OUTUBRO', | |
113 | + 11 => 'NOVEMBRO', | |
114 | + 12 => 'DEZEMBRO' | |
115 | + ); | |
116 | + | |
117 | + function Inicializar() | |
118 | + { | |
119 | + $retorno = 'Novo'; | |
120 | + | |
121 | + @session_start(); | |
122 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
123 | + @session_write_close(); | |
124 | + | |
125 | + return $retorno; | |
126 | + } | |
127 | + | |
128 | + function Gerar() | |
129 | + { | |
130 | + $obj_permissoes = new clsPermissoes(); | |
131 | + $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada); | |
132 | + | |
133 | + @session_start(); | |
134 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
135 | + @session_write_close(); | |
136 | + | |
137 | + if ($_POST){ | |
138 | + foreach ($_POST as $key => $value) { | |
139 | + $this->$key = $value; | |
140 | + } | |
141 | + } | |
142 | + | |
143 | + $this->ano = $ano_atual = date('Y'); | |
144 | + | |
145 | + $this->campoNumero('ano', 'Ano', $this->ano, 4, 4, TRUE); | |
146 | + | |
147 | + $this->campoCheck('em_branco', 'Relatório em branco', ''); | |
148 | + $this->campoNumero('numero_registros', 'Número de linhas', '', 3, 3); | |
149 | + | |
150 | + $get_escola = TRUE; | |
151 | + $obrigatorio = TRUE; | |
152 | + $exibe_nm_escola = TRUE; | |
153 | + $get_curso = TRUE; | |
154 | + $get_escola_curso_serie = TRUE; | |
155 | + | |
156 | + include 'include/pmieducar/educar_campo_lista.php'; | |
157 | + | |
158 | + $opcoes_turma = array('' => 'Selecione'); | |
159 | + | |
160 | + if (($this->ref_ref_cod_serie && $this->ref_cod_escola) || $this->ref_cod_curso) { | |
161 | + $obj_turma = new clsPmieducarTurma(); | |
162 | + $obj_turma->setOrderby('nm_turma ASC'); | |
163 | + $lst_turma = $obj_turma->lista(NULL, NULL, NULL, $this->ref_ref_cod_serie, | |
164 | + $this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
165 | + NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_curso); | |
166 | + | |
167 | + if (is_array($lst_turma) && count($lst_turma)) { | |
168 | + foreach ($lst_turma as $turma) { | |
169 | + $opcoes_turma[$turma['cod_turma']] = $turma['nm_turma']; | |
170 | + } | |
171 | + } | |
172 | + } | |
173 | + | |
174 | + $this->campoLista('ref_cod_turma', 'Turma', $opcoes_turma, $this->ref_cod_turma); | |
175 | + | |
176 | + $this->campoLista('ref_cod_modulo', 'Módulo', array('' => 'Selecione'), ''); | |
177 | + | |
178 | + if ($this->ref_cod_escola) { | |
179 | + $this->ref_ref_cod_escola = $this->ref_cod_escola; | |
180 | + } | |
181 | + | |
182 | + if ($this->get_link) { | |
183 | + $this->campoRotulo('rotulo11', '-', | |
184 | + sprintf('<a href="%s" target="_blank">Baixar Relatório</a>', $this->get_link) | |
185 | + ); | |
186 | + } | |
45 | 187 | |
46 | - /** | |
47 | - * Referencia pega da session para o idpes do usuario atual | |
48 | - * | |
49 | - * @var int | |
50 | - */ | |
51 | - var $pessoa_logada; | |
52 | - | |
53 | - | |
54 | - var $ref_cod_instituicao; | |
55 | - var $ref_cod_escola; | |
56 | - var $ref_cod_serie; | |
57 | - var $ref_cod_turma; | |
58 | - | |
59 | - var $ano; | |
60 | - var $mes; | |
61 | - | |
62 | - var $nm_escola; | |
63 | - var $nm_instituicao; | |
64 | - var $ref_cod_curso; | |
65 | - var $sequencial; | |
66 | - var $pdf; | |
67 | - var $pagina_atual = 1; | |
68 | - var $total_paginas = 1; | |
69 | - var $nm_professor; | |
70 | - var $nm_turma; | |
71 | - var $nm_serie; | |
72 | - var $nm_disciplina; | |
73 | - | |
74 | - var $page_y = 125; | |
75 | - | |
76 | - var $get_file; | |
77 | - | |
78 | - var $cursos = array(); | |
79 | - | |
80 | - var $get_link; | |
81 | - | |
82 | - var $total; | |
83 | - | |
84 | - //var $array_disciplinas = array(); | |
85 | - | |
86 | - var $ref_cod_modulo; | |
87 | - | |
88 | - var $meses_do_ano = array( | |
89 | - "1" => "JANEIRO" | |
90 | - ,"2" => "FEVEREIRO" | |
91 | - ,"3" => "MARÇO" | |
92 | - ,"4" => "ABRIL" | |
93 | - ,"5" => "MAIO" | |
94 | - ,"6" => "JUNHO" | |
95 | - ,"7" => "JULHO" | |
96 | - ,"8" => "AGOSTO" | |
97 | - ,"9" => "SETEMBRO" | |
98 | - ,"10" => "OUTUBRO" | |
99 | - ,"11" => "NOVEMBRO" | |
100 | - ,"12" => "DEZEMBRO" | |
101 | - ); | |
102 | - | |
103 | - | |
104 | - function Inicializar() | |
105 | - { | |
106 | - $retorno = "Novo"; | |
107 | - @session_start(); | |
108 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
109 | - @session_write_close(); | |
110 | - | |
111 | - //$obj_permissoes = new clsPermissoes(); | |
112 | - //if($obj_permissoes->nivel_acesso($this->pessoa_logada) > 7) | |
113 | - //header("location: index.php"); | |
114 | - | |
115 | - return $retorno; | |
116 | - } | |
117 | - | |
118 | - function Gerar() | |
119 | - { | |
120 | - | |
121 | - $obj_permissoes = new clsPermissoes(); | |
122 | - $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada); | |
123 | - | |
124 | - //if(!$nivel_usuario) | |
125 | - //header("location: index.php"); | |
126 | - @session_start(); | |
127 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
128 | - @session_write_close(); | |
129 | - | |
130 | - if($_POST){ | |
131 | - foreach ($_POST as $key => $value) { | |
132 | - $this->$key = $value; | |
133 | - | |
134 | - } | |
135 | - } | |
136 | - | |
137 | - | |
138 | - | |
139 | - $this->ano = $ano_atual = date("Y"); | |
140 | - //$this->mes = $mes_atual = date("n"); | |
141 | - /* | |
142 | - $lim = 5; | |
143 | - for($a = date('Y') ; $a < $ano_atual + $lim ; $a++ ) | |
144 | - $anos["{$a}"] = "{$a}"; | |
145 | - | |
146 | - $this->campoLista( "ano", "Ano",$anos, $this->ano,"",false ); | |
147 | - */ | |
148 | - | |
149 | - $this->campoNumero( "ano", "Ano", $this->ano, 4, 4, true ); | |
150 | - | |
151 | - $this->campoCheck("em_branco","Relatório em branco",""); | |
152 | - $this->campoNumero("numero_registros","Número de linhas","",3,3); | |
153 | - | |
154 | - // $this->campoLista( "mes", "Mês",$this->meses_do_ano, $this->mes,"",false ); | |
155 | - | |
156 | - $get_escola = true; | |
157 | - $obrigatorio = true; | |
158 | - $exibe_nm_escola = true; | |
159 | -// $get_escola_curso = true; | |
160 | - $get_curso = true; | |
161 | - $get_escola_curso_serie = true; | |
162 | - //$get_turma = true; | |
163 | - //$curso_padrao_ano_escolar = 1; | |
164 | - //$exibe_campo_lista_curso_escola = true; | |
165 | - include("include/pmieducar/educar_campo_lista.php"); | |
166 | - | |
167 | - /*$db = new clsBanco(); | |
168 | - $consulta ="SELECT distinct | |
169 | - m.cod_turma | |
170 | - ,m.nm_turma | |
171 | - ,s.cod_serie | |
172 | - ,s.nm_serie | |
173 | - ,m.ref_ref_cod_escola | |
174 | - FROM pmieducar.turma m | |
175 | - ,pmieducar.serie s | |
176 | - WHERE m.ref_ref_cod_serie = s.cod_serie"; | |
177 | - | |
178 | - $db->Consulta($consulta); | |
179 | - | |
180 | - $script = "<script>turma = new Array();\n"; | |
181 | - while ($db->ProximoRegistro()) { | |
182 | - $tupla = $db->Tupla(); | |
183 | - $script .= "turma[turma.length] = new Array('{$tupla['cod_turma']}','{$tupla['nm_turma']}','{$tupla['cod_serie']}','{$tupla['nm_serie']}','{$tupla['ref_ref_cod_escola']}');\n"; | |
184 | - } | |
185 | - echo $script .= "</script>"; | |
186 | -*/ | |
187 | - $opcoes_turma = array('' => 'Selecione'); | |
188 | - if ( ($this->ref_ref_cod_serie && $this->ref_cod_escola) || $this->ref_cod_curso ) | |
189 | - { | |
190 | - $obj_turma = new clsPmieducarTurma(); | |
191 | - $obj_turma->setOrderby("nm_turma ASC"); | |
192 | - $lst_turma = $obj_turma->lista( null, null, null, $this->ref_ref_cod_serie, $this->ref_cod_escola, null, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, $this->ref_cod_curso ); | |
193 | - if ( is_array( $lst_turma ) && count( $lst_turma ) ) | |
194 | - { | |
195 | - foreach ( $lst_turma as $turma ) | |
196 | - { | |
197 | - $opcoes_turma["{$turma['cod_turma']}"] = "{$turma['nm_turma']}"; | |
198 | - } | |
199 | - } | |
200 | - } | |
201 | - $this->campoLista("ref_cod_turma","Turma",$opcoes_turma,$this->ref_cod_turma); | |
202 | - | |
203 | - $this->campoLista("ref_cod_modulo","Módulo",array('' => 'Selecione'),""); | |
204 | - | |
205 | - if($this->ref_cod_escola) | |
206 | - $this->ref_ref_cod_escola = $this->ref_cod_escola; | |
207 | - | |
208 | - if($this->get_link) | |
209 | - $this->campoRotulo("rotulo11", "-", "<a href='$this->get_link' target='_blank'>Baixar Relatório</a>"); | |
210 | - | |
211 | - $this->url_cancelar = "educar_index.php"; | |
212 | - $this->nome_url_cancelar = "Cancelar"; | |
213 | - | |
214 | - $this->acao_enviar = 'acao2()'; | |
215 | - $this->acao_executa_submit = false; | |
216 | - } | |
217 | - | |
188 | + $this->url_cancelar = 'educar_index.php'; | |
189 | + $this->nome_url_cancelar = 'Cancelar'; | |
218 | 190 | |
191 | + $this->acao_enviar = 'acao2()'; | |
192 | + $this->acao_executa_submit = FALSE; | |
193 | + } | |
219 | 194 | } |
220 | 195 | |
221 | -// cria uma extensao da classe base | |
196 | +// Instancia objeto de página | |
222 | 197 | $pagina = new clsIndexBase(); |
223 | -// cria o conteudo | |
198 | + | |
199 | +// Instancia objeto de conteúdo | |
224 | 200 | $miolo = new indice(); |
225 | -// adiciona o conteudo na clsBase | |
226 | -$pagina->addForm( $miolo ); | |
227 | -// gera o html | |
228 | -$pagina->MakeAll(); | |
229 | 201 | |
202 | +// Atribui o conteúdo à página | |
203 | +$pagina->addForm($miolo); | |
230 | 204 | |
205 | +// Gera o código HTML | |
206 | +$pagina->MakeAll(); | |
231 | 207 | ?> |
232 | -<script> | |
233 | - | |
208 | +<script type="text/javascript"> | |
234 | 209 | function acao2() |
235 | 210 | { |
211 | + if (!acao()) { | |
212 | + return false; | |
213 | + } | |
236 | 214 | |
237 | - if(!acao()) | |
238 | - return false; | |
215 | + showExpansivelImprimir(400, 200,'',[], 'Diário de Classe'); | |
239 | 216 | |
240 | - showExpansivelImprimir(400, 200,'',[], "Diário de Classe"); | |
217 | + document.formcadastro.target = 'miolo_' + (DOM_divs.length - 1); | |
241 | 218 | |
242 | - document.formcadastro.target = 'miolo_'+(DOM_divs.length-1); | |
243 | - | |
244 | - document.formcadastro.submit(); | |
219 | + document.formcadastro.submit(); | |
245 | 220 | } |
246 | 221 | |
247 | -document.formcadastro.action = 'educar_relatorio_diario_classe_proc.php'; | |
248 | - | |
249 | 222 | function getModulos() |
250 | 223 | { |
251 | - var campoEscola = document.getElementById( 'ref_cod_escola' ).value; | |
252 | - var campoCurso = document.getElementById( 'ref_cod_curso' ).value; | |
253 | - var campoAno = document.getElementById( 'ano' ).value; | |
254 | - var campoTurma = document.getElementById( 'ref_cod_turma' ).value; | |
255 | - var xml1 = new ajax(getModulos_XML); | |
256 | - strURL = "educar_modulo_xml.php?esc="+campoEscola+"&ano="+campoAno+"&curso="+campoCurso+"&turma="+campoTurma; | |
257 | - xml1.envia(strURL); | |
258 | -} | |
224 | + var campoEscola = document.getElementById('ref_cod_escola').value; | |
225 | + var campoCurso = document.getElementById('ref_cod_curso').value; | |
226 | + var campoAno = document.getElementById('ano').value; | |
227 | + var campoTurma = document.getElementById('ref_cod_turma').value; | |
259 | 228 | |
260 | -function getModulos_XML(xml) | |
261 | -{ | |
262 | - | |
263 | - var modulos = xml.getElementsByTagName( "ano_letivo_modulo" ); | |
264 | - | |
265 | - var campoEscola = document.getElementById( 'ref_cod_escola' ).value; | |
266 | - var campoCurso= document.getElementById( 'ref_cod_curso' ).value; | |
267 | - var campoModulo = document.getElementById( 'ref_cod_modulo' ); | |
268 | - var campoAno = document.getElementById( 'ano' ).value; | |
229 | + var xml1 = new ajax(getModulos_XML); | |
269 | 230 | |
270 | - campoModulo.length = 1; | |
271 | - campoModulo.options[0] = new Option( 'Selecione um módulo', '', false, false ); | |
272 | - for ( var j = 0; j < modulos.length; j++ ) | |
273 | - { | |
274 | - //if ( modulos[j][2] == campoEscola && modulos[j][3] == campoAno) | |
275 | - //{ | |
276 | - campoModulo.options[campoModulo.options.length] = new Option( modulos[j].firstChild.nodeValue, modulos[j].getAttribute('cod_modulo') + "-" +modulos[j].getAttribute('sequencial') , false, false ); | |
277 | - //} | |
278 | - } | |
279 | - if ( campoModulo.length == 1 ) { | |
280 | - campoModulo.options[0] = new Option( 'O curso não possui nenhum módulo', '', false, false ); | |
281 | - } | |
231 | + strURL = 'educar_modulo_xml.php?esc=' + campoEscola + '&ano=' + campoAno + | |
232 | + '&curso=' + campoCurso + '&turma=' + campoTurma; | |
282 | 233 | |
234 | + xml1.envia(strURL); | |
235 | +} | |
283 | 236 | |
237 | +function getModulos_XML(xml) | |
238 | +{ | |
239 | + var modulos = xml.getElementsByTagName('ano_letivo_modulo'); | |
240 | + var campoEscola = document.getElementById('ref_cod_escola').value; | |
241 | + var campoCurso = document.getElementById('ref_cod_curso').value; | |
242 | + var campoModulo = document.getElementById('ref_cod_modulo'); | |
243 | + var campoAno = document.getElementById('ano').value; | |
244 | + | |
245 | + campoModulo.length = 1; | |
246 | + campoModulo.options[0] = new Option('Selecione um módulo', '', false, false); | |
247 | + | |
248 | + for (var j = 0; j < modulos.length; j++) { | |
249 | + campoModulo.options[campoModulo.options.length] = new Option( | |
250 | + modulos[j].firstChild.nodeValue, modulos[j].getAttribute('cod_modulo') + '-' + modulos[j].getAttribute('sequencial'), | |
251 | + false, false | |
252 | + ); | |
253 | + } | |
254 | + | |
255 | + if (campoModulo.length == 1) { | |
256 | + campoModulo.options[0] = new Option('O curso não possui nenhum módulo', '', false, false); | |
257 | + } | |
284 | 258 | } |
285 | -//before_getEscola = function(){getModulos(); }; | |
286 | 259 | |
287 | -//addEvent_('load',getModulos); | |
288 | 260 | document.getElementById('ref_cod_escola').onchange = function() |
289 | 261 | { |
290 | - getEscolaCurso(); | |
291 | - document.getElementById('ref_cod_curso').onchange(); | |
292 | - | |
262 | + getEscolaCurso(); | |
263 | + document.getElementById('ref_cod_curso').onchange(); | |
293 | 264 | } |
265 | + | |
294 | 266 | document.getElementById('ano').onchange = function() |
295 | 267 | { |
296 | - getModulos(); | |
297 | - | |
268 | + getModulos(); | |
298 | 269 | } |
299 | 270 | |
300 | 271 | document.getElementById('ref_cod_curso').onchange = function() |
301 | 272 | { |
302 | - getEscolaCursoSerie(); | |
303 | - document.getElementById( 'ref_cod_modulo' ).length = 1; | |
304 | - getModulos(); | |
273 | + getEscolaCursoSerie(); | |
274 | + document.getElementById('ref_cod_modulo').length = 1; | |
275 | + getModulos(); | |
305 | 276 | } |
277 | + | |
306 | 278 | document.getElementById('ref_cod_turma').onchange = function() |
307 | 279 | { |
308 | - document.getElementById( 'ref_cod_modulo' ).length = 1; | |
309 | - getModulos(); | |
280 | + document.getElementById('ref_cod_modulo').length = 1; | |
281 | + getModulos(); | |
310 | 282 | } |
311 | 283 | |
312 | 284 | document.getElementById('ref_ref_cod_serie').onchange = function() |
313 | 285 | { |
314 | - var campoEscola = document.getElementById( 'ref_cod_escola' ).value; | |
315 | - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value; | |
286 | + var campoEscola = document.getElementById('ref_cod_escola').value; | |
287 | + var campoSerie = document.getElementById('ref_ref_cod_serie').value; | |
288 | + | |
289 | + var xml1 = new ajax(getTurma_XML); | |
290 | + strURL = 'educar_turma_xml.php?esc=' + campoEscola + '&ser=' + campoSerie; | |
316 | 291 | |
317 | - var xml1 = new ajax(getTurma_XML); | |
318 | - strURL = "educar_turma_xml.php?esc="+campoEscola+"&ser="+campoSerie; | |
319 | - xml1.envia(strURL); | |
292 | + xml1.envia(strURL); | |
320 | 293 | } |
321 | 294 | |
322 | 295 | function getTurma_XML(xml) |
323 | 296 | { |
297 | + var campoSerie = document.getElementById('ref_ref_cod_serie').value; | |
324 | 298 | |
299 | + var campoTurma = document.getElementById('ref_cod_turma'); | |
325 | 300 | |
326 | - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value; | |
301 | + var turma = xml.getElementsByTagName('turma'); | |
327 | 302 | |
328 | - var campoTurma = document.getElementById( 'ref_cod_turma' ); | |
303 | + campoTurma.length = 1; | |
304 | + campoTurma.options[0] = new Option('Selecione uma Turma', '', false, false); | |
329 | 305 | |
330 | - var turma = xml.getElementsByTagName( "turma" ); | |
331 | - | |
332 | - campoTurma.length = 1; | |
333 | - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false ); | |
334 | - for ( var j = 0; j < turma.length; j++ ) | |
335 | - { | |
336 | - | |
337 | - campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false ); | |
338 | - | |
339 | - } | |
340 | - if ( campoTurma.length == 1 && campoSerie != '' ) { | |
341 | - campoTurma.options[0] = new Option( 'A série não possui nenhuma turma', '', false, false ); | |
342 | - } | |
306 | + for (var j = 0; j < turma.length; j++) { | |
307 | + campoTurma.options[campoTurma.options.length] = new Option( | |
308 | + turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false | |
309 | + ); | |
310 | + } | |
343 | 311 | |
312 | + if (campoTurma.length == 1 && campoSerie != '') { | |
313 | + campoTurma.options[0] = new Option('A série não possui nenhuma turma', '', false, false); | |
314 | + } | |
344 | 315 | } |
345 | 316 | |
346 | -</script> | |
317 | +document.formcadastro.action = 'educar_relatorio_diario_classe_proc.php'; | |
318 | +</script> | |
347 | 319 | \ No newline at end of file | ... | ... |
ieducar/intranet/educar_relatorio_diario_classe_proc.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/clsCadastro.inc.php"); | |
29 | -require_once ("include/clsBanco.inc.php"); | |
30 | -require_once( "include/pmieducar/geral.inc.php" ); | |
31 | -require_once ("include/clsPDF.inc.php"); | |
32 | 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/clsCadastro.inc.php'; | |
33 | +require_once 'include/clsBanco.inc.php'; | |
34 | +require_once 'include/pmieducar/geral.inc.php'; | |
35 | +require_once 'include/clsPDF.inc.php'; | |
36 | + | |
37 | +/** | |
38 | + * clsIndexBase class. | |
39 | + * | |
40 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
41 | + * @category i-Educar | |
42 | + * @license @@license@@ | |
43 | + * @package iEd_Pmieducar | |
44 | + * @since Classe disponível desde a versão 1.0.0 | |
45 | + * @version @@package_version@@ | |
46 | + */ | |
33 | 47 | class clsIndexBase extends clsBase |
34 | 48 | { |
35 | - function Formular() | |
36 | - { | |
37 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Diário de Classe" ); | |
38 | - $this->processoAp = "664"; | |
39 | - $this->renderMenu = false; | |
40 | - $this->renderMenuSuspenso = false; | |
41 | - } | |
49 | + function Formular() | |
50 | + { | |
51 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Diário de Classe'); | |
52 | + $this->processoAp = 664; | |
53 | + $this->renderMenu = FALSE; | |
54 | + $this->renderMenuSuspenso = FALSE; | |
55 | + } | |
42 | 56 | } |
43 | 57 | |
58 | +/** | |
59 | + * indice class. | |
60 | + * | |
61 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
62 | + * @category i-Educar | |
63 | + * @license @@license@@ | |
64 | + * @package iEd_Pmieducar | |
65 | + * @since Classe disponível desde a versão 1.0.0 | |
66 | + * @version @@package_version@@ | |
67 | + */ | |
44 | 68 | class indice extends clsCadastro |
45 | 69 | { |
70 | + var $pessoa_logada; | |
71 | + | |
72 | + var $ref_cod_instituicao; | |
73 | + var $ref_cod_escola; | |
74 | + var $ref_cod_serie; | |
75 | + var $ref_cod_turma; | |
76 | + | |
77 | + var $ano; | |
78 | + var $mes; | |
79 | + var $mes_inicial; | |
80 | + var $mes_final; | |
81 | + | |
82 | + var $nm_escola; | |
83 | + var $nm_instituicao; | |
84 | + var $ref_cod_curso; | |
85 | + var $sequencial; | |
86 | + var $pdf; | |
87 | + var $pagina_atual = 1; | |
88 | + var $total_paginas = 1; | |
89 | + var $nm_professor; | |
90 | + var $nm_turma; | |
91 | + var $nm_serie; | |
92 | + var $nm_disciplina; | |
93 | + | |
94 | + var $numero_registros; | |
95 | + var $em_branco; | |
96 | + | |
97 | + var $page_y = 125; | |
98 | + | |
99 | + var $get_file; | |
100 | + | |
101 | + var $cursos = array(); | |
102 | + | |
103 | + var $get_link; | |
104 | + | |
105 | + var $total; | |
106 | + | |
107 | + var $ref_cod_modulo; | |
108 | + var $data_ini, $data_fim; | |
109 | + | |
110 | + var $z = 0; | |
111 | + | |
112 | + var $meses_do_ano = array( | |
113 | + 1 => 'JANEIRO', | |
114 | + 2 => 'FEVEREIRO', | |
115 | + 3 => 'MARÇO', | |
116 | + 4 => 'ABRIL', | |
117 | + 5 => 'MAIO', | |
118 | + 6 => 'JUNHO', | |
119 | + 7 => 'JULHO', | |
120 | + 8 => 'AGOSTO', | |
121 | + 9 => 'SETEMBRO', | |
122 | + 10 => 'OUTUBRO', | |
123 | + 11 => 'NOVEMBRO', | |
124 | + 12 => 'DEZEMBRO' | |
125 | + ); | |
126 | + | |
127 | + function renderHTML() | |
128 | + { | |
129 | + if ($_POST) { | |
130 | + foreach ($_POST as $key => $value) { | |
131 | + $this->$key = $value; | |
132 | + } | |
133 | + } | |
46 | 134 | |
135 | + if ($this->ref_ref_cod_serie) { | |
136 | + $this->ref_cod_serie = $this->ref_ref_cod_serie; | |
137 | + } | |
47 | 138 | |
48 | - /** | |
49 | - * Referencia pega da session para o idpes do usuario atual | |
50 | - * | |
51 | - * @var int | |
52 | - */ | |
53 | - var $pessoa_logada; | |
139 | + $fonte = 'arial'; | |
140 | + $corTexto = '#000000'; | |
54 | 141 | |
142 | + if (empty($this->ref_cod_turma)) { | |
143 | + echo ' | |
144 | + <script> | |
145 | + alert("Erro ao gerar relatório!\nNenhuma turma selecionada!"); | |
146 | + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); | |
147 | + </script>'; | |
55 | 148 | |
56 | - var $ref_cod_instituicao; | |
57 | - var $ref_cod_escola; | |
58 | - var $ref_cod_serie; | |
59 | - var $ref_cod_turma; | |
149 | + return TRUE; | |
150 | + } | |
60 | 151 | |
61 | - var $ano; | |
62 | - var $mes; | |
63 | - var $mes_inicial; | |
64 | - var $mes_final; | |
152 | + $modulo_sequencial = explode('-', $this->ref_cod_modulo); | |
153 | + $this->ref_cod_modulo = $modulo_sequencial[0]; | |
154 | + $this->sequencial = $modulo_sequencial[1]; | |
65 | 155 | |
66 | - var $nm_escola; | |
67 | - var $nm_instituicao; | |
68 | - var $ref_cod_curso; | |
69 | - var $sequencial; | |
70 | - var $pdf; | |
71 | - var $pagina_atual = 1; | |
72 | - var $total_paginas = 1; | |
73 | - var $nm_professor; | |
74 | - var $nm_turma; | |
75 | - var $nm_serie; | |
76 | - var $nm_disciplina; | |
156 | + if ($this->ref_cod_escola) { | |
157 | + $obj_escola = new clsPmieducarEscola($this->ref_cod_escola); | |
158 | + $det_escola = $obj_escola->detalhe(); | |
159 | + $this->nm_escola = $det_escola['nome']; | |
77 | 160 | |
78 | - var $numero_registros; | |
79 | - var $em_branco; | |
161 | + $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']); | |
162 | + $det_instituicao = $obj_instituicao->detalhe(); | |
163 | + $this->nm_instituicao = $det_instituicao['nm_instituicao']; | |
164 | + } | |
80 | 165 | |
81 | - var $page_y = 125; | |
166 | + $obj_calendario = new clsPmieducarEscolaAnoLetivo(); | |
167 | + $lista_calendario = $obj_calendario->lista($this->ref_cod_escola, $this->ano, | |
168 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL); | |
82 | 169 | |
83 | - var $get_file; | |
170 | + $obj_turma = new clsPmieducarTurma($this->ref_cod_turma); | |
171 | + $det_turma = $obj_turma->detalhe(); | |
172 | + $this->nm_turma = $det_turma['nm_turma']; | |
84 | 173 | |
85 | - var $cursos = array(); | |
174 | + $obj_serie = new clsPmieducarSerie($this->ref_cod_serie); | |
175 | + $det_serie = $obj_serie->detalhe(); | |
176 | + $this->nm_serie = $det_serie['nm_serie']; | |
86 | 177 | |
87 | - var $get_link; | |
178 | + $obj_pessoa = new clsPessoa_($det_turma['ref_cod_regente']); | |
179 | + $det = $obj_pessoa->detalhe(); | |
180 | + $this->nm_professor = $det['nome']; | |
88 | 181 | |
89 | - var $total; | |
182 | + if (!$lista_calendario) { | |
183 | + echo ' | |
184 | + <script> | |
185 | + alert("Escola não possui calendário definido para este ano"); | |
186 | + window.parent.fechaExpansivel(\'div_dinamico_\' + (window.parent.DOM_divs.length - 1)); | |
187 | + </script>'; | |
90 | 188 | |
91 | - var $ref_cod_modulo; | |
92 | - var $data_ini,$data_fim; | |
189 | + return TRUE; | |
190 | + } | |
93 | 191 | |
94 | - var $z=0; | |
192 | + $altura_linha = 23; | |
193 | + $inicio_escrita_y = 175; | |
194 | + | |
195 | + $obj = new clsPmieducarSerie(); | |
196 | + $obj->setOrderby('cod_serie, etapa_curso'); | |
197 | + $lista_serie_curso = $obj->lista(NULL, NULL, NULL,$this->ref_cod_curso, NULL, | |
198 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao); | |
199 | + | |
200 | + $obj_curso = new clsPmieducarCurso($this->ref_cod_curso); | |
201 | + $det_curso = $obj_curso->detalhe(); | |
202 | + | |
203 | + if ($det_curso['falta_ch_globalizada']) { | |
204 | + // Números de semanas no mês | |
205 | + $db = new clsBanco(); | |
206 | + $consulta = sprintf("SELECT padrao_ano_escolar FROM pmieducar.curso WHERE cod_curso = '%d'", $this->ref_cod_curso); | |
207 | + $padrao_ano_escolar = $db->CampoUnico($consulta); | |
208 | + $total_semanas = 0; | |
209 | + | |
210 | + if ($padrao_ano_escolar) { | |
211 | + $meses = $db->CampoUnico(sprintf(" | |
212 | + SELECT | |
213 | + to_char(data_inicio, 'dd/mm') || '-' || to_char(data_fim, 'dd/mm') | |
214 | + FROM | |
215 | + pmieducar.ano_letivo_modulo, | |
216 | + pmieducar.modulo | |
217 | + WHERE | |
218 | + modulo.cod_modulo = ano_letivo_modulo.ref_cod_modulo | |
219 | + AND modulo.ativo = 1 | |
220 | + AND ano_letivo_modulo.ref_cod_modulo = '%d' | |
221 | + AND ano_letivo_modulo.sequencial = '%d' | |
222 | + AND ref_ano = '%d' | |
223 | + AND ref_ref_cod_escola = '%d' | |
224 | + ORDER BY | |
225 | + data_inicio,data_fim ASC | |
226 | + ", $this->ref_cod_modulo, $this->sequencial, $this->ano, $this->ref_cod_escola)); | |
227 | + | |
228 | + $data = explode('-', $meses); | |
229 | + | |
230 | + if (!$this->data_ini) { | |
231 | + $this->data_ini = $data[0]; | |
232 | + } | |
95 | 233 | |
234 | + if (!$this->data_fim) { | |
235 | + $this->data_fim = $data[1]; | |
236 | + } | |
96 | 237 | |
238 | + $data_ini = explode('/', $data[0]); | |
239 | + $data_fim = explode('/', $data[1]); | |
97 | 240 | |
98 | - var $meses_do_ano = array( | |
99 | - "1" => "JANEIRO" | |
100 | - ,"2" => "FEVEREIRO" | |
101 | - ,"3" => "MARÇO" | |
102 | - ,"4" => "ABRIL" | |
103 | - ,"5" => "MAIO" | |
104 | - ,"6" => "JUNHO" | |
105 | - ,"7" => "JULHO" | |
106 | - ,"8" => "AGOSTO" | |
107 | - ,"9" => "SETEMBRO" | |
108 | - ,"10" => "OUTUBRO" | |
109 | - ,"11" => "NOVEMBRO" | |
110 | - ,"12" => "DEZEMBRO" | |
111 | - ); | |
112 | - | |
113 | - | |
114 | - | |
115 | - function renderHTML() | |
116 | - { | |
117 | - if($_POST){ | |
118 | - foreach ($_POST as $key => $value) { | |
119 | - $this->$key = $value; | |
120 | - | |
121 | - } | |
122 | - } | |
123 | - if($this->ref_ref_cod_serie) | |
124 | - $this->ref_cod_serie = $this->ref_ref_cod_serie; | |
125 | - | |
126 | - $fonte = 'arial'; | |
127 | - $corTexto = '#000000'; | |
128 | - | |
129 | - if(empty($this->ref_cod_turma)) | |
130 | - { | |
131 | - echo '<script> | |
132 | - alert("Erro ao gerar relatório!\nNenhuma turma selecionada!"); | |
133 | - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); | |
134 | - </script>'; | |
135 | - return true; | |
136 | - } | |
137 | - | |
138 | - $modulo_sequencial = explode("-",$this->ref_cod_modulo); | |
139 | - $this->ref_cod_modulo = $modulo_sequencial[0]; | |
140 | - $this->sequencial = $modulo_sequencial[1]; | |
141 | - | |
142 | - if($this->ref_cod_escola){ | |
143 | - | |
144 | - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola); | |
145 | - $det_escola = $obj_escola->detalhe(); | |
146 | - $this->nm_escola = $det_escola['nome']; | |
147 | - | |
148 | - $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']); | |
149 | - $det_instituicao = $obj_instituicao->detalhe(); | |
150 | - $this->nm_instituicao = $det_instituicao['nm_instituicao']; | |
151 | - | |
152 | - } | |
153 | - | |
154 | - $obj_calendario = new clsPmieducarEscolaAnoLetivo(); | |
155 | - $lista_calendario = $obj_calendario->lista($this->ref_cod_escola,$this->ano,null,null,null,null,null,null,null,1,null); | |
156 | - | |
157 | - $obj_turma = new clsPmieducarTurma($this->ref_cod_turma); | |
158 | - $det_turma = $obj_turma->detalhe(); | |
159 | - $this->nm_turma = $det_turma['nm_turma']; | |
160 | - | |
161 | - $obj_serie = new clsPmieducarSerie($this->ref_cod_serie); | |
162 | - $det_serie = $obj_serie->detalhe(); | |
163 | - $this->nm_serie = $det_serie['nm_serie']; | |
164 | - | |
165 | - $obj_pessoa = new clsPessoa_($det_turma["ref_cod_regente"]); | |
166 | - $det = $obj_pessoa->detalhe(); | |
167 | - $this->nm_professor = $det["nome"]; | |
168 | - | |
169 | - if(!$lista_calendario) | |
170 | - { | |
171 | - echo '<script> | |
172 | - alert("Escola não possui calendário definido para este ano"); | |
173 | - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); | |
174 | - </script>'; | |
175 | - return true; | |
176 | - } | |
177 | - | |
178 | - $altura_linha = 23; | |
179 | - $inicio_escrita_y = 175; | |
180 | - | |
181 | - | |
182 | - $obj = new clsPmieducarSerie(); | |
183 | - $obj->setOrderby('cod_serie,etapa_curso'); | |
184 | - $lista_serie_curso = $obj->lista(null,null,null,$this->ref_cod_curso,null,null,null,null,null,null,null,null,1,$this->ref_cod_instituicao); | |
185 | - | |
186 | - $obj_curso = new clsPmieducarCurso($this->ref_cod_curso); | |
187 | - $det_curso = $obj_curso->detalhe(); | |
188 | - | |
189 | - if($det_curso['falta_ch_globalizada']) | |
190 | - { | |
191 | - | |
192 | - /** | |
193 | - * numero de semanas dos meses | |
194 | - */ | |
195 | - $db = new clsBanco(); | |
196 | - $consulta = "SELECT padrao_ano_escolar FROM pmieducar.curso WHERE cod_curso = {$this->ref_cod_curso}"; | |
197 | - $padrao_ano_escolar = $db->CampoUnico($consulta); | |
198 | - $total_semanas = 0; | |
199 | - if($padrao_ano_escolar) | |
200 | - { | |
201 | - $meses = $db->CampoUnico( " | |
202 | - SELECT to_char(data_inicio,'dd/mm') || '-' || to_char(data_fim,'dd/mm') | |
203 | - FROM | |
204 | - pmieducar.ano_letivo_modulo | |
205 | - ,pmieducar.modulo | |
206 | - WHERE modulo.cod_modulo = ano_letivo_modulo.ref_cod_modulo | |
207 | - AND modulo.ativo = 1 | |
208 | - AND ano_letivo_modulo.ref_cod_modulo = $this->ref_cod_modulo | |
209 | - AND ano_letivo_modulo.sequencial = $this->sequencial | |
210 | - AND ref_ano = $this->ano | |
211 | - AND ref_ref_cod_escola = '{$this->ref_cod_escola}' | |
212 | - ORDER BY | |
213 | - data_inicio,data_fim ASC | |
214 | - "); | |
215 | - $data = explode("-",$meses); | |
216 | - | |
217 | - if(!$this->data_ini) | |
218 | - $this->data_ini = $data[0]; | |
219 | - | |
220 | - if(!$this->data_fim) | |
221 | - $this->data_fim = $data[1]; | |
222 | - | |
223 | - $data_ini = explode("/",$data[0]); | |
224 | - $data_fim = explode("/",$data[1]); | |
225 | - | |
226 | - $meses = array($data_ini[1],$data_fim[1]); | |
227 | - $dias = array($data_ini[0],$data_fim[0]); | |
228 | - $total_semanas = 0; | |
229 | - | |
230 | - for($mes = (int)$meses[0];$mes<=(int)$meses[1];$mes++) | |
231 | - { | |
232 | - $mes_final = false; | |
233 | - if($mes == (int)$meses[0]) | |
234 | - $dia = $dias[0]; | |
235 | - elseif ($mes == (int)$meses[1]) | |
236 | - { | |
237 | - $dia = $dias[1]; | |
238 | - $mes_final = true; | |
239 | - } | |
240 | - else | |
241 | - $dia = 1; | |
242 | - | |
243 | - $total_semanas += $this->getNumeroDiasMes($dia,$mes,$this->ano,$mes_final);//,$lista_quadro_horarios[count($lista_quadro_horarios)-1]); | |
244 | - | |
245 | -// echo $total_semanas; | |
246 | -// die("###"); | |
247 | - } | |
248 | - //$total_semanas += $this->getNumeroDiasMes($this->mes + 1,$this->ano);//,$lista_quadro_horarios[count($lista_quadro_horarios)-1]); | |
249 | - } | |
250 | - else | |
251 | - { | |
252 | - $meses = $db->CampoUnico( " | |
253 | - SELECT to_char(data_inicio,'dd/mm') || '-' || to_char(data_fim,'dd/mm') | |
254 | - FROM | |
255 | - pmieducar.turma_modulo | |
256 | - ,pmieducar.modulo | |
257 | - WHERE modulo.cod_modulo = turma_modulo.ref_cod_modulo | |
258 | - AND ref_cod_turma = '{$this->ref_cod_turma}' | |
259 | - AND turma_modulo.ref_cod_modulo = $this->ref_cod_modulo | |
260 | - AND turma_modulo.sequencial = $this->sequencial | |
261 | - AND to_char(data_inicio,'yyyy') = $this->ano | |
262 | - ORDER BY | |
263 | - data_inicio,data_fim ASC | |
264 | - | |
265 | - "); | |
266 | - | |
267 | - $total_semanas = 0; | |
268 | - | |
269 | - $data = explode("-",$meses); | |
270 | - | |
271 | - if(!$this->data_ini) | |
272 | - $this->data_ini = $data[0]; | |
273 | - | |
274 | - if(!$this->data_fim) | |
275 | - $this->data_fim = $data[1]; | |
276 | - | |
277 | - $data_ini = explode("/",$data[0]); | |
278 | - $data_fim = explode("/",$data[1]); | |
279 | - | |
280 | - $meses = array($data_ini[1],$data_fim[1]); | |
281 | - $dias = array($data_ini[0],$data_fim[0]); | |
282 | - $total_semanas = 0; | |
283 | - | |
284 | - for($mes = $meses[0];$mes<=$meses[1];$mes++) | |
285 | - { | |
286 | - $mes_final = false; | |
287 | - if($mes == $meses[0]) | |
288 | - $dia = $dias[0]; | |
289 | - elseif ($mes == $meses[1]) | |
290 | - { | |
291 | - $dia = 1; | |
292 | - $mes_final = true; | |
293 | - } | |
294 | - else | |
295 | - $dia = 1; | |
296 | - $total_semanas += $this->getNumeroDiasMes($dia,$mes,$this->ano,$mes_final); | |
297 | - //**************************************************30032007/\ | |
298 | - } | |
299 | - | |
300 | - | |
301 | - } | |
302 | - | |
303 | - $this->pdf = new clsPDF("Diário de Classe - {$this->ano}", "Diário de Classe - {$data[0]} até {$data[1]} de {$this->ano}", "A4", "", false, false); | |
304 | - $this->mes_inicial = (int)$meses[0]; | |
305 | - $this->mes_final = (int)$meses[1]; | |
306 | - $this->pdf->largura = 842.0; | |
307 | - $this->pdf->altura = 595.0; | |
308 | - | |
309 | - $this->total = $total_semanas;//$total_semanas * count($lista_quadro_horarios); | |
310 | - | |
311 | - | |
312 | - if(!$this->em_branco) | |
313 | - { | |
314 | - $obj_matricula_turma = new clsPmieducarMatriculaTurma(); | |
315 | - $obj_matricula_turma->setOrderby("nome_ascii"); | |
316 | - $lista_matricula = $obj_matricula_turma->lista(null,$this->ref_cod_turma,null,null,null,null,null,null,1,$this->ref_cod_serie,$this->ref_cod_curso,$this->ref_cod_escola,$this->ref_cod_instituicao,null,null,array(1,2,3),null,null,$this->ano,null,true,null,null,true); | |
317 | - } | |
318 | - | |
319 | - if($lista_matricula || $this->em_branco) | |
320 | - { | |
321 | - $this->pdf->OpenPage(); | |
322 | - $this->addCabecalho(); | |
323 | - | |
324 | - if($this->em_branco) | |
325 | - { | |
326 | - $lista_matricula = array(); | |
327 | - $this->numero_registros = $this->numero_registros? $this->numero_registros : 20; | |
328 | - for ($i = 0 ; $i < $this->numero_registros; $i++) | |
329 | - { | |
330 | - $lista_matricula[] = ''; | |
331 | - } | |
332 | - } | |
333 | - | |
334 | - $num = 0; | |
335 | - foreach ($lista_matricula as $matricula) | |
336 | - { | |
337 | - | |
338 | - $num++; | |
339 | - | |
340 | - if($this->page_y > 500) | |
341 | - { | |
342 | - $this->desenhaLinhasVertical(); | |
343 | - $this->pdf->ClosePage(); | |
344 | - $this->pdf->OpenPage(); | |
345 | - $this->page_y = 125; | |
346 | - $this->addCabecalho(); | |
347 | - | |
348 | - | |
349 | - } | |
350 | - | |
351 | - | |
352 | - $this->pdf->quadrado_relativo( 30, $this->page_y , 782, 19); | |
353 | - $this->pdf->escreve_relativo($matricula['nome_aluno'] , 33 ,$this->page_y + 4,160, 15, $fonte, 7, $corTexto, 'left' ); | |
354 | - $this->pdf->escreve_relativo( sprintf("%02d",$num),757, $this->page_y + 4, 30, 30, $fonte, 7, $corTexto, 'left' ); | |
241 | + $meses = array($data_ini[1],$data_fim[1]); | |
242 | + $dias = array($data_ini[0],$data_fim[0]); | |
355 | 243 | |
356 | - $this->page_y +=19; | |
244 | + $total_semanas = 0; | |
357 | 245 | |
246 | + for ($mes = (int) $meses[0]; $mes <= (int) $meses[1]; $mes++) { | |
247 | + $mes_final = FALSE; | |
358 | 248 | |
249 | + if ($mes == (int) $meses[0]) { | |
250 | + $dia = $dias[0]; | |
251 | + } | |
252 | + elseif ($mes == (int)$meses[1]) { | |
253 | + $dia = $dias[1]; | |
254 | + $mes_final = TRUE; | |
255 | + } | |
256 | + else { | |
257 | + $dia = 1; | |
258 | + } | |
359 | 259 | |
360 | - } | |
260 | + $total_semanas += $this->getNumeroDiasMes($dia, $mes, $this->ano, $mes_final); | |
261 | + } | |
262 | + } | |
263 | + else { | |
264 | + $meses = $db->CampoUnico(sprintf(" | |
265 | + SELECT | |
266 | + to_char(data_inicio, 'dd/mm') || '-' || to_char(data_fim, 'dd/mm') | |
267 | + FROM | |
268 | + pmieducar.turma_modulo, | |
269 | + pmieducar.modulo | |
270 | + WHERE | |
271 | + modulo.cod_modulo = turma_modulo.ref_cod_modulo | |
272 | + AND ref_cod_turma = '%d' | |
273 | + AND turma_modulo.ref_cod_modulo = '%d' | |
274 | + AND turma_modulo.sequencial = '%d' | |
275 | + AND to_char(data_inicio,'yyyy') = '%d' | |
276 | + ORDER BY | |
277 | + data_inicio,data_fim ASC | |
278 | + ", $this->ref_cod_turma, $this->ref_cod_modulo, $this->sequencial, $this->ano)); | |
279 | + | |
280 | + $total_semanas = 0; | |
281 | + | |
282 | + $data = explode('-', $meses); | |
283 | + | |
284 | + if (!$this->data_ini) { | |
285 | + $this->data_ini = $data[0]; | |
286 | + } | |
361 | 287 | |
362 | - $this->desenhaLinhasVertical(); | |
288 | + if (!$this->data_fim) { | |
289 | + $this->data_fim = $data[1]; | |
290 | + } | |
363 | 291 | |
364 | - $this->rodape(); | |
365 | - $this->pdf->ClosePage(); | |
366 | - } | |
367 | - else | |
368 | - { | |
292 | + $data_ini = explode('/', $data[0]); | |
293 | + $data_fim = explode('/', $data[1]); | |
369 | 294 | |
370 | - echo '<script> | |
371 | - alert("Turma não possui matriculas"); | |
372 | - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); | |
373 | - </script>'; | |
374 | - | |
375 | - return; | |
376 | - } | |
295 | + $meses = array($data_ini[1],$data_fim[1]); | |
296 | + $dias = array($data_ini[0],$data_fim[0]); | |
377 | 297 | |
298 | + $total_semanas = 0; | |
378 | 299 | |
379 | - //header( "location: " . $this->pdf->GetLink() ); | |
380 | - $this->pdf->CloseFile(); | |
381 | - $this->get_link = $this->pdf->GetLink(); | |
382 | - } | |
383 | - else | |
384 | - { | |
385 | - /* | |
386 | - * Carga horária nã globalizada gera relatório com uma disciplina por | |
387 | - * página. | |
388 | - */ | |
389 | - $obj_turma_disc = new clsPmieducarDisciplinaSerie(); | |
390 | - $obj_turma_disc->setCamposLista("ref_cod_disciplina"); | |
391 | - $lst_turma_disc = $obj_turma_disc->lista(null,$this->ref_cod_serie,1); | |
300 | + for ($mes = $meses[0]; $mes <= $meses[1]; $mes++) { | |
301 | + $mes_final = FALSE; | |
392 | 302 | |
303 | + if ($mes == $meses[0]) { | |
304 | + $dia = $dias[0]; | |
305 | + } | |
306 | + elseif ($mes == $meses[1]) { | |
307 | + $dia = 1; | |
308 | + $mes_final = TRUE; | |
309 | + } | |
310 | + else { | |
311 | + $dia = 1; | |
312 | + } | |
393 | 313 | |
394 | - ####### | |
395 | - if ($lst_turma_disc) | |
396 | - { | |
397 | - $this->pdf = new clsPDF("Diário de Classe - {$this->ano}", "Diário de Classe - {$this->data_ini} até {$this->data_fim} de {$this->ano}", "A4", "", false, false); | |
314 | + $total_semanas += $this->getNumeroDiasMes($dia, $mes, $this->ano, $mes_final); | |
315 | + } | |
316 | + } | |
398 | 317 | |
399 | - foreach ($lst_turma_disc as $disciplina) | |
400 | - { | |
318 | + $this->pdf = new clsPDF('Diário de Classe - ' . $this->ano, | |
319 | + sprintf('Diário de Classe - %s até %s de %s', $data[0], $data[1], $this->ano), | |
320 | + 'A4', '', FALSE, FALSE | |
321 | + ); | |
322 | + | |
323 | + $this->mes_inicial = (int) $meses[0]; | |
324 | + $this->mes_final = (int) $meses[1]; | |
325 | + $this->pdf->largura = 842.0; | |
326 | + $this->pdf->altura = 595.0; | |
327 | + | |
328 | + $this->total = $total_semanas; | |
329 | + | |
330 | + if (!$this->em_branco) { | |
331 | + $obj_matricula_turma = new clsPmieducarMatriculaTurma(); | |
332 | + $obj_matricula_turma->setOrderby('nome_ascii'); | |
333 | + $lista_matricula = $obj_matricula_turma->lista(NULL, $this->ref_cod_turma, | |
334 | + NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie, | |
335 | + $this->ref_cod_curso, $this->ref_cod_escola, $this->ref_cod_instituicao, | |
336 | + NULL, NULL, array(1, 2, 3), NULL, NULL, $this->ano, NULL, TRUE, NULL, | |
337 | + NULL, TRUE); | |
338 | + } | |
339 | + | |
340 | + if ($lista_matricula || $this->em_branco) { | |
341 | + $this->pdf->OpenPage(); | |
342 | + $this->addCabecalho(); | |
343 | + | |
344 | + if ($this->em_branco) { | |
345 | + $lista_matricula = array(); | |
346 | + $this->numero_registros = $this->numero_registros ? | |
347 | + $this->numero_registros : 20; | |
348 | + | |
349 | + for ($i = 0 ; $i < $this->numero_registros; $i++) { | |
350 | + $lista_matricula[] = ''; | |
351 | + } | |
352 | + } | |
353 | + | |
354 | + $num = 0; | |
355 | + foreach ($lista_matricula as $matricula) { | |
356 | + $num++; | |
357 | + | |
358 | + if ($this->page_y > 500) { | |
359 | + $this->desenhaLinhasVertical(); | |
360 | + $this->pdf->ClosePage(); | |
361 | + $this->pdf->OpenPage(); | |
362 | + $this->page_y = 125; | |
363 | + $this->addCabecalho(); | |
364 | + } | |
365 | + | |
366 | + $this->pdf->quadrado_relativo(30, $this->page_y , 782, 19); | |
367 | + $this->pdf->escreve_relativo($matricula['nome_aluno'] , 33, | |
368 | + $this->page_y + 4, 160, 15, $fonte, 7, $corTexto, 'left'); | |
369 | + | |
370 | + $this->pdf->escreve_relativo(sprintf('%02d', $num), 757, | |
371 | + $this->page_y + 4, 30, 30, $fonte, 7, $corTexto, 'left'); | |
372 | + | |
373 | + $this->page_y +=19; | |
374 | + } | |
375 | + | |
376 | + $this->desenhaLinhasVertical(); | |
377 | + | |
378 | + $this->rodape(); | |
379 | + $this->pdf->ClosePage(); | |
380 | + } | |
381 | + else { | |
382 | + echo ' | |
383 | + <script> | |
384 | + alert("Turma não possui matriculas"); | |
385 | + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); | |
386 | + </script>'; | |
387 | + | |
388 | + return; | |
389 | + } | |
390 | + | |
391 | + $this->pdf->CloseFile(); | |
392 | + $this->get_link = $this->pdf->GetLink(); | |
393 | + } | |
394 | + else { | |
395 | + // Carga horária não globalizada gera relatório com uma disciplina por | |
396 | + // página | |
397 | + $obj_turma_disc = new clsPmieducarDisciplinaSerie(); | |
398 | + $obj_turma_disc->setCamposLista('ref_cod_disciplina'); | |
399 | + $lst_turma_disc = $obj_turma_disc->lista(NULL, $this->ref_cod_serie, 1); | |
400 | + | |
401 | + if ($lst_turma_disc) { | |
402 | + $this->pdf = new clsPDF('Diário de Classe - ' . $this->ano, | |
403 | + sprintf('Diário de Classe - %s até %s de %s', $this->data_ini, $this->data_fim, $this->ano), | |
404 | + 'A4', '', FALSE, FALSE | |
405 | + ); | |
406 | + | |
407 | + foreach ($lst_turma_disc as $disciplina) { | |
401 | 408 | $obj_disc = new clsPmieducarDisciplina($disciplina); |
402 | 409 | $det_disc = $obj_disc->detalhe(); |
403 | 410 | $this->nm_disciplina = $det_disc['nm_disciplina']; |
404 | 411 | $this->page_y = 125; |
405 | 412 | |
406 | - // numero de semanas dos meses | |
413 | + // Número de semanas dos meses | |
407 | 414 | $obj_quadro = new clsPmieducarQuadroHorario(); |
408 | - $obj_quadro->setCamposLista("cod_quadro_horario"); | |
409 | - $quadro_horario = $obj_quadro->lista(null,null,null,$this->ref_cod_turma, null, null, null, null,1); | |
415 | + $obj_quadro->setCamposLista('cod_quadro_horario'); | |
416 | + $quadro_horario = $obj_quadro->lista(NULL, NULL, NULL, $this->ref_cod_turma, | |
417 | + NULL, NULL, NULL, NULL, 1); | |
410 | 418 | |
411 | - if(!$quadro_horario) { | |
419 | + if (!$quadro_horario) { | |
412 | 420 | echo '<script>alert(\'Turma não possui quadro de horários\'); |
413 | 421 | window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));</script>'; |
414 | 422 | die(); |
415 | 423 | } |
416 | 424 | |
417 | 425 | $obj_quadro_horarios = new clsPmieducarQuadroHorarioHorarios(); |
418 | - $obj_quadro_horarios->setCamposLista("dia_semana"); | |
419 | - $obj_quadro_horarios->setOrderby("1 asc"); | |
426 | + $obj_quadro_horarios->setCamposLista('dia_semana'); | |
427 | + $obj_quadro_horarios->setOrderby('1 asc'); | |
420 | 428 | |
421 | - $lista_quadro_horarios = $obj_quadro_horarios->lista($quadro_horario[0],$this->ref_cod_serie,$this->ref_cod_escola,$disciplina,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1); | |
429 | + $lista_quadro_horarios = $obj_quadro_horarios->lista($quadro_horario[0], | |
430 | + $this->ref_cod_serie, $this->ref_cod_escola, $disciplina, NULL, NULL, | |
431 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
422 | 432 | |
423 | - $db = new clsBanco(); | |
424 | - $consulta = "SELECT padrao_ano_escolar FROM pmieducar.curso WHERE cod_curso = {$this->ref_cod_curso}"; | |
433 | + $db = new clsBanco(); | |
434 | + $consulta = sprintf('SELECT padrao_ano_escolar FROM pmieducar.curso WHERE cod_curso = \'%d\'', $this->ref_cod_curso); | |
425 | 435 | $padrao_ano_escolar = $db->CampoUnico($consulta); |
426 | 436 | |
427 | 437 | $total_semanas = 0; |
428 | - if ($padrao_ano_escolar) | |
429 | - { | |
430 | - $meses = $db->CampoUnico(" | |
431 | - SELECT to_char(data_inicio,'dd/mm') || '-' || to_char(data_fim,'dd/mm') | |
432 | - FROM | |
433 | - pmieducar.ano_letivo_modulo, | |
434 | - pmieducar.modulo | |
435 | - WHERE | |
436 | - modulo.cod_modulo = ano_letivo_modulo.ref_cod_modulo | |
437 | - AND modulo.ativo = 1 | |
438 | - AND ano_letivo_modulo.ref_cod_modulo = $this->ref_cod_modulo | |
439 | - AND ano_letivo_modulo.sequencial = $this->sequencial | |
440 | - AND ref_ano = $this->ano | |
441 | - AND ref_ref_cod_escola = '{$this->ref_cod_escola}' | |
442 | - ORDER BY | |
443 | - data_inicio,data_fim ASC | |
444 | - "); | |
445 | - $data = explode("-",$meses); | |
438 | + | |
439 | + if ($padrao_ano_escolar) { | |
440 | + $meses = $db->CampoUnico(sprintf(" | |
441 | + SELECT | |
442 | + to_char(data_inicio, 'dd/mm') || '-' || to_char(data_fim, 'dd/mm') | |
443 | + FROM | |
444 | + pmieducar.ano_letivo_modulo, | |
445 | + pmieducar.modulo | |
446 | + WHERE | |
447 | + modulo.cod_modulo = ano_letivo_modulo.ref_cod_modulo | |
448 | + AND modulo.ativo = 1 | |
449 | + AND ano_letivo_modulo.ref_cod_modulo = '%d' | |
450 | + AND ano_letivo_modulo.sequencial = '%d' | |
451 | + AND ref_ano = '%d' | |
452 | + AND ref_ref_cod_escola = '%d' | |
453 | + ORDER BY | |
454 | + data_inicio,data_fim ASC | |
455 | + ", $this->ref_cod_modulo, $this->sequencial, $this->ano, $this->ref_cod_escola)); | |
456 | + | |
457 | + $data = explode('-', $meses); | |
446 | 458 | |
447 | 459 | if (!$this->data_ini) { |
448 | 460 | $this->data_ini = $data[0]; |
... | ... | @@ -452,30 +464,31 @@ class indice extends clsCadastro |
452 | 464 | $this->data_fim = $data[1]; |
453 | 465 | } |
454 | 466 | |
455 | - $data_ini = explode("/",$data[0]); | |
456 | - $data_fim = explode("/",$data[1]); | |
467 | + $data_ini = explode('/', $data[0]); | |
468 | + $data_fim = explode('/', $data[1]); | |
457 | 469 | |
458 | - $meses = array($data_ini[1],$data_fim[1]); | |
459 | - $dias = array($data_ini[0],$data_fim[0]); | |
470 | + $meses = array($data_ini[1], $data_fim[1]); | |
471 | + $dias = array($data_ini[0], $data_fim[0]); | |
460 | 472 | } |
461 | 473 | else |
462 | 474 | { |
463 | - $meses = $db->CampoUnico( " | |
464 | - SELECT to_char(data_inicio,'mm') || '-' || to_char(data_fim,'mm') | |
465 | - FROM | |
466 | - pmieducar.turma_modulo, | |
467 | - pmieducar.modulo | |
468 | - WHERE | |
469 | - modulo.cod_modulo = turma_modulo.ref_cod_modulo | |
470 | - AND ref_cod_turma = '{$this->ref_cod_turma}' | |
471 | - AND turma_modulo.ref_cod_modulo = $this->ref_cod_modulo | |
472 | - AND turma_modulo.sequencial = $this->sequencial | |
473 | - AND to_char(data_inicio,'yyyy') = $this->ano | |
474 | - ORDER BY | |
475 | - data_inicio, data_fim ASC | |
476 | - "); | |
477 | - | |
478 | - $data = explode("-",$meses); | |
475 | + $meses = $db->CampoUnico(sprintf(" | |
476 | + SELECT | |
477 | + to_char(data_inicio, 'mm') || '-' || to_char(data_fim, 'mm') | |
478 | + FROM | |
479 | + pmieducar.turma_modulo, | |
480 | + pmieducar.modulo | |
481 | + WHERE | |
482 | + modulo.cod_modulo = turma_modulo.ref_cod_modulo | |
483 | + AND ref_cod_turma = '%d' | |
484 | + AND turma_modulo.ref_cod_modulo = '%d' | |
485 | + AND turma_modulo.sequencial = '%d' | |
486 | + AND to_char(data_inicio,'yyyy') = '%d' | |
487 | + ORDER BY | |
488 | + data_inicio, data_fim ASC | |
489 | + ", $this->ref_cod_turma, $this->ref_cod_modulo, $this->sequencial, $this->ano)); | |
490 | + | |
491 | + $data = explode('-', $meses); | |
479 | 492 | |
480 | 493 | if (!$this->data_ini) { |
481 | 494 | $this->data_ini = $data[0]; |
... | ... | @@ -485,33 +498,34 @@ class indice extends clsCadastro |
485 | 498 | $this->data_fim = $data[1]; |
486 | 499 | } |
487 | 500 | |
488 | - $data_ini = explode("/",$data[0]); | |
489 | - $data_fim = explode("/",$data[1]); | |
501 | + $data_ini = explode('/', $data[0]); | |
502 | + $data_fim = explode('/', $data[1]); | |
490 | 503 | |
491 | - $meses = array($data_ini[1],$data_fim[1]); | |
492 | - $dias = array($data_ini[0],$data_fim[0]); | |
504 | + $meses = array($data_ini[1], $data_fim[1]); | |
505 | + $dias = array($data_ini[0], $data_fim[0]); | |
493 | 506 | } |
494 | 507 | |
495 | 508 | $total_dias_semanas = 0; |
496 | 509 | |
497 | 510 | if($lista_quadro_horarios) { |
511 | + for($mes_ = $meses[0]; $mes_ <= $meses[1]; $mes_++) { | |
512 | + $mes_final = FALSE; | |
498 | 513 | |
499 | - for($mes_ = $meses[0];$mes_<=$meses[1];$mes_++) | |
500 | - { | |
501 | - $mes_final = false; | |
502 | - | |
503 | - foreach ($lista_quadro_horarios as $dia_semana) | |
504 | - { | |
505 | - if($mes_ == $meses[0]) // Last Change -> $mes to $mes_ | |
514 | + foreach ($lista_quadro_horarios as $dia_semana) { | |
515 | + if($mes_ == $meses[0]) { | |
506 | 516 | $dia = $dias[0]; |
517 | + } | |
507 | 518 | elseif ($mes == $meses[1]) { |
508 | - $dia = 1;//$dias[1]; | |
509 | - $mes_final = true; | |
519 | + $dia = 1; | |
520 | + $mes_final = TRUE; | |
510 | 521 | } |
511 | 522 | else { |
512 | 523 | $dia = 1; |
513 | 524 | } |
514 | - $total_dias_semanas += $this->getDiasSemanaMes($dia, $mes_,$this->ano,$dia_semana,$mes_final); | |
525 | + | |
526 | + $total_dias_semanas += $this->getDiasSemanaMes( | |
527 | + $dia, $mes_,$this->ano,$dia_semana,$mes_final | |
528 | + ); | |
515 | 529 | } |
516 | 530 | } |
517 | 531 | |
... | ... | @@ -522,39 +536,40 @@ class indice extends clsCadastro |
522 | 536 | |
523 | 537 | $this->total = $total_dias_semanas; |
524 | 538 | |
525 | - if (!$this->total) | |
539 | + if (!$this->total) { | |
526 | 540 | break; |
527 | - | |
541 | + } | |
528 | 542 | } |
529 | 543 | |
530 | - if(!$this->em_branco) | |
531 | - { | |
544 | + if (!$this->em_branco) { | |
532 | 545 | $obj_matricula_turma = new clsPmieducarMatriculaTurma(); |
533 | - $obj_matricula_turma->setOrderby("nome_ascii"); | |
534 | - $lista_matricula = $obj_matricula_turma->lista(null,$this->ref_cod_turma,null,null,null,null,null,null,1,$this->ref_cod_serie,$this->ref_cod_curso,$this->ref_cod_escola,$this->ref_cod_instituicao,null,null,array( 1, 2, 3 ),null,null,$this->ano,null,true,null,null,true); | |
546 | + $obj_matricula_turma->setOrderby('nome_ascii'); | |
547 | + $lista_matricula = $obj_matricula_turma->lista(NULL, $this->ref_cod_turma, | |
548 | + NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie, | |
549 | + $this->ref_cod_curso, $this->ref_cod_escola, $this->ref_cod_instituicao, | |
550 | + NULL, NULL, array(1, 2, 3), NULL, NULL, $this->ano, NULL, TRUE, NULL, | |
551 | + NULL, TRUE | |
552 | + ); | |
535 | 553 | } |
536 | 554 | |
537 | - if($lista_matricula || $this->em_branco) | |
538 | - { | |
555 | + if ($lista_matricula || $this->em_branco) { | |
539 | 556 | $this->pdf->OpenPage(); |
540 | 557 | $this->addCabecalho(); |
541 | 558 | |
542 | - if($this->em_branco) | |
543 | - { | |
559 | + if ($this->em_branco) { | |
544 | 560 | $lista_matricula = array(); |
545 | - $this->numero_registros = $this->numero_registros? $this->numero_registros : 20; | |
561 | + $this->numero_registros = $this->numero_registros ? $this->numero_registros : 20; | |
562 | + | |
546 | 563 | for ($i = 0 ; $i < $this->numero_registros; $i++) { |
547 | 564 | $lista_matricula[] = ''; |
548 | 565 | } |
549 | 566 | } |
550 | 567 | |
551 | 568 | $num = 0; |
552 | - foreach ($lista_matricula as $matricula) | |
553 | - { | |
569 | + foreach ($lista_matricula as $matricula) { | |
554 | 570 | $num++; |
555 | 571 | |
556 | - if($this->page_y > 500) | |
557 | - { | |
572 | + if ($this->page_y > 500) { | |
558 | 573 | $this->desenhaLinhasVertical(); |
559 | 574 | $this->pdf->ClosePage(); |
560 | 575 | $this->pdf->OpenPage(); |
... | ... | @@ -562,9 +577,14 @@ class indice extends clsCadastro |
562 | 577 | $this->addCabecalho(); |
563 | 578 | } |
564 | 579 | |
565 | - $this->pdf->quadrado_relativo( 30, $this->page_y , 782, 19); | |
566 | - $this->pdf->escreve_relativo($matricula['nome_aluno'] , 33 ,$this->page_y + 4,160, 15, $fonte, 7, $corTexto, 'left' ); | |
567 | - $this->pdf->escreve_relativo( sprintf("%02d",$num),757, $this->page_y + 4, 30, 30, $fonte, 7, $corTexto, 'left' ); | |
580 | + $this->pdf->quadrado_relativo(30, $this->page_y, 782, 19); | |
581 | + | |
582 | + $this->pdf->escreve_relativo($matricula['nome_aluno'] , 33, | |
583 | + $this->page_y + 4, 160, 15, $fonte, 7, $corTexto, 'left'); | |
584 | + | |
585 | + $this->pdf->escreve_relativo(sprintf('%02d', $num), 757, | |
586 | + $this->page_y + 4, 30, 30, $fonte, 7, $corTexto, 'left'); | |
587 | + | |
568 | 588 | $this->page_y +=19; |
569 | 589 | } |
570 | 590 | |
... | ... | @@ -574,8 +594,8 @@ class indice extends clsCadastro |
574 | 594 | else { |
575 | 595 | echo ' |
576 | 596 | <script> |
577 | - alert("Turma não possui matriculas"); | |
578 | - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); | |
597 | + alert("Turma não possui matrículas"); | |
598 | + window.parent.fechaExpansivel(\'div_dinamico_\' + (window.parent.DOM_divs.length - 1)); | |
579 | 599 | </script>'; |
580 | 600 | |
581 | 601 | return; |
... | ... | @@ -583,26 +603,34 @@ class indice extends clsCadastro |
583 | 603 | } |
584 | 604 | } |
585 | 605 | |
586 | - if ($this->total) | |
587 | - { | |
606 | + if ($this->total) { | |
588 | 607 | $this->pdf->CloseFile(); |
589 | 608 | $this->get_link = $this->pdf->GetLink(); |
590 | 609 | } |
591 | - else | |
592 | - { | |
593 | - $this->mensagem = "Não existem dias letivos cadastrados para esta turma"; | |
610 | + else { | |
611 | + $this->mensagem = 'Não existem dias letivos cadastrados para esta turma'; | |
594 | 612 | } |
595 | 613 | } |
596 | 614 | |
597 | - echo "<script>window.onload=function(){parent.EscondeDiv('LoadImprimir');window.location='download.php?filename=".$this->get_link."'}</script>"; | |
598 | - | |
599 | - echo "<html><center>Se o download não iniciar automaticamente <br /><a target='blank' href='" . $this->get_link . "' style='font-size: 16px; color: #000000; text-decoration: underline;'>clique aqui!</a><br><br> | |
600 | - <span style='font-size: 10px;'>Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br> | |
601 | - | |
602 | - Clique na Imagem para Baixar o instalador<br><br> | |
603 | - <a href=\"http://www.adobe.com.br/products/acrobat/readstep2.html\" target=\"new\"><br><img src=\"imagens/acrobat.gif\" width=\"88\" height=\"31\" border=\"0\"></a> | |
604 | - </span> | |
605 | - </center>"; | |
615 | + echo sprintf(' | |
616 | + <script> | |
617 | + window.onload = function() | |
618 | + { | |
619 | + parent.EscondeDiv("LoadImprimir"); | |
620 | + window.location="download.php?filename=%s" | |
621 | + } | |
622 | + </script>', $this->get_link); | |
623 | + | |
624 | + echo sprintf(' | |
625 | + <html> | |
626 | + <center> | |
627 | + Se o download não iniciar automaticamente <br /><a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br><br> | |
628 | + <span style="font-size: 10px;">Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br> | |
629 | + Clique na Imagem para Baixar o instalador<br><br> | |
630 | + <a href="http://www.adobe.com.br/products/acrobat/readstep2.html" target="new"><br><img src="imagens/acrobat.gif" width="88" height="31" border="0"></a> | |
631 | + </span> | |
632 | + </center> | |
633 | + </html>', $this->get_link); | |
606 | 634 | } |
607 | 635 | |
608 | 636 | |
... | ... | @@ -630,249 +658,250 @@ class indice extends clsCadastro |
630 | 658 | |
631 | 659 | // Título principal |
632 | 660 | $titulo = $config->get($config->titulo, 'i-Educar'); |
633 | - $this->pdf->escreve_relativo($titulo, 30, 30, 782, 80, | |
634 | - $fonte, 18, $corTexto, 'center' ); | |
635 | - $this->pdf->escreve_relativo(date("d/m/Y"), 25, 30, 782, 80, $fonte, 10, | |
636 | - $corTexto, 'right' ); | |
661 | + | |
662 | + $this->pdf->escreve_relativo($titulo, 30, 30, 782, 80, $fonte, 18, $corTexto, 'center'); | |
663 | + | |
664 | + $this->pdf->escreve_relativo(date('d/m/Y'), 25, 30, 782, 80, $fonte, 10, $corTexto, 'right' ); | |
637 | 665 | |
638 | 666 | // Dados escola |
639 | - $this->pdf->escreve_relativo("Instituição:$this->nm_instituicao", 120, 52, | |
667 | + $this->pdf->escreve_relativo('Instituição: ' . $this->nm_instituicao, 120, 52, | |
640 | 668 | 300, 80, $fonte, 7, $corTexto, 'left'); |
641 | - $this->pdf->escreve_relativo("Escola:{$this->nm_escola}",132, 64, 300, 80, | |
669 | + | |
670 | + $this->pdf->escreve_relativo('Escola: ' . $this->nm_escola,132, 64, 300, 80, | |
642 | 671 | $fonte, 7, $corTexto, 'left'); |
672 | + | |
643 | 673 | $dif = 0; |
644 | 674 | |
645 | - if($this->nm_professor) { | |
646 | - $this->pdf->escreve_relativo("Prof.Regente:{$this->nm_professor}",111, 76, | |
675 | + if ($this->nm_professor) { | |
676 | + $this->pdf->escreve_relativo('Prof. Regente: ' . $this->nm_professor,111, 76, | |
647 | 677 | 300, 80, $fonte, 7, $corTexto, 'left'); |
648 | 678 | } |
649 | 679 | else { |
650 | 680 | $dif = 12; |
651 | 681 | } |
652 | 682 | |
653 | - $this->pdf->escreve_relativo("Série:{$this->nm_serie}",138, 88 - $dif, | |
683 | + $this->pdf->escreve_relativo('Série: ' . $this->nm_serie,138, 88 - $dif, | |
654 | 684 | 300, 80, $fonte, 7, $corTexto, 'left'); |
655 | - $this->pdf->escreve_relativo("Turma:{$this->nm_turma}",134, 100 - $dif, 300, | |
685 | + | |
686 | + $this->pdf->escreve_relativo('Turma: ' . $this->nm_turma,134, 100 - $dif, 300, | |
656 | 687 | 80, $fonte, 7, $corTexto, 'left'); |
657 | 688 | |
658 | 689 | // Título |
659 | - $nm_disciplina = ""; | |
690 | + $nm_disciplina = ''; | |
660 | 691 | if ($this->nm_disciplina) { |
661 | - $nm_disciplina = " - $this->nm_disciplina"; | |
692 | + $nm_disciplina = ' - ' . $this->nm_disciplina; | |
662 | 693 | } |
663 | 694 | |
664 | - $this->pdf->escreve_relativo( "Diário de Frequência {$nm_disciplina}", 30, | |
695 | + $this->pdf->escreve_relativo('Diário de Frequência ' . $nm_disciplina, 30, | |
665 | 696 | 75, 782, 80, $fonte, 12, $corTexto, 'center'); |
666 | 697 | |
667 | 698 | $obj_modulo = new clsPmieducarModulo($this->ref_cod_modulo); |
668 | 699 | $det_modulo = $obj_modulo->detalhe(); |
669 | 700 | |
670 | 701 | // Data |
671 | - $this->pdf->escreve_relativo("{$this->data_ini} até {$this->data_fim} de {$this->ano}", | |
702 | + $this->pdf->escreve_relativo( | |
703 | + sprintf('%s até %s de %s', $this->data_ini, $this->data_fim, $this->ano), | |
672 | 704 | 45, 100, 782, 80, $fonte, 10, $corTexto, 'center'); |
673 | 705 | |
674 | 706 | $this->pdf->linha_relativa(201, 125, 612, 0); |
675 | 707 | |
676 | - $this->page_y +=19; | |
677 | - $this->pdf->escreve_relativo("Dias de aula: {$this->total}", 715, 100, 535, | |
708 | + $this->page_y += 19; | |
709 | + | |
710 | + $this->pdf->escreve_relativo('Dias de aula: ' . $this->total, 715, 100, 535, | |
678 | 711 | 80, $fonte, 10, $corTexto, 'left'); |
679 | 712 | } |
680 | 713 | |
681 | 714 | |
682 | - function desenhaLinhasVertical() | |
683 | - { | |
684 | - $corTexto = '#000000'; | |
685 | - /** | |
686 | - * | |
687 | - */ | |
688 | - //612 | |
689 | - $largura_anos = 550; | |
715 | + function desenhaLinhasVertical() | |
716 | + { | |
717 | + $corTexto = '#000000'; | |
718 | + | |
719 | + $largura_anos = 550; | |
720 | + | |
721 | + if ($this->total >= 1) { | |
722 | + $incremental = floor($largura_anos / ($this->total +1)) ; | |
723 | + } | |
724 | + else { | |
725 | + $incremental = 1; | |
726 | + } | |
727 | + | |
728 | + $reta_ano_x = 200 ; | |
729 | + | |
730 | + $resto = $largura_anos - ($incremental * $this->total); | |
731 | + | |
732 | + for ($linha = 0; $linha < $this->total + 1; $linha++) { | |
733 | + if (($resto > 0) || $linha == 0) { | |
734 | + $reta_ano_x++; | |
735 | + $resto--; | |
736 | + } | |
737 | + | |
738 | + $this->pdf->linha_relativa($reta_ano_x, 125, 0, $this->page_y - 125); | |
739 | + | |
740 | + $reta_ano_x += $incremental; | |
741 | + } | |
742 | + | |
743 | + $this->pdf->linha_relativa(812, 125, 0, $this->page_y - 125); | |
744 | + | |
745 | + $this->pdf->escreve_relativo('Nº:', 755, 128, 100, 80, $fonte, 7, $corTexto, 'left'); | |
746 | + | |
747 | + $this->pdf->linha_relativa(775, 125, 0, $this->page_y - 125); | |
748 | + | |
749 | + $this->pdf->escreve_relativo('Faltas', 783, 128, 100, 80, $fonte, 7, $corTexto, 'left'); | |
750 | + | |
751 | + $this->rodape(); | |
752 | + $this->pdf->ClosePage(); | |
753 | + $this->pdf->OpenPage(); | |
754 | + $this->page_y = 125; | |
755 | + $this->addCabecalho(); | |
756 | + | |
757 | + for ($ct = 125; $ct < 500; $ct += 19) { | |
758 | + $this->pdf->quadrado_relativo(30, $ct , 782, 19); | |
759 | + } | |
760 | + | |
761 | + $this->pdf->escreve_relativo('Observações', 30, 130, 782, 30, $fonte, 7, | |
762 | + $corTexto, 'center'); | |
763 | + | |
764 | + $this->pdf->linha_relativa(418, 144, 0, 360); | |
765 | + } | |
766 | + | |
767 | + function rodape() | |
768 | + { | |
769 | + $corTexto = '#000000'; | |
770 | + $fonte = 'arial'; | |
771 | + $dataAtual = date('d/m/Y'); | |
772 | + $this->pdf->escreve_relativo('Data: ' . $dataAtual, 36,795, 100, 50, $fonte, | |
773 | + 7, $corTexto, 'left'); | |
774 | + | |
775 | + $this->pdf->escreve_relativo('Assinatura do Professor(a)', 695, 520, 100, 50, | |
776 | + $fonte, 7, $corTexto, 'left'); | |
777 | + | |
778 | + $this->pdf->linha_relativa(660, 517, 130, 0); | |
779 | + } | |
780 | + | |
781 | + function Editar() | |
782 | + { | |
783 | + return FALSE; | |
784 | + } | |
785 | + | |
786 | + function Excluir() | |
787 | + { | |
788 | + return FALSE; | |
789 | + } | |
790 | + | |
791 | + function getNumeroDiasMes($dia, $mes, $ano, $mes_final = FALSE) | |
792 | + { | |
793 | + $year = $ano; | |
794 | + $month = $mes; | |
795 | + | |
796 | + $date = mktime(1, 1, 1, $month, $dia, $year); | |
797 | + | |
798 | + $first_day_of_month = strtotime('-' . (date('d', $date) - 1) . ' days', $date); | |
799 | + $last_day_of_month = strtotime('+' . (date('t', $first_day_of_month) - 1) . ' days', $first_day_of_month); | |
800 | + | |
801 | + $last_day_of_month = date('d', $last_day_of_month); | |
802 | + | |
803 | + $numero_dias = 0; | |
804 | + | |
805 | + $obj_calendario = new clsPmieducarCalendarioAnoLetivo(); | |
806 | + $obj_calendario->setCamposLista('cod_calendario_ano_letivo'); | |
807 | + $lista = $obj_calendario->lista(NULL, $this->ref_cod_escola, NULL, NULL, | |
808 | + $this->ano, NULL, NULL, NULL, NULL, 1); | |
809 | + | |
810 | + if ($lista) { | |
811 | + $lista_calendario = array_shift($lista); | |
812 | + } | |
813 | + | |
814 | + $obj_dia = new clsPmieducarCalendarioDia(); | |
815 | + $obj_dia->setCamposLista('dia'); | |
816 | + $dias_nao_letivo = $obj_dia->lista($lista_calendario, $mes, NULL, NULL, NULL, | |
817 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, "'n'"); | |
818 | + | |
819 | + if (!$dias_nao_letivo) { | |
820 | + $dias_nao_letivo = array(); | |
821 | + } | |
822 | + | |
823 | + if ($mes_final) { | |
824 | + $last_day_of_month = $dia; | |
825 | + $dia = 1; | |
826 | + } | |
827 | + | |
828 | + for ($day = $dia; $day <= $last_day_of_month; $day++) { | |
829 | + $date = mktime(1, 1, 1, $month, $day, $year); | |
830 | + $dia_semana_corrente = getdate($date); | |
831 | + $dia_semana_corrente = $dia_semana_corrente['wday'] + 1; | |
832 | + | |
833 | + if (($dia_semana_corrente != 1 && $dia_semana_corrente != 7) && (array_search($day,$dias_nao_letivo) === FALSE)) { | |
834 | + $numero_dias++; | |
835 | + } | |
836 | + } | |
837 | + | |
838 | + return $numero_dias; | |
839 | + } | |
840 | + | |
841 | + function getDiasSemanaMes($dia, $mes, $ano, $dia_semana, $mes_final = FALSE) | |
842 | + { | |
843 | + $year = $ano; | |
844 | + $month = $mes; | |
845 | + | |
846 | + $date = mktime(1, 1, 1, $month, $dia, $year); | |
690 | 847 | |
691 | - if($this->total >= 1) | |
692 | - { | |
848 | + $first_day_of_month = strtotime("-" . (date("d", $date) - 1) . " days", $date); | |
849 | + $last_day_of_month = strtotime("+" . (date("t", $first_day_of_month) - 1) . " days", $first_day_of_month); | |
693 | 850 | |
694 | - $incremental = floor($largura_anos/ ($this->total +1)) ; | |
851 | + $last_day_of_month = date("d", $last_day_of_month); | |
695 | 852 | |
696 | - }else { | |
853 | + $numero_dias = 0; | |
697 | 854 | |
698 | - $incremental = 1; | |
699 | - } | |
700 | - | |
701 | - $reta_ano_x = 200 ; | |
702 | - | |
703 | - | |
704 | - $resto = $largura_anos - ($incremental * $this->total); | |
705 | - | |
706 | - for($linha = 0;$linha <$this->total+1;$linha++) | |
707 | - { | |
708 | - | |
709 | - if(( $resto > 0) /*|| ($linha + 1 == $total && $resto >= 1) */|| $linha == 0) | |
710 | - { | |
711 | - $reta_ano_x++; | |
712 | - $resto--; | |
713 | - } | |
714 | - | |
715 | - $this->pdf->linha_relativa($reta_ano_x,125,0,$this->page_y - 125); | |
716 | - | |
717 | - $reta_ano_x += $incremental; | |
718 | - | |
719 | - } | |
720 | - | |
721 | - $this->pdf->linha_relativa(812,125,0,$this->page_y - 125); | |
722 | - | |
723 | - $this->pdf->escreve_relativo( "Nº:",755, 128, 100, 80, $fonte, 7, $corTexto, 'left' ); | |
724 | - $this->pdf->linha_relativa(775,125,0,$this->page_y - 125); | |
725 | - $this->pdf->escreve_relativo( "Faltas",783, 128, 100, 80, $fonte, 7, $corTexto, 'left' ); | |
726 | - | |
727 | - $this->rodape(); | |
728 | - $this->pdf->ClosePage(); | |
729 | - $this->pdf->OpenPage(); | |
730 | - $this->page_y = 125; | |
731 | - $this->addCabecalho(); | |
855 | + $obj_calendario = new clsPmieducarCalendarioAnoLetivo(); | |
856 | + $obj_calendario->setCamposLista("cod_calendario_ano_letivo"); | |
857 | + $lista_calendario = $obj_calendario->lista(NULL, $this->ref_cod_escola, NULL, | |
858 | + NULL, $this->ano, NULL, NULL, NULL, NULL, 1); | |
859 | + | |
860 | + if (is_array($lista_calendario)) { | |
861 | + $lista_calendario = array_shift($lista_calendario); | |
862 | + } | |
863 | + | |
864 | + $obj_dia = new clsPmieducarCalendarioDia(); | |
865 | + $obj_dia->setCamposLista('dia'); | |
866 | + $dias_nao_letivo = $obj_dia->lista($lista_calendario,$mes, NULL, NULL, NULL, | |
867 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, "'n'"); | |
868 | + | |
869 | + if (!$dias_nao_letivo) { | |
870 | + $dias_nao_letivo = array(); | |
871 | + } | |
732 | 872 | |
733 | - for($ct = 125;$ct < 500;$ct += 19) | |
734 | - { | |
735 | - $this->pdf->quadrado_relativo( 30, $ct , 782, 19); | |
736 | - } | |
737 | - $this->pdf->escreve_relativo( "Observações",30, 130, 782, 30, $fonte, 7, $corTexto, 'center' ); | |
738 | - $this->pdf->linha_relativa(418,144,0,360); | |
739 | - | |
740 | - /** | |
741 | - * | |
742 | - */ | |
743 | - } | |
744 | - | |
745 | - function rodape() | |
746 | - { | |
747 | - $corTexto = '#000000'; | |
748 | - $fonte = 'arial'; | |
749 | - $dataAtual = date("d/m/Y"); | |
750 | - $this->pdf->escreve_relativo( "Data: $dataAtual", 36,795, 100, 50, $fonte, 7, $corTexto, 'left' ); | |
751 | - | |
752 | - //$this->pdf->escreve_relativo( "Assinatura do Diretor(a)", 68,520, 100, 50, $fonte, 7, $corTexto, 'left' ); | |
753 | - $this->pdf->escreve_relativo( "Assinatura do Professor(a)", 695,520, 100, 50, $fonte, 7, $corTexto, 'left' ); | |
754 | - //$this->pdf->linha_relativa(52,517,130,0); | |
755 | - $this->pdf->linha_relativa(660,517,130,0); | |
756 | - } | |
757 | - | |
758 | - function Editar() | |
759 | - { | |
760 | - return false; | |
761 | - } | |
762 | - | |
763 | - function Excluir() | |
764 | - { | |
765 | - return false; | |
766 | - } | |
767 | - | |
768 | - | |
769 | - //function getNumeroSemanasMes($mes,$ano,$primeiro_dia_semana = null,$ultimo_dia_semana = null) | |
770 | - function getNumeroDiasMes($dia,$mes,$ano,$mes_final = false) | |
771 | - { | |
772 | - $year = $ano; | |
773 | - $month = $mes; | |
774 | - | |
775 | - $date = mktime(1, 1, 1, $month, $dia/*date("d")*/, $year); | |
776 | - | |
777 | - $first_day_of_month = strtotime("-" . (date("d", $date)-1) . " days", $date); | |
778 | - $last_day_of_month = strtotime("+" . (date("t", $first_day_of_month)-1) . " days", $first_day_of_month); | |
779 | - | |
780 | - //$first_week_day = date("l", $first_day_of_month); | |
781 | - $last_day_of_month = date("d", $last_day_of_month); | |
782 | - | |
783 | - $numero_dias = 0; | |
784 | - /** | |
785 | - * verifica se dia eh feriado | |
786 | - */ | |
787 | - $obj_calendario = new clsPmieducarCalendarioAnoLetivo(); | |
788 | - $obj_calendario->setCamposLista("cod_calendario_ano_letivo"); | |
789 | - $lista = $obj_calendario->lista(null,$this->ref_cod_escola,null,null,$this->ano,null,null,null,null,1); | |
790 | - if($lista) | |
791 | - { | |
792 | - $lista_calendario = array_shift($lista); | |
793 | - } | |
794 | - $obj_dia = new clsPmieducarCalendarioDia(); | |
795 | - $obj_dia->setCamposLista("dia"); | |
796 | - $dias_nao_letivo = $obj_dia->lista($lista_calendario,$mes,null,null,null,null,null,null,null,null,null,null,1,"'n'"); | |
797 | - if(!$dias_nao_letivo) | |
798 | - $dias_nao_letivo = array(); | |
799 | - if($mes_final) | |
800 | - { | |
801 | - $last_day_of_month = $dia; | |
802 | - $dia = 1; | |
803 | - } | |
804 | - for($day = $dia; $day <= $last_day_of_month; $day++) | |
805 | - { | |
806 | - $date = mktime(1, 1, 1, $month, $day, $year); | |
807 | - $dia_semana_corrente = getdate($date); | |
808 | - $dia_semana_corrente = $dia_semana_corrente['wday'] + 1; | |
809 | - | |
810 | - if( ($dia_semana_corrente != 1 && $dia_semana_corrente != 7) && (array_search($day,$dias_nao_letivo) === false)) | |
811 | - $numero_dias++; | |
812 | - } | |
813 | - | |
814 | - | |
815 | - return $numero_dias; | |
816 | - } | |
817 | - | |
818 | - function getDiasSemanaMes($dia,$mes,$ano,$dia_semana,$mes_final = false) | |
819 | - { | |
820 | - $year = $ano; | |
821 | - $month = $mes; | |
822 | - | |
823 | - $date = mktime(1, 1, 1, $month, $dia/*date("d")*/, $year); | |
824 | - | |
825 | - $first_day_of_month = strtotime("-" . (date("d", $date)-1) . " days", $date); | |
826 | - $last_day_of_month = strtotime("+" . (date("t", $first_day_of_month)-1) . " days", $first_day_of_month); | |
827 | - | |
828 | - //$first_week_day = date("l", $first_day_of_month); | |
829 | - $last_day_of_month = date("d", $last_day_of_month); | |
830 | - | |
831 | - $numero_dias = 0; | |
832 | - | |
833 | - | |
834 | - /** | |
835 | - * verifica se dia eh feriado | |
836 | - */ | |
837 | - $obj_calendario = new clsPmieducarCalendarioAnoLetivo(); | |
838 | - $obj_calendario->setCamposLista("cod_calendario_ano_letivo"); | |
839 | - $lista_calendario = $obj_calendario->lista(null,$this->ref_cod_escola,null,null,$this->ano,null,null,null,null,1); | |
840 | - if(is_array($lista_calendario)) | |
841 | - $lista_calendario = array_shift($lista_calendario); | |
842 | - $obj_dia = new clsPmieducarCalendarioDia(); | |
843 | - $obj_dia->setCamposLista("dia"); | |
844 | - $dias_nao_letivo = $obj_dia->lista($lista_calendario,$mes,null,null,null,null,null,null,null,null,null,null,1,"'n'"); | |
845 | - if(!$dias_nao_letivo) | |
846 | - $dias_nao_letivo = array(); | |
847 | - if($mes_final) | |
848 | - { | |
849 | - $last_day_of_month = $dia; | |
850 | - $dia = 1; | |
851 | - } | |
852 | - for($day = $dia; $day <= $last_day_of_month; $day++) | |
853 | - { | |
854 | - $date = mktime(1, 1, 1, $month, $day, $year); | |
855 | - $dia_semana_corrente = getdate($date); | |
856 | - $dia_semana_corrente = $dia_semana_corrente['wday'] + 1; | |
857 | - | |
858 | - $data_atual = "{$day}/{$mes}/{$ano}"; | |
859 | - $data_final = "{$this->data_fim}/{$ano}"; | |
860 | - | |
861 | - if(($dia_semana == $dia_semana_corrente) && (array_search($day,$dias_nao_letivo) === false) && data_maior($data_final, $data_atual)) | |
862 | - $numero_dias++; | |
863 | - } | |
864 | - return $numero_dias; | |
865 | - } | |
873 | + if($mes_final) { | |
874 | + $last_day_of_month = $dia; | |
875 | + $dia = 1; | |
876 | + } | |
877 | + | |
878 | + for($day = $dia; $day <= $last_day_of_month; $day++) { | |
879 | + $date = mktime(1, 1, 1, $month, $day, $year); | |
880 | + $dia_semana_corrente = getdate($date); | |
881 | + $dia_semana_corrente = $dia_semana_corrente['wday'] + 1; | |
882 | + | |
883 | + $data_atual = sprintf("%s/%s/%s", $day, $mes, $ano); | |
884 | + $data_final = sprintf("%s/%s", $this->data_fim, $ano); | |
885 | + | |
886 | + if (($dia_semana == $dia_semana_corrente) && | |
887 | + (array_search($day,$dias_nao_letivo) === FALSE) && data_maior($data_final, $data_atual) | |
888 | + ) { | |
889 | + $numero_dias++; | |
890 | + } | |
891 | + } | |
892 | + | |
893 | + return $numero_dias; | |
894 | + } | |
866 | 895 | } |
867 | 896 | |
868 | -// cria uma extensao da classe base | |
897 | +// Instancia objeto de página | |
869 | 898 | $pagina = new clsIndexBase(); |
870 | -// cria o conteudo | |
899 | + | |
900 | +// Instancia objeto de conteúdo | |
871 | 901 | $miolo = new indice(); |
872 | -// adiciona o conteudo na clsBase | |
873 | -$pagina->addForm( $miolo ); | |
874 | -// gera o html | |
875 | -$pagina->MakeAll(); | |
876 | 902 | |
903 | +// Atribui o conteúdo à página | |
904 | +$pagina->addForm($miolo); | |
877 | 905 | |
878 | -?> | |
906 | +// Gera o código HTML | |
907 | +$pagina->MakeAll(); | |
879 | 908 | \ No newline at end of file | ... | ... |