Commit d5f5a29ba063a30c4192bf3466d31d6c634ea301

Authored by Eriksen Costa
1 parent 2e321ee7
Exists in master

Atualizado relatório "Espelho de notas bimestral" para buscar os componentes atr…

…avés da API de {{{App_Model_IedFinder}}}
ieducar/intranet/educar_relatorio_alunos_nota_semestre_disc_proc.php
... ... @@ -31,11 +31,11 @@
31 31 require_once 'include/clsBase.inc.php';
32 32 require_once 'include/clsCadastro.inc.php';
33 33 require_once 'include/clsBanco.inc.php';
34   -require_once 'include/pmieducar/geral.inc.php' ;
  34 +require_once 'include/pmieducar/geral.inc.php';
35 35 require_once 'include/relatorio.inc.php';
36 36  
  37 +require_once 'App/Model/IedFinder.php';
37 38 require_once 'Avaliacao/Service/Boletim.php';
38   -require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php';
39 39  
40 40 /**
41 41 * clsIndexBase class.
... ... @@ -119,7 +119,7 @@ class indice extends clsCadastro
119 119 return TRUE;
120 120 }
121 121  
122   - if($this->ref_cod_escola) {
  122 + if ($this->ref_cod_escola) {
123 123 $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
124 124 $det_escola = $obj_escola->detalhe();
125 125 $this->nm_escola = $det_escola['nome'];
... ... @@ -167,11 +167,6 @@ class indice extends clsCadastro
167 167 $det_curso = $obj_curso->detalhe();
168 168 $this->nm_curso = $det_curso['nm_curso'];
169 169  
170   - // @todo Ano 2007 porque? Remover
171   - if ($this->is_padrao || $this->ano == 2007) {
172   - $this->semestre = NULL;
173   - }
174   -
175 170 // Seleciona os alunos da turma
176 171 $obj_matricula_turma = new clsPmieducarMatriculaTurma();
177 172 $obj_matricula_turma->setOrderby('nome_ascii');
... ... @@ -181,33 +176,41 @@ class indice extends clsCadastro
181 176 $this->ref_cod_instituicao, NULL, NULL, array(1, 2, 3), NULL, NULL,
182 177 $this->ano, NULL, NULL, NULL, NULL, TRUE, NULL, NULL, TRUE, NULL, $this->semestre);
183 178  
184   - $array_disc = $array_cab = array();
185   - if ($this->regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) {
  179 + $componentes = $array_disc = $array_cab = array();
  180 + if ('f' == $this->tipo && $this->regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) {
186 181 $array_disc = $array_cab = array("FALTAS");
187 182 }
188 183 else {
189   - $obj_disciplinas = new clsPmieducarEscolaSerieDisciplina();
190   - $lst_disciplinas = $obj_disciplinas->lista($this->ref_cod_serie,
191   - $this->ref_cod_escola, NULL, 1);
  184 + try {
  185 + $componentes = App_Model_IedFinder::getComponentesTurma(
  186 + $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_turma
  187 + );
  188 + }
  189 + catch (App_Model_Exception $e) {
  190 + }
192 191 }
193 192  
194 193 if ($lst_matricula_turma) {
  194 + $titulo = sprintf(
  195 + 'Espelho de Notas Bimestral %dº Bimestre Ano %d',
  196 + $this->ref_cod_modulo, $this->ano
  197 + );
  198 +
  199 + $subtitulo = sprintf(
  200 + "%s\n%s\n%s\n%s - Turma: %s %s",
  201 + $this->nm_instituicao, $this->nm_escola, $this->nm_curso,
  202 + $this->nm_serie, $this->nm_turma, date('d/m/Y')
  203 + );
  204 +
195 205 $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")
  206 + $titulo, 210, FALSE, 'Espelho de Notas Bimestral', 'A4', $subtitulo
199 207 );
200 208  
201 209 $relatorio->setMargem(20, 20, 50, 50);
202 210 $relatorio->exibe_produzido_por = FALSE;
203 211  
204   - // Componente
205   - $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper();
206   -
207   - if (0 == count($array_disc)) {
208   - foreach ($lst_disciplinas as $disciplina) {
209   - $componente = $componenteMapper->find($disciplina['ref_cod_disciplina']);
210   -
  212 + if (0 == count($array_disc) && 0 < count($componentes)) {
  213 + foreach ($componentes as $componente) {
211 214 $array_disc[$componente->id] = $componente;
212 215 $array_cab[] = str2upper($componente->abreviatura);
213 216 }
... ... @@ -234,7 +237,6 @@ class indice extends clsCadastro
234 237 foreach ($lst_matricula_turma as $matricula) {
235 238 $boletim = new Avaliacao_Service_Boletim(array(
236 239 'matricula' => $matricula['ref_cod_matricula'],
237   - 'ComponenteDataMapper' => $componenteMapper,
238 240 'RegraDataMapper' => $regraMapper
239 241 ));
240 242  
... ... @@ -244,6 +246,12 @@ class indice extends clsCadastro
244 246 $componentes = $boletim->getComponentes();
245 247  
246 248 foreach ($array_disc as $cid => $componente) {
  249 + // Presença geral, seleciona apenas a quantidade de faltas da etapa
  250 + if (0 == $cid) {
  251 + $faltas[$cid] = $boletim->getFalta($this->ref_cod_modulo);
  252 + break;
  253 + }
  254 +
247 255 if (!in_array($cid, array_keys($componentes))) {
248 256 $notas[$cid] = 'D';
249 257 $faltas[$cid] = 'D';
... ...