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