Commit 7343cfda029721cc395d1cee873715425c7e3221

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

Atualizado relatório '''Espelho de Nota Bimestral''' para usar {{{Avaliacao_Serv…

…ice_Boletim}}} e classes dos módulos ComponenteCurricular e RegraAvaliacao
ieducar/intranet/educar_relatorio_alunos_nota_semestre_disc.php
@@ -397,10 +397,13 @@ function getModulos_XML(xml) @@ -397,10 +397,13 @@ function getModulos_XML(xml)
397 var campoAno = document.getElementById('ano').value; 397 var campoAno = document.getElementById('ano').value;
398 398
399 campoModulo.length = 1; 399 campoModulo.length = 1;
400 - campoModulo.options[0] = new Option('Selecione um módulo', '', false, false); 400 + campoModulo.options[0] = new Option('Selecione um Módulo', '', false, false);
401 401
402 for (var j = 0; j < modulos.length; j++) { 402 for (var j = 0; j < modulos.length; j++) {
403 - campoModulo.options[campoModulo.options.length] = new Option( modulos[j].firstChild.nodeValue, modulos[j].getAttribute('cod_modulo') + "-" +modulos[j].getAttribute('sequencial') , false, false ); 403 + campoModulo.options[campoModulo.options.length] = new Option(
  404 + modulos[j].firstChild.nodeValue, modulos[j].getAttribute('cod_modulo') + "-" + modulos[j].getAttribute('sequencial'),
  405 + false, false
  406 + );
404 } 407 }
405 408
406 if (campoModulo.length == 1) { 409 if (campoModulo.length == 1) {
ieducar/intranet/educar_relatorio_alunos_nota_semestre_disc_proc.php
@@ -34,6 +34,9 @@ require_once &#39;include/clsBanco.inc.php&#39;; @@ -34,6 +34,9 @@ require_once &#39;include/clsBanco.inc.php&#39;;
34 require_once 'include/pmieducar/geral.inc.php' ; 34 require_once 'include/pmieducar/geral.inc.php' ;
35 require_once 'include/relatorio.inc.php'; 35 require_once 'include/relatorio.inc.php';
36 36
  37 +require_once 'Avaliacao/Service/Boletim.php';
  38 +require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php';
  39 +
37 /** 40 /**
38 * clsIndexBase class. 41 * clsIndexBase class.
39 * 42 *
@@ -69,6 +72,8 @@ class indice extends clsCadastro @@ -69,6 +72,8 @@ class indice extends clsCadastro
69 { 72 {
70 var $pessoa_logada; 73 var $pessoa_logada;
71 74
  75 + var $regra = NULL;
  76 +
72 var $ref_cod_instituicao; 77 var $ref_cod_instituicao;
73 var $ref_cod_escola; 78 var $ref_cod_escola;
74 var $ref_cod_serie; 79 var $ref_cod_serie;
@@ -76,6 +81,8 @@ class indice extends clsCadastro @@ -76,6 +81,8 @@ class indice extends clsCadastro
76 var $ref_cod_curso; 81 var $ref_cod_curso;
77 var $ref_cod_modulo; 82 var $ref_cod_modulo;
78 83
  84 + var $tipo;
  85 +
79 var $ano; 86 var $ano;
80 87
81 var $is_padrao; 88 var $is_padrao;
@@ -138,6 +145,10 @@ class indice extends clsCadastro @@ -138,6 +145,10 @@ class indice extends clsCadastro
138 $det = $obj_pessoa->detalhe(); 145 $det = $obj_pessoa->detalhe();
139 $this->nm_professor = $det['nome']; 146 $this->nm_professor = $det['nome'];
140 147
  148 + //
  149 + $regraMapper = new RegraAvaliacao_Model_RegraDataMapper();
  150 + $this->regra = $regraMapper->find($det_serie['regra_avaliacao_id']);
  151 +
141 if (!$lista_calendario) { 152 if (!$lista_calendario) {
142 echo '<script> 153 echo '<script>
143 alert("Escola não possui calendário definido para este ano"); 154 alert("Escola não possui calendário definido para este ano");
@@ -156,15 +167,12 @@ class indice extends clsCadastro @@ -156,15 +167,12 @@ class indice extends clsCadastro
156 $det_curso = $obj_curso->detalhe(); 167 $det_curso = $obj_curso->detalhe();
157 $this->nm_curso = $det_curso['nm_curso']; 168 $this->nm_curso = $det_curso['nm_curso'];
158 169
159 - $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso['ref_cod_tipo_avaliacao']);  
160 - $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();  
161 - $conceitual = $det_tipo_avaliacao['conceitual'];  
162 -  
163 // @todo Ano 2007 porque? Remover 170 // @todo Ano 2007 porque? Remover
164 if ($this->is_padrao || $this->ano == 2007) { 171 if ($this->is_padrao || $this->ano == 2007) {
165 $this->semestre = NULL; 172 $this->semestre = NULL;
166 } 173 }
167 174
  175 + // Seleciona os alunos da turma
168 $obj_matricula_turma = new clsPmieducarMatriculaTurma(); 176 $obj_matricula_turma = new clsPmieducarMatriculaTurma();
169 $obj_matricula_turma->setOrderby('nome_ascii'); 177 $obj_matricula_turma->setOrderby('nome_ascii');
170 $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, 178 $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula,
@@ -173,38 +181,47 @@ class indice extends clsCadastro @@ -173,38 +181,47 @@ class indice extends clsCadastro
173 $this->ref_cod_instituicao, NULL, NULL, array(1, 2, 3), NULL, NULL, 181 $this->ref_cod_instituicao, NULL, NULL, array(1, 2, 3), NULL, NULL,
174 $this->ano, NULL, NULL, NULL, NULL, TRUE, NULL, NULL, TRUE, NULL, $this->semestre); 182 $this->ano, NULL, NULL, NULL, NULL, TRUE, NULL, NULL, TRUE, NULL, $this->semestre);
175 183
176 - $obj_disciplinas = new clsPmieducarEscolaSerieDisciplina();  
177 - $lst_disciplinas = $obj_disciplinas->lista($this->ref_cod_serie,  
178 - $this->ref_cod_escola, NULL, 1); 184 + $array_disc = $array_cab = array();
  185 + if ($this->regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) {
  186 + $array_disc = $array_cab = array("FALTAS");
  187 + }
  188 + else {
  189 + $obj_disciplinas = new clsPmieducarEscolaSerieDisciplina();
  190 + $lst_disciplinas = $obj_disciplinas->lista($this->ref_cod_serie,
  191 + $this->ref_cod_escola, NULL, 1);
  192 + }
  193 +
  194 + if ($lst_matricula_turma) {
  195 + $relatorio = new relatorios(
  196 + "Espelho de Notas Bimestral {$this->ref_cod_modulo}º Bimestre Ano {$this->ano}",
  197 + 210, FALSE, "Espelho de Notas Bimestral", "A4",
  198 + "{$this->nm_instituicao}\n{$this->nm_escola}\n{$this->nm_curso}\n{$this->nm_serie} - Turma: $this->nm_turma ".date("d/m/Y")
  199 + );
179 200
180 - if($lst_matricula_turma) {  
181 - $relatorio = new relatorios("Espelho de Notas Bimestral {$this->ref_cod_modulo}º Bimestre Ano {$this->ano}", 210, false, "Espelho de Notas Bimestral", "A4", "{$this->nm_instituicao}\n{$this->nm_escola}\n{$this->nm_curso}\n{$this->nm_serie} - Turma: $this->nm_turma ".date("d/m/Y"));  
182 $relatorio->setMargem(20, 20, 50, 50); 201 $relatorio->setMargem(20, 20, 50, 50);
183 $relatorio->exibe_produzido_por = FALSE; 202 $relatorio->exibe_produzido_por = FALSE;
184 203
185 - $db = new clsBanco(); 204 + // Componente
  205 + $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper();
186 206
187 - foreach ($lst_disciplinas as $disciplina) {  
188 - $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);  
189 - $det_disciplina = $obj_disciplina->detalhe(); 207 + if (0 == count($array_disc)) {
  208 + foreach ($lst_disciplinas as $disciplina) {
  209 + $componente = $componenteMapper->find($disciplina['ref_cod_disciplina']);
190 210
191 - $array_disc[$det_disciplina['cod_disciplina']] = ($det_disciplina['abreviatura']);  
192 - $array_cab[] = str2upper($det_disciplina['abreviatura']); 211 + $array_disc[$componente->id] = $componente;
  212 + $array_cab[] = str2upper($componente->abreviatura);
  213 + }
  214 +
  215 + asort($array_disc);
  216 + sort($array_cab);
193 } 217 }
194 218
195 - asort($array_disc);  
196 - sort($array_cab);  
197 - $array_cab = array_merge(array( "Cód.", "Nome do Aluno" ),$array_cab); 219 + $array_cab = array_merge(array('Cód.', 'Nome do Aluno'), $array_cab);
198 220
199 $divisoes = array(40, 165); 221 $divisoes = array(40, 165);
200 $divisoes_texto = array(40, 165); 222 $divisoes_texto = array(40, 165);
201 223
202 - if (!$conceitual) {  
203 - $tamanho_divisao = 32 + (10 - count($array_disc)) * 5;  
204 - }  
205 - else {  
206 - $tamanho_divisao = 23 + (15 - count($array_disc)) * 5;  
207 - } 224 + $tamanho_divisao = 32 + (10 - count($array_disc)) * 5;
208 225
209 for ($ct = 0; $ct < 20; $ct++) { 226 for ($ct = 0; $ct < 20; $ct++) {
210 $divisoes[] = $tamanho_divisao; 227 $divisoes[] = $tamanho_divisao;
@@ -212,60 +229,29 @@ class indice extends clsCadastro @@ -212,60 +229,29 @@ class indice extends clsCadastro
212 } 229 }
213 230
214 $relatorio->novalinha($array_cab, 0, 16, TRUE, 'arial', $divisoes, 231 $relatorio->novalinha($array_cab, 0, 16, TRUE, 'arial', $divisoes,
215 - '#515151', '#d3d3d3', '#FFFFFF', FALSE, TRUE); 232 + '#515151', '#D3D3D3', '#FFFFFF', FALSE, TRUE);
216 233
217 - if(!$conceitual) {  
218 - $campo_nota = 'COALESCE(nota, valor) ';  
219 - }  
220 - else {  
221 - $campo_nota = 'nome ';  
222 - } 234 + foreach ($lst_matricula_turma as $matricula) {
  235 + $boletim = new Avaliacao_Service_Boletim(array(
  236 + 'matricula' => $matricula['ref_cod_matricula'],
  237 + 'ComponenteDataMapper' => $componenteMapper,
  238 + 'RegraDataMapper' => $regraMapper
  239 + ));
223 240
224 - if ($conceitual) {  
225 - $tam_fonte = 8;  
226 - $tam_linha = 11;  
227 - }  
228 - else {  
229 $tam_fonte = NULL; 241 $tam_fonte = NULL;
230 $tam_linha = 16; 242 $tam_linha = 16;
231 - }  
232 243
233 - foreach ($lst_matricula_turma as $matricula) {  
234 - $consulta = sprintf("  
235 - SELECT  
236 - ref_cod_disciplina,  
237 - %s AS nota,  
238 - modulo  
239 - FROM  
240 - pmieducar.nota_aluno  
241 - LEFT OUTER JOIN  
242 - pmieducar.tipo_avaliacao_valores  
243 - ON (  
244 - ref_ref_cod_tipo_avaliacao = ref_cod_tipo_avaliacao  
245 - AND ref_sequencial = sequencial  
246 - )  
247 - WHERE  
248 - ref_cod_matricula = %d  
249 - AND ref_cod_escola = %d  
250 - AND ref_cod_serie = %d  
251 - AND modulo = %d  
252 - AND nota_aluno.ativo = 1  
253 - GROUP BY  
254 - ref_cod_disciplina,  
255 - modulo,  
256 - %s  
257 - ORDER BY  
258 - ref_cod_disciplina ASC", $campo_nota, $matricula['ref_cod_matricula'],  
259 - $this->ref_cod_escola, $this->ref_cod_serie, $this->ref_cod_modulo,  
260 - $campo_nota);  
261 -  
262 - $db->Consulta($consulta);  
263 -  
264 - unset($notas);  
265 -  
266 - while ($db->ProximoRegistro()) {  
267 - $registro = $db->Tupla();  
268 - $notas[$registro['ref_cod_disciplina']] = $registro['nota']; 244 + $componentes = $boletim->getComponentes();
  245 +
  246 + foreach ($array_disc as $cid => $componente) {
  247 + if (!in_array($cid, array_keys($componentes))) {
  248 + $notas[$cid] = 'D';
  249 + $faltas[$cid] = 'D';
  250 + continue;
  251 + }
  252 +
  253 + $notas[$cid] = $boletim->getNotaComponente($cid, $this->ref_cod_modulo);
  254 + $faltas[$cid] = $boletim->getFalta($this->ref_cod_modulo, $cid);
269 } 255 }
270 256
271 // @todo WTF?! 257 // @todo WTF?!
@@ -292,13 +278,12 @@ class indice extends clsCadastro @@ -292,13 +278,12 @@ class indice extends clsCadastro
292 $array_val[] = $matricula['ref_cod_aluno']; 278 $array_val[] = $matricula['ref_cod_aluno'];
293 $array_val[] = $matricula['nome']; 279 $array_val[] = $matricula['nome'];
294 280
295 - foreach ($array_disc as $cod_disc => $disc) {  
296 - if (!$conceitual) {  
297 - $array_val[] = $notas[$cod_disc] ?  
298 - number_format($notas[$cod_disc], 2, '.', '') : $notas[$cod_disc]; 281 + foreach ($array_disc as $cid => $disc) {
  282 + if ($this->tipo == 'n') {
  283 + $array_val[] = $notas[$cid]->notaArredondada;
299 } 284 }
300 else { 285 else {
301 - $array_val[] = $notas[$cod_disc]; 286 + $array_val[] = $faltas[$cid]->quantidade;
302 } 287 }
303 } 288 }
304 289