Commit c35fd4534dd181cbf71bb6c76c5f09b73822cfe1

Authored by Eriksen Costa Paixão
1 parent d0e50f7c
Exists in master

Removido código desnecessário

ieducar/intranet/educar_relatorio_alunos_quinta_avaliacao.php
@@ -69,52 +69,10 @@ class indice extends clsCadastro @@ -69,52 +69,10 @@ class indice extends clsCadastro
69 69
70 var $ref_cod_instituicao; 70 var $ref_cod_instituicao;
71 var $ref_cod_escola; 71 var $ref_cod_escola;
  72 + var $ref_cod_curso;
72 var $ref_cod_serie; 73 var $ref_cod_serie;
73 var $ref_cod_turma; 74 var $ref_cod_turma;
74 75
75 - var $ano;  
76 - var $mes;  
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 - var $curso_com_exame = 0;  
90 - var $ref_cod_matricula;  
91 -  
92 - var $page_y = 135;  
93 -  
94 - var $nm_aluno;  
95 - var $array_modulos = array();  
96 - var $nm_curso;  
97 - var $get_link = false;  
98 -  
99 - var $total;  
100 -  
101 - var $ref_cod_modulo;  
102 -  
103 - var $meses_do_ano = array(  
104 - 1 => 'JANEIRO',  
105 - 2 => 'FEVEREIRO',  
106 - 3 => 'MARÇO',  
107 - 4 => 'ABRIL',  
108 - 5 => 'MAIO',  
109 - 6 => 'JUNHO',  
110 - 7 => 'JULHO',  
111 - 8 => 'AGOSTO',  
112 - 9 => 'SETEMBRO',  
113 - 10 => 'OUTUBRO',  
114 - 11 => 'NOVEMBRO',  
115 - 12 => 'DEZEMBRO'  
116 - );  
117 -  
118 function Inicializar() 76 function Inicializar()
119 { 77 {
120 $retorno = 'Novo'; 78 $retorno = 'Novo';
@@ -123,15 +81,13 @@ class indice extends clsCadastro @@ -123,15 +81,13 @@ class indice extends clsCadastro
123 $this->pessoa_logada = $_SESSION['id_pessoa']; 81 $this->pessoa_logada = $_SESSION['id_pessoa'];
124 @session_write_close(); 82 @session_write_close();
125 83
126 - $obj_permissoes = new clsPermissoes();  
127 -  
128 return $retorno; 84 return $retorno;
129 } 85 }
130 86
131 function Gerar() 87 function Gerar()
132 { 88 {
133 $obj_permissoes = new clsPermissoes(); 89 $obj_permissoes = new clsPermissoes();
134 - $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada); 90 + $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
135 91
136 if ($_POST){ 92 if ($_POST){
137 foreach ($_POST as $key => $value) { 93 foreach ($_POST as $key => $value) {
@@ -139,10 +95,7 @@ class indice extends clsCadastro @@ -139,10 +95,7 @@ class indice extends clsCadastro
139 } 95 }
140 } 96 }
141 97
142 - $this->ano = $ano_atual = date("Y");  
143 - $this->mes = $mes_atual = date("n");  
144 -  
145 - $this->campoNumero("ano", "Ano", $this->ano, 4, 4, TRUE); 98 + $this->campoNumero('ano', 'Ano', date('Y'), 4, 4, TRUE);
146 99
147 $get_escola = TRUE; 100 $get_escola = TRUE;
148 $exibe_nm_escola = TRUE; 101 $exibe_nm_escola = TRUE;
@@ -152,13 +105,9 @@ class indice extends clsCadastro @@ -152,13 +105,9 @@ class indice extends clsCadastro
152 $curso_obrigatorio = TRUE; 105 $curso_obrigatorio = TRUE;
153 $instituicao_obrigatorio = TRUE; 106 $instituicao_obrigatorio = TRUE;
154 107
155 - include "include/pmieducar/educar_campo_lista.php"; 108 + include 'include/pmieducar/educar_campo_lista.php';
156 109
157 - $this->campoLista("ref_cod_turma", "Turma", array('' => 'Selecione'), '');  
158 -  
159 - if ($this->ref_cod_escola) {  
160 - $this->ref_ref_cod_escola = $this->ref_cod_escola;  
161 - } 110 + $this->campoLista('ref_cod_turma', 'Turma', array('' => 'Selecione'), '');
162 111
163 $this->url_cancelar = 'educar_index.php'; 112 $this->url_cancelar = 'educar_index.php';
164 $this->nome_url_cancelar = 'Cancelar'; 113 $this->nome_url_cancelar = 'Cancelar';
ieducar/intranet/educar_relatorio_alunos_quinta_avaliacao_proc.php
@@ -86,7 +86,7 @@ class indice extends clsCadastro @@ -86,7 +86,7 @@ class indice extends clsCadastro
86 86
87 function renderHTML() 87 function renderHTML()
88 { 88 {
89 - if($_POST){ 89 + if ($_POST){
90 foreach ($_POST as $key => $value) { 90 foreach ($_POST as $key => $value) {
91 $this->$key = $value; 91 $this->$key = $value;
92 } 92 }
@@ -103,239 +103,254 @@ class indice extends clsCadastro @@ -103,239 +103,254 @@ class indice extends clsCadastro
103 is_numeric($this->ref_cod_serie) && is_numeric($this->ref_cod_turma) && 103 is_numeric($this->ref_cod_serie) && is_numeric($this->ref_cod_turma) &&
104 is_numeric($this->ano) 104 is_numeric($this->ano)
105 ) { 105 ) {
106 - $obj_ref_cod_curso = new clsPmieducarCurso($this->ref_cod_curso);  
107 - $det_ref_cod_curso = $obj_ref_cod_curso->detalhe();  
108 106
109 - $nm_curso = $det_ref_cod_curso['nm_curso'];  
110 - $padrao_ano_escolar = $det_ref_cod_curso['padrao_ano_escolar']; 107 + }
111 108
112 - if ($padrao_ano_escolar) {  
113 - $obj_ano_letivo = new clsPmieducarEscolaAnoLetivo();  
114 - $lst_ano_letivo = $obj_ano_letivo->lista( $this->ref_cod_escola,$this->ano,null,null,null,null,null,null,null,1 ); 109 + $obj_ref_cod_curso = new clsPmieducarCurso($this->ref_cod_curso);
  110 + $det_ref_cod_curso = $obj_ref_cod_curso->detalhe();
115 111
116 - if (is_array($lst_ano_letivo)) {  
117 - $det_ano_letivo = array_shift($lst_ano_letivo);  
118 - $ano_letivo = $det_ano_letivo['ano']; 112 + $nm_curso = $det_ref_cod_curso['nm_curso'];
  113 + $padrao_ano_escolar = $det_ref_cod_curso['padrao_ano_escolar'];
119 114
120 - $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo();  
121 - $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($ano_letivo, $this->ref_cod_escola); 115 + if ($padrao_ano_escolar) {
  116 + $obj_ano_letivo = new clsPmieducarEscolaAnoLetivo();
  117 + $lst_ano_letivo = $obj_ano_letivo->lista($this->ref_cod_escola, $this->ano,
  118 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
122 119
123 - if (is_array($lst_ano_letivo_modulo)) {  
124 - $qtd_modulos = count($lst_ano_letivo_modulo);  
125 - }  
126 - }  
127 - else {  
128 - echo '  
129 - <script>  
130 - alert("Escola não possui calendário definido para este ano");  
131 - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));  
132 - </script>';  
133 -  
134 - return TRUE; 120 + if (is_array($lst_ano_letivo)) {
  121 + $det_ano_letivo = array_shift($lst_ano_letivo);
  122 + $ano_letivo = $det_ano_letivo['ano'];
  123 +
  124 + $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo();
  125 + $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($ano_letivo, $this->ref_cod_escola);
  126 +
  127 + if (is_array($lst_ano_letivo_modulo)) {
  128 + $qtd_modulos = count($lst_ano_letivo_modulo);
135 } 129 }
136 } 130 }
137 else { 131 else {
138 - $obj_turma_modulo = new clsPmieducarTurmaModulo();  
139 - $lst_turma_modulo = $obj_turma_modulo->lista($registro['ref_cod_turma']); 132 + echo '
  133 + <script>
  134 + alert("Escola não possui calendário definido para este ano");
  135 + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
  136 + </script>';
140 137
141 - if (is_array($lst_turma_modulo)) {  
142 - $qtd_modulos = count($lst_turma_modulo);  
143 - } 138 + return TRUE;
144 } 139 }
  140 + }
  141 + else {
  142 + $obj_turma_modulo = new clsPmieducarTurmaModulo();
  143 + $lst_turma_modulo = $obj_turma_modulo->lista($registro['ref_cod_turma']);
145 144
146 - if ($this->ano == date('Y')) {  
147 - $sql = " 145 + if (is_array($lst_turma_modulo)) {
  146 + $qtd_modulos = count($lst_turma_modulo);
  147 + }
  148 + }
  149 +
  150 + if ($this->ano == date('Y')) {
  151 + $sql = sprintf('
  152 + SELECT
  153 + m.cod_matricula,
  154 + (
148 SELECT 155 SELECT
149 - m.cod_matricula,  
150 - (  
151 - SELECT  
152 - nome  
153 - FROM  
154 - pmieducar.aluno al,  
155 - cadastro.pessoa  
156 - WHERE  
157 - al.cod_aluno = m.ref_cod_aluno  
158 - AND al.ref_idpes = pessoa.idpes  
159 - ) AS nome 156 + nome
160 FROM 157 FROM
161 - pmieducar.matricula m,  
162 - pmieducar.matricula_turma mt 158 + pmieducar.aluno al,
  159 + cadastro.pessoa
163 WHERE 160 WHERE
164 - mt.ref_cod_turma = {$this->ref_cod_turma}  
165 - AND mt.ref_cod_matricula = m.cod_matricula AND m.aprovado = 3  
166 - AND mt.ativo = 1 AND m.ativo = 1  
167 - AND m.modulo > {$qtd_modulos}  
168 - AND m.ano = {$this->ano}  
169 - ORDER BY  
170 - nome";  
171 - }  
172 - else {  
173 - $sql = " 161 + al.cod_aluno = m.ref_cod_aluno
  162 + AND al.ref_idpes = pessoa.idpes
  163 + ) AS nome
  164 + FROM
  165 + pmieducar.matricula m,
  166 + pmieducar.matricula_turma mt
  167 + WHERE
  168 + mt.ref_cod_turma = %d
  169 + AND mt.ref_cod_matricula = m.cod_matricula
  170 + AND m.aprovado = 3
  171 + AND mt.ativo = 1 AND m.ativo = 1
  172 + AND m.modulo > %d
  173 + AND m.ano = %d
  174 + ORDER BY
  175 + nome', $this->ref_cod_turma, $qtd_modulos, $this->ano);
  176 + }
  177 + else {
  178 + $sql = sprintf('
  179 + SELECT
  180 + m.cod_matricula,
  181 + (
174 SELECT 182 SELECT
175 - m.cod_matricula,  
176 - (SELECT  
177 - nome  
178 - FROM  
179 - pmieducar.aluno al,  
180 - cadastro.pessoa  
181 - WHERE  
182 - al.cod_aluno = m.ref_cod_aluno  
183 - AND al.ref_idpes = pessoa.idpes  
184 - ) AS nome 183 + nome
185 FROM 184 FROM
186 - pmieducar.matricula m,  
187 - pmieducar.matricula_turma mt 185 + pmieducar.aluno al,
  186 + cadastro.pessoa
188 WHERE 187 WHERE
189 - mt.ref_cod_turma = {$this->ref_cod_turma}  
190 - AND mt.ref_cod_matricula = m.cod_matricula  
191 - AND m.aprovado IN (1, 2, 3)  
192 - AND mt.ativo = 1 AND m.ativo = 1  
193 - AND m.modulo > {$qtd_modulos}  
194 - AND m.ano = {$this->ano}  
195 - ORDER BY  
196 - nome";  
197 - } 188 + al.cod_aluno = m.ref_cod_aluno
  189 + AND al.ref_idpes = pessoa.idpes
  190 + ) AS nome
  191 + FROM
  192 + pmieducar.matricula m,
  193 + pmieducar.matricula_turma mt
  194 + WHERE
  195 + mt.ref_cod_turma = %d
  196 + AND mt.ref_cod_matricula = m.cod_matricula
  197 + AND m.aprovado IN (1, 2, 3)
  198 + AND mt.ativo = 1 AND m.ativo = 1
  199 + AND m.modulo > %d
  200 + AND m.ano = %d
  201 + ORDER BY
  202 + nome', $this->ref_cod_turma, $qtd_modulos, $this->ano);
  203 + }
198 204
199 - $db = new clsBanco();  
200 - $db->Consulta($sql); 205 + $db = new clsBanco();
  206 + $db->Consulta($sql);
201 207
202 - if ($db->Num_Linhas()) {  
203 - $alunos = array(); 208 + if ($db->Num_Linhas()) {
  209 + $alunos = array();
204 210
205 - // Disciplinas da escola-série  
206 - $obj_disciplinas = new clsPmieducarEscolaSerieDisciplina();  
207 - $obj_disciplinas->setOrderby('nm_disciplina');  
208 - $obj_disciplinas->setCamposLista('cod_disciplina, nm_disciplina');  
209 - $lst_disciplinas = $obj_disciplinas->lista($this->ref_cod_serie,  
210 - $this->ref_cod_escola, NULL, 1, TRUE); 211 + // Disciplinas da escola-série
  212 + $obj_disciplinas = new clsPmieducarEscolaSerieDisciplina();
  213 + $obj_disciplinas->setOrderby('nm_disciplina');
  214 + $obj_disciplinas->setCamposLista('cod_disciplina, nm_disciplina');
  215 + $lst_disciplinas = $obj_disciplinas->lista($this->ref_cod_serie,
  216 + $this->ref_cod_escola, NULL, 1, TRUE);
211 217
212 - // Curso  
213 - $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);  
214 - $obj_curso->setCamposLista('media, media_exame, nm_curso');  
215 - $det_curso = $obj_curso->detalhe(); 218 + // Curso
  219 + $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
  220 + $obj_curso->setCamposLista('media, media_exame, nm_curso');
  221 + $det_curso = $obj_curso->detalhe();
216 222
217 - $this->media = $det_curso['media'];  
218 - $this->media_exame = $det_curso['media_exame']; 223 + $this->media = $det_curso['media'];
  224 + $this->media_exame = $det_curso['media_exame'];
219 225
220 - // Instancia objeto de relatório padrão  
221 - $relatorio = new relatorios('Relação de alunos em 5ª avaliação', 210,  
222 - FALSE, 'Relação de alunos em 5ª avaliação', 'A4',  
223 - "{$this->nm_instituicao}\n{$this->nm_escola}\n{$this->nm_curso}\n{$this->nm_serie} - Turma: $this->nm_turma " . date("d/m/Y")); 226 + // Instancia objeto de relatório padrão
  227 + $detalhes = sprintf('%s%s%s%s%s%s%s - Turma: %s %s', $this->nm_instituicao,
  228 + "\n", $this->nm_escola, "\n", $this->nm_curso, "\n", $this->nm_serie,
  229 + $this->nm_turma, date('d/m/Y'));
224 230
225 - $relatorio->setMargem(20, 20, 20, 20); 231 + $relatorio = new relatorios('Relação de alunos em 5ª avaliação', 210,
  232 + FALSE, 'Relação de alunos em 5ª avaliação', 'A4', $detalhes);
226 233
227 - // Escola  
228 - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);  
229 - $nm_escola = $obj_escola->detalhe();  
230 - $nm_escola = $nm_escola['nome'];  
231 - $nm_curso = $det_curso['nm_curso']; 234 + $relatorio->setMargem(20, 20, 20, 20);
232 235
233 - // Série  
234 - $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);  
235 - $obj_serie->setCamposLista('nm_serie');  
236 - $det_serie = $obj_serie->detalhe();  
237 - $nm_serie = $det_serie['nm_serie']; 236 + // Escola
  237 + $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
  238 + $nm_escola = $obj_escola->detalhe();
  239 + $nm_escola = $nm_escola['nome'];
  240 + $nm_curso = $det_curso['nm_curso'];
238 241
239 - // Turma  
240 - $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);  
241 - $obj_turma->setCamposLista('nm_turma');  
242 - $det_turma = $obj_turma->detalhe();  
243 - $nm_turma = $det_turma['nm_turma']; 242 + // Série
  243 + $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
  244 + $obj_serie->setCamposLista('nm_serie');
  245 + $det_serie = $obj_serie->detalhe();
  246 + $nm_serie = $det_serie['nm_serie'];
244 247
245 - $relatorio->novalinha(array(sprintf('Nome Escola: %s Ano: %d', $nm_escola, $this->ano)),  
246 - 0, 12, TRUE, 'arial', FALSE, '#000000', '#d3d3d3', '#FFFFFF', FALSE, TRUE); 248 + // Turma
  249 + $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
  250 + $obj_turma->setCamposLista('nm_turma');
  251 + $det_turma = $obj_turma->detalhe();
  252 + $nm_turma = $det_turma['nm_turma'];
247 253
248 - $relatorio->novalinha(array(sprintf('Curso: %s Ano/Série: %s Turma: %s Date: %s', $nm_curso, $nm_serie, $nm_turma, date('d/m/Y'))),  
249 - 0, 12, TRUE, 'arial', FALSE, '#000000', '#d3d3d3', '#FFFFFF', FALSE, TRUE); 254 + $relatorio->novalinha(array(sprintf('Nome Escola: %s Ano: %d', $nm_escola, $this->ano)),
  255 + 0, 12, TRUE, 'arial', FALSE, '#000000', '#d3d3d3', '#FFFFFF', FALSE, TRUE);
250 256
251 - $relatorio->novalinha(array('Matrícula', 'Nome Aluno', 'Disciplinas', 'Pontos', 'Nota 5º Av. Passar'),  
252 - 0, 12, TRUE, 'arial', array(50, 200, 150, 50), '#515151', '#d3d3d3', '#FFFFFF', FALSE, TRUE); 257 + $relatorio->novalinha(array(sprintf('Curso: %s Ano/Série: %s Turma: %s Date: %s', $nm_curso, $nm_serie, $nm_turma, date('d/m/Y'))),
  258 + 0, 12, TRUE, 'arial', FALSE, '#000000', '#d3d3d3', '#FFFFFF', FALSE, TRUE);
253 259
254 - while ($db->ProximoRegistro()) {  
255 - list($cod_matricula, $nome_aluno) = $db->Tupla(); 260 + $relatorio->novalinha(array('Matrícula', 'Nome Aluno', 'Disciplinas', 'Pontos', 'Nota 5º Av. Passar'),
  261 + 0, 12, TRUE, 'arial', array(50, 200, 150, 50), '#515151', '#d3d3d3', '#FFFFFF', FALSE, TRUE);
256 262
257 - foreach ($lst_disciplinas as $disciplina) {  
258 - $obj_nota_aluno = new clsPmieducarNotaAluno();  
259 - $obj_nota_aluno->setOrderby('modulo ASC');  
260 - $lst_nota_aluno = $obj_nota_aluno->lista(NULL, NULL, NULL,  
261 - $this->ref_cod_serie, $this->ref_cod_escola, $disciplina['cod_disciplina'],  
262 - $cod_matricula, NULL, NULL, NULL, NULL, NULL, NULL, 1); 263 + while ($db->ProximoRegistro()) {
  264 + list($cod_matricula, $nome_aluno) = $db->Tupla();
263 265
264 - $aluno_notas = array();  
265 - $aluno_notas_normal = array(); 266 + foreach ($lst_disciplinas as $disciplina) {
  267 + $obj_nota_aluno = new clsPmieducarNotaAluno();
  268 + $obj_nota_aluno->setOrderby('modulo ASC');
  269 + $lst_nota_aluno = $obj_nota_aluno->lista(NULL, NULL, NULL,
  270 + $this->ref_cod_serie, $this->ref_cod_escola, $disciplina['cod_disciplina'],
  271 + $cod_matricula, NULL, NULL, NULL, NULL, NULL, NULL, 1);
266 272
267 - if (is_array($lst_nota_aluno)) {  
268 - $aluno_notas[$disciplina['cod_disciplina']] = 0; 273 + $aluno_notas = array();
  274 + $aluno_notas_normal = array();
269 275
270 - foreach ($lst_nota_aluno as $nota_aluno) {  
271 - $obj_avaliacao_valores = new clsPmieducarTipoAvaliacaoValores(  
272 - $nota_aluno['ref_ref_cod_tipo_avaliacao'], $nota_aluno['ref_sequencial']  
273 - ); 276 + if (is_array($lst_nota_aluno)) {
  277 + $aluno_notas[$disciplina['cod_disciplina']] = 0;
274 278
275 - $det_avaliacao_valores = $obj_avaliacao_valores->detalhe(); 279 + foreach ($lst_nota_aluno as $nota_aluno) {
  280 + $obj_avaliacao_valores = new clsPmieducarTipoAvaliacaoValores(
  281 + $nota_aluno['ref_ref_cod_tipo_avaliacao'], $nota_aluno['ref_sequencial']
  282 + );
276 283
277 - $aluno_notas[$disciplina['cod_disciplina']] += $det_avaliacao_valores['valor'];  
278 - } 284 + $det_avaliacao_valores = $obj_avaliacao_valores->detalhe();
279 285
280 - $aluno_notas_normal[$disciplina['cod_disciplina']] = $aluno_notas[$disciplina['cod_disciplina']]; 286 + $aluno_notas[$disciplina['cod_disciplina']] += $det_avaliacao_valores['valor'];
  287 + }
281 288
282 - $aluno_notas[$disciplina['cod_disciplina']] /= count($lst_nota_aluno); 289 + $aluno_notas_normal[$disciplina['cod_disciplina']] = $aluno_notas[$disciplina['cod_disciplina']];
283 290
284 - $aluno_notas[$disciplina['cod_disciplina']] = sprintf('%01.1f', $aluno_notas[$disciplina['cod_disciplina']]);  
285 - } 291 + $aluno_notas[$disciplina['cod_disciplina']] /= count($lst_nota_aluno);
  292 +
  293 + $aluno_notas[$disciplina['cod_disciplina']] = sprintf('%01.1f', $aluno_notas[$disciplina['cod_disciplina']]);
  294 + }
286 295
287 - if (is_array($aluno_notas)) {  
288 - foreach ($aluno_notas as $cod_disciplina => $media) {  
289 - if ($media < $this->media && $this->media_exame) {  
290 - // @todo WTF!??? Que diabos de nota fixa é essa?  
291 - // FÓRMULA: 30 - (SOMA DE PONTOS DOS 4 BIMESTRES) / 2.  
292 - // Ex: 30 - 23 / 2 = 3,5  
293 - $nota_necessaria_passar = (30 - $aluno_notas_normal[$cod_disciplina]) / 2;  
294 -  
295 - $data = array(  
296 - $cod_matricula,  
297 - $nome_aluno,  
298 - $disciplina['nm_disciplina'],  
299 - $aluno_notas_normal[$cod_disciplina],  
300 - $nota_necessaria_passar  
301 - );  
302 -  
303 - $relatorio->novalinha($data, 0, 12, FALSE, 'arial',  
304 - array(50, 200, 150, 50), '#515151', '#d3d3d3', '#FFFFFF', FALSE, TRUE);  
305 - } 296 + if (is_array($aluno_notas)) {
  297 + foreach ($aluno_notas as $cod_disciplina => $media) {
  298 + if ($media < $this->media && $this->media_exame) {
  299 + // @todo WTF!??? Que diabos de nota fixa é essa?
  300 + // FÓRMULA: 30 - (SOMA DE PONTOS DOS 4 BIMESTRES) / 2.
  301 + // Ex: 30 - 23 / 2 = 3,5
  302 + $nota_necessaria_passar = (30 - $aluno_notas_normal[$cod_disciplina]) / 2;
  303 +
  304 + $data = array(
  305 + $cod_matricula,
  306 + $nome_aluno,
  307 + $disciplina['nm_disciplina'],
  308 + $aluno_notas_normal[$cod_disciplina],
  309 + $nota_necessaria_passar
  310 + );
  311 +
  312 + $relatorio->novalinha($data, 0, 12, FALSE, 'arial',
  313 + array(50, 200, 150, 50), '#515151', '#d3d3d3', '#FFFFFF', FALSE, TRUE);
306 } 314 }
307 } 315 }
308 } 316 }
309 } 317 }
  318 + }
310 319
311 - $this->get_link = $relatorio->fechaPdf(); 320 + $this->get_link = $relatorio->fechaPdf();
312 321
313 - echo sprintf('  
314 - <script>  
315 - window.onload=function()  
316 - {  
317 - parent.EscondeDiv("LoadImprimir");  
318 - window.location="download.php?filename=%s"  
319 - }  
320 - </script>', $this->get_link);  
321 -  
322 - echo sprintf('  
323 - <html>  
324 - <center>  
325 - Se o download não iniciar automaticamente <br>  
326 - <a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br><br>  
327 - <span style="font-size: 10px;">  
328 - Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>  
329 - Clique na Imagem para Baixar o instalador<br><br>  
330 - <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>  
331 - </span>  
332 - </center>  
333 - </html>', $this->get_link);  
334 - }  
335 - else {  
336 - echo '<script>window.onload=function(){parent.EscondeDiv("LoadImprimir");}</script>';  
337 - echo 'Nenhum aluno está em exame';  
338 - } 322 + echo sprintf('
  323 + <script>
  324 + window.onload=function()
  325 + {
  326 + parent.EscondeDiv("LoadImprimir");
  327 + window.location="download.php?filename=%s"
  328 + }
  329 + </script>', $this->get_link);
  330 +
  331 + echo sprintf('
  332 + <html>
  333 + <center>
  334 + Se o download não iniciar automaticamente <br>
  335 + <a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br><br>
  336 + <span style="font-size: 10px;">
  337 + Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
  338 + Clique na Imagem para Baixar o instalador<br><br>
  339 + <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>
  340 + </span>
  341 + </center>
  342 + </html>', $this->get_link);
  343 + }
  344 + else {
  345 + echo '
  346 + <script>
  347 + window.onload=function()
  348 + {
  349 + parent.EscondeDiv("LoadImprimir");
  350 + }
  351 + </script>';
  352 +
  353 + echo 'Nenhum aluno está em exame';
339 } 354 }
340 } 355 }
341 356