/** * @see clsCadastro#Gerar() */ public function Gerar() { $this->campoOculto('matricula', $this->_matricula); $this->campoOculto('componenteCurricular', $this->_componenteCurricular); $this->campoOculto('etapa', $this->_etapa); $matricula = $this->_service->getOption('matriculaData'); $this->campoRotulo('1nome', 'Nome', $matricula['nome']); $this->campoRotulo('2curso', 'Curso', $matricula['curso_nome']); $this->campoRotulo('3serie', 'Série', $matricula['serie_nome']); $this->campoRotulo('4turma', 'Turma', $matricula['turma_nome']); $this->campoRotulo('5etapa', 'Etapa', $this->_etapa == 'Rc' ? 'Exame' : $this->_etapa); $componentes = $this->_service->getComponentes(); $this->campoRotulo('6componente_curricular', 'Componente curricular', $componentes[$this->getRequest()->componenteCurricular]); // Valores de arredondamento $valoresArredondamento = $this->_service->getRegra()->tabelaArredondamento->findTabelaValor(); $valores = array(); foreach ($valoresArredondamento as $valor) { if ($this->_service->getRegra()->get('tipoNota') == RegraAvaliacao_Model_Nota_TipoValor::NUMERICA) { $valores[(string) $valor->nome] = $valor->nome; } else { $valores[(string) $valor->valorMaximo] = $valor->nome . ' (' . $valor->descricao . ')'; } } $this->campoLista('nota', 'Nota', $valores, urldecode($this->_nota->nota)); // Caso a falta seja calculada por componente if ($this->_regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { $this->campoLista('falta', 'Falta', range(0, 100, 1), $this->_falta->quantidade); } // Caso o parecer seja por etapa e por componente if ($this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE) { $this->campoMemo('parecer', 'Parecer', $this->_parecer, 40, 10, false); } }
protected function getComponentesCurriculares() { if (!isset($this->_componentesCurriculares)) { $this->_componentesCurriculares = $this->_service->getComponentes(); } return $this->_componentesCurriculares; }
/** * @see clsCadastro#Gerar() */ public function Gerar() { $this->campoOculto('matricula', $this->_matricula); $this->campoOculto('etapa', $this->_etapa); $this->campoOculto('componenteCurricular', $this->_componenteCurricular); $matricula = $this->_service->getOption('matriculaData'); $this->campoRotulo('1nome', 'Nome', $matricula['nome']); $this->campoRotulo('2curso', 'Curso', $matricula['curso_nome']); $this->campoRotulo('3serie', 'Série', $matricula['serie_nome']); $this->campoRotulo('4turma', 'Turma', $matricula['turma_nome']); if ($this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_GERAL) { $this->campoRotulo('5etapa', 'Etapa', $this->_etapa == 'Rc' ? 'Recuperação' : $this->_etapa); } else { $this->campoRotulo('5etapa', 'Etapa', 'Anual'); } if ($this->_componenteCurricular) { $componentes = $this->_service->getComponentes(); $this->campoRotulo('6componente_curricular', 'Componente curricular', $componentes[$this->_componenteCurricular]); } $this->campoMemo('parecer', 'Parecer', $this->_parecer, 40, 10, TRUE); }
/** * @see clsCadastro#Gerar() */ public function Gerar() { $this->campoOculto('matricula', $this->_matricula); $this->campoOculto('etapa', $this->_etapa); $this->campoOculto('componenteCurricular', $this->_componenteCurricular); $matricula = $this->_service->getOption('matriculaData'); if (!isset($this->_etapa)) { $this->_etapa = 1; } $this->campoRotulo('1nome', 'Nome', $matricula['nome']); $this->campoRotulo('2curso', 'Curso', $matricula['curso_nome']); $this->campoRotulo('3serie', 'Série', $matricula['serie_nome']); $this->campoRotulo('4turma', 'Turma', $matricula['turma_nome']); $this->campoRotulo('5etapa', 'Etapa', $this->_etapa == 'Rc' ? 'Recuperação' : $this->_etapa); if ($this->_regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { $componentes = $this->_service->getComponentes(); $this->campoRotulo('6componente_curricular', 'Componente curricular', $componentes[$this->getRequest()->componenteCurricular]); } $this->campoLista('falta', 'Falta', range(0, 100, 1), $this->_falta->quantidade); // Caso o parecer seja por etapa e por componente if ($this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE) { $this->campoMemo('parecer', 'Parecer', $this->_parecer, 40, 10, TRUE); } }
protected function _notasFaltasComponentes(Avaliacao_Service_Boletim $boletim) { $etapas = $boletim->getOption('etapas'); $notas = $boletim->getNotasComponentes(); if ($faltaPorComponente = $boletim->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { $faltas = $boletim->getFaltasComponentes(); } else { $faltas = $boletim->getFaltasGerais(); } $componentes = $boletim->getComponentes(); $medias = $boletim->getMediasComponentes(); $situacao = $boletim->getSituacaoAluno(); $etapas = range(0, $etapas - 1); $altura_linha = 15; // Calcula o espaço disponível para as notas e faltas $extraColumns = 2 + ($situacao->recuperacao == TRUE ? 1 : 0); $total = 782 - (80 + 60 * $extraColumns + 120); $this->pdf->quadrado_relativo(30, $this->page_y, 782, $altura_linha, 0.5); $this->pdf->escreve_relativo_center('Módulos', 30, $this->page_y + 2, 80, 13); $this->pdf->linha_relativa(30, $this->page_y, 0, $altura_linha, 0.1); $this->pdf->linha_relativa(80 + 30, $this->page_y, 0, $altura_linha, 0.1); $matriculaSituacao = App_Model_MatriculaSituacao::getInstance(); // Escreve as etapas $x = 80 + 30; $largura = $total / count($etapas); if ($faltaPorComponente) { $larguraDv = $largura / 2; } else { $larguraDv = $largura; } foreach ($etapas as $etapa) { $this->pdf->escreve_relativo_center($etapa + 1, $x, $this->page_y + 2, $largura, 13); $x += $largura; $this->pdf->linha_relativa($x, $this->page_y, 0, $altura_linha, 0.1); } // Escreve os campos para Média final, Falta e Situação $labels = array(); $labels[] = 'Média final'; if ($situacao->recuperacao) { $labels[] = 'Exame'; } $labels[] = '% Presença'; $labels[] = 'Situação'; foreach ($labels as $label) { $largura = $label == 'Situação' ? 120 : 60; $this->pdf->escreve_relativo_center($label, $x, $this->page_y + 2, $largura, 13); $x += $largura; $this->pdf->linha_relativa($x, $this->page_y, 0, $altura_linha, 0.1); } // Escreve os rótulos para notas e faltas $x = 80 + 30; // Nova linha $this->page_y += 15; $this->pdf->quadrado_relativo(30, $this->page_y, 782, $altura_linha, 0.5); $this->pdf->escreve_relativo_center('Componentes', 30, $this->page_y + 2, 80, 13); $this->pdf->linha_relativa(30, $this->page_y, 0, $altura_linha, 0.1); $this->pdf->linha_relativa(110, $this->page_y, 0, $altura_linha, 0.1); foreach ($etapas as $etapa) { $this->pdf->escreve_relativo_center('Nota', $x, $this->page_y + 2, $larguraDv, 13); $x += $larguraDv; $this->pdf->linha_relativa($x, $this->page_y, 0, $altura_linha, 0.1); if ($faltaPorComponente) { $this->pdf->escreve_relativo_center('Falta', $x, $this->page_y + 2, $larguraDv, 13); $x += $larguraDv; $this->pdf->linha_relativa($x, $this->page_y, 0, $altura_linha, 0.1); } } for ($i = 0; $i < 3; $i++) { $x += 60; $this->pdf->linha_relativa($x, $this->page_y, 0, $altura_linha, 0.1); } $yNotas = $this->page_y; // Imprime as notas dos componentes foreach ($componentes as $id => $componente) { $this->page_y += 15; $this->pdf->quadrado_relativo(30, $this->page_y, 782, $altura_linha, 0.5); $this->pdf->escreve_relativo_center($componente, 30, $this->page_y + 2, 80, 13); $this->pdf->linha_relativa(110, $this->page_y, 0, $altura_linha, 0.1); $x = 110; foreach ($etapas as $etapa) { if (!$this->em_branco) { $this->pdf->escreve_relativo_center($notas[$id][$etapa]->notaArredondada, $x, $this->page_y + 2, $larguraDv, 13); } $x += $larguraDv; $this->pdf->linha_relativa($x, $this->page_y, 0, $altura_linha, 0.1); if ($faltaPorComponente) { if (!$this->em_branco) { $this->pdf->escreve_relativo_center($faltas[$id][$etapa]->quantidade, $x, $this->page_y + 2, $larguraDv, 13); } $x += $larguraDv; $this->pdf->linha_relativa($x, $this->page_y, 0, $altura_linha, 0.1); } } if ($faltaPorComponente) { $porcentagemPresenca = sprintf('%.2f', $situacao->falta->componentesCurriculares[$id]->porcentagemPresenca); } else { $porcentagemPresenca = '-'; } // Média, presenção e situação $data = array(); $data['media'] = $medias[$id][0]->mediaArredondada; if ($situacao->recuperacao) { $notaExame = $notas[$id][$etapa + 1]; $data['rc'] = $notaExame->etapa == 'Rc' ? $notaExame->notaArredondada : '-'; } $data['presenca'] = $porcentagemPresenca; $data['situacao'] = $matriculaSituacao->getValue($situacao->nota->componentesCurriculares[$id]->situacao); foreach ($data as $key => $value) { $largura = $key == 'situacao' ? 120 : 60; if (!$this->em_branco) { $this->pdf->escreve_relativo_center($value, $x, $this->page_y + 2, $largura, 13); } $x += $largura; $this->pdf->linha_relativa($x, $this->page_y, 0, $altura_linha, 0.1); } } // Imprime a porcentagem total de presença e a situação $this->page_y += 15; $this->pdf->quadrado_relativo(30, $this->page_y, 782, $altura_linha, 0.5); $this->pdf->escreve_relativo_center('Faltas', 30, $this->page_y + 2, 80, 13); $this->pdf->linha_relativa(110, $this->page_y, 0, $altura_linha, 0.1); if (!$faltaPorComponente) { $x = 80 + 30; foreach ($etapas as $etapa) { $this->pdf->escreve_relativo_center($faltas[$etapa + 1]->quantidade, $x, $this->page_y + 2, $larguraDv, 13); $x += $larguraDv; $this->pdf->linha_relativa($x, $this->page_y, 0, $altura_linha, 0.1); } $x = $x + 60 * ($situacao->recuperacao ? 2 : 1); } else { $x = $x - (120 + 60); } if (!$this->em_branco) { $this->pdf->escreve_relativo_center(sprintf('%.2f', $situacao->falta->porcentagemPresenca), $x, $this->page_y + 2, 60, 13); $this->pdf->escreve_relativo_center($matriculaSituacao->getValue($situacao->falta->situacao), $x + 60, $this->page_y + 2, 120, 13); } for ($i = 0; $i < 3; $i++) { $this->pdf->linha_relativa($x, $this->page_y, 0, $altura_linha, 0.1); $x += 60; } }
/** * @see clsCadastro#Gerar() */ public function Gerar() { // Dados da matrícula $matricula = $this->_service->getOption('matriculaData'); // Nome do aluno $nome = $matricula['nome']; // Nome da escola $escola = new clsPmieducarEscola($matricula['ref_ref_cod_escola']); $escola = $escola->detalhe(); $escola = ucwords(strtolower($escola['nome'])); // Nome do curso $curso = $matricula['curso_nome']; // Nome da série $serie = $matricula['serie_nome']; // Nome da turma $turma = $matricula['turma_nome']; // Situação da matrícula $situacao = App_Model_MatriculaSituacao::getInstance(); $situacao = $situacao->getValue($matricula['aprovado']); // Dados da matrícula $this->addDetalhe(array('Aluno', $nome)); $this->addDetalhe(array('Escola', $escola)); $this->addDetalhe(array('Curso', $curso)); $this->addDetalhe(array('Série/Turma', $serie . ' / ' . $turma)); $this->addDetalhe(array('Situação', $situacao)); // Booleano para saber se o tipo de nota é nenhum. $nenhumaNota = $this->_service->getRegra()->get('tipoNota') == RegraAvaliacao_Model_Nota_TipoValor::NENHUM; // Booleano para saber o tipo de presença em que ocorre apuração $porComponente = $this->_service->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE; // Dados da regra de avaliação $this->addDetalhe(array('Regra avaliação', $this->_service->getRegra())); $this->addDetalhe(array('Apuração de falta', $this->_service->getRegra()->tipoPresenca)); $this->addDetalhe(array('Parecer descritivo', $this->_service->getRegra()->parecerDescritivo)); $this->addDetalhe(array('Progressão', $this->_service->getRegra()->tipoProgressao)); if ($nenhumaNota) { $media = 'Não usa nota'; } else { $media = $this->_service->getRegra()->media; } $this->addDetalhe(array('Média', $media)); // Cria um array com a quantidade de etapas de 1 a n $etapas = range(1, $this->_service->getOption('etapas'), 1); // Atributos para a tabela $attributes = array('style' => 'background-color: #A1B3BD; padding: 5px; text-align: center'); // Atributos para a tabela de notas/faltas $zebra = array(0 => array('style' => 'background-color: #E4E9ED'), 1 => array('style' => 'background-color: #FFFFFF')); // Helper para criar links e urls $url = CoreExt_View_Helper_UrlHelper::getInstance(); // Usa helper de tabela para criar a tabela de notas/faltas $table = CoreExt_View_Helper_TableHelper::getInstance(); // Enum para situação de matrícula $situacao = App_Model_MatriculaSituacao::getInstance(); // Situação do boletim do aluno $sit = $this->_situacao; // Títulos da tabela $labels = array(); $labels[] = array('data' => 'Disciplinas', 'attributes' => $attributes); foreach ($etapas as $etapa) { $data = array('data' => sprintf('Etapa %d', $etapa)); if ($nenhumaNota) { $data['colspan'] = 1; } else { $data['colspan'] = $porComponente ? 2 : 1; } $data['attributes'] = $attributes; $labels[] = $data; } // Flag para auxiliar na composição da tabela em casos onde o parecer // descritivo é lançado anualmente e por componente $parecerComponenteAnual = FALSE; $colspan = 0; if ($this->_service->getRegra()->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE) { if (TRUE == $this->_componenteEncerrado($sit->nota->componentesCurriculares)) { $parecerComponenteAnual = TRUE; $colspan++; } } // Colspan para tabela com labels e sublabels $colspan += $porComponente && $sit->recuperacao ? 4 : 3; if ($nenhumaNota) { $colspan--; } if (!$nenhumaNota) { $labels[] = array('data' => $porComponente ? '' : 'Média', 'attributes' => $attributes, 'colspan' => $porComponente ? $colspan : 1); } // Inclui coluna para % de presença geral. if (!$porComponente) { if ($sit->recuperacao) { $labels[] = array('data' => 'Exame', 'attributes' => $attributes); } if ($parecerComponenteAnual) { $labels[] = array('data' => 'Parecer', 'attributes' => $attributes); } $labels[] = array('data' => 'Presença', 'attributes' => $attributes); $labels[] = array('data' => 'Situação', 'attributes' => $attributes); } $table->addHeaderRow($labels); // Cria sub-header caso tenha faltas lançadas por componentes if ($porComponente) { $subLabels = array(); $subLabels[] = array('attributes' => $attributes); for ($i = 0, $loop = count($etapas); $i < $loop; $i++) { if (!$nenhumaNota) { $subLabels[] = array('data' => 'Nota', 'attributes' => $attributes); } $subLabels[] = array('data' => 'Falta', 'attributes' => $attributes); } if (!$nenhumaNota) { $subLabels[] = array('data' => 'Média', 'attributes' => $attributes); } if ($sit->recuperacao) { $subLabels[] = array('data' => 'Exame', 'attributes' => $attributes); } if ($porComponente) { if ($parecerComponenteAnual) { $subLabels[] = array('data' => 'Parecer', 'attributes' => $attributes); } $subLabels[] = array('data' => 'Presença', 'attributes' => $attributes); $subLabels[] = array('data' => 'Situação', 'attributes' => $attributes); } $table->addHeaderRow($subLabels); } // Atributos usados pelos itens de dados $attributes = array('style' => 'padding: 5px; text-align: center'); // Notas $componentes = $this->_service->getComponentes(); $notasComponentes = $this->_service->getNotasComponentes(); $mediasSituacoes = $this->_situacao->nota; $mediasComponentes = $this->_service->getMediasComponentes(); $faltasComponentes = $this->_service->getFaltasComponentes(); // Calcula as porcentagens de presença $faltasStats = $this->_service->getSituacaoFaltas(); // Texto do link if ($nenhumaNota) { $linkText = 'falta'; $linkPath = 'falta'; } else { $linkText = $porComponente ? 'nota/falta' : 'nota'; $linkPath = 'nota'; } // Parâmetros para o link de nota/falta nova $newLink = array('text' => 'Lançar ' . $linkText, 'path' => $linkPath, 'query' => array('matricula' => $matricula['cod_matricula'], 'componenteCurricular' => 0)); $iteration = 0; foreach ($componentes as $id => $componente) { $data = array(); // Nome do componente curricular $data[] = array('data' => $componente, 'attributes' => array('style' => 'padding: 5px; text-align: left')); $notas = $notasComponentes[$id]; $mediaSituacao = $mediasSituacoes->componentesCurriculares[$id]; $medias = $mediasComponentes[$id]; $faltas = $faltasComponentes[$id]; $faltaStats = $faltasStats->componentesCurriculares[$id]; $parecer = NULL; // Caso os pareceres sejam por componente e anuais, recupera a instância if ($parecerComponenteAnual) { $parecer = $this->_service->getPareceresComponentes(); $parecer = $parecer[$id]; } if ($porComponente == TRUE) { $new = $url->l('Lançar nota', 'nota', array('query' => array('matricula' => $matricula['cod_matricula'], 'componenteCurricular' => $id))); } $newLink['query']['componenteCurricular'] = $id; $new = $url->l($newLink['text'], $newLink['path'], array('query' => $newLink['query'])); $update = array('query' => array('matricula' => $matricula['cod_matricula'], 'componenteCurricular' => $id, 'etapa' => 0)); // Lista as notas do componente por etapa for ($i = 0, $loop = count($etapas); $i < $loop; $i++) { $nota = $falta = NULL; if (isset($notas[$i])) { $update['query']['etapa'] = $notas[$i]->etapa; $nota = $url->l($notas[$i]->notaArredondada, 'nota', $update); } if (isset($faltas[$i])) { $update['query']['etapa'] = $faltas[$i]->etapa; $linkPath = $nenhumaNota ? 'falta' : 'nota'; $falta = $url->l($faltas[$i]->quantidade, $linkPath, $update); } /* * Exibição muito dinâmica. Em resumo, os casos são: * * 1. nota & falta componente * 2. nota * 3. falta componente * 4. falta geral */ if ($nenhumaNota) { $colspan = 1; } elseif (!$nenhumaNota && $porComponente && is_null($falta)) { $colspan = 2; } else { $colspan = 1; } // Caso 1. if (!$nenhumaNota) { if ($nota) { // Caso 2: resolvido com colspan. $data[] = array('data' => $nota, 'attributes' => $attributes, 'colspan' => $colspan); if ($porComponente) { $data[] = array('data' => $falta, 'attributes' => $attributes); } } else { $data[] = array('data' => $new, 'attributes' => $attributes, 'colspan' => $colspan); $new = ''; } } elseif ($nenhumaNota && $porComponente) { if ($falta) { $data[] = array('data' => $falta, 'attributes' => $attributes, 'colspan' => $colspan); } else { $data[] = array('data' => $new, 'attributes' => $attributes, 'colspan' => $colspan); $new = ''; } } else { $data[] = array('data' => '', 'attributes' => $attributes); } } // Média no componente curricular if (!$nenhumaNota) { $media = $medias[0]->mediaArredondada . ($medias[0]->etapa == 'Rc' ? ' (Rc)' : ''); $data[] = array('data' => $media, 'attributes' => $attributes); } // Adiciona uma coluna extra caso aluno esteja em exame em alguma componente curricular if ($sit->recuperacao) { if ($mediaSituacao->situacao == App_Model_MatriculaSituacao::EM_EXAME || $mediaSituacao->situacao == App_Model_MatriculaSituacao::APROVADO_APOS_EXAME || $mediaSituacao->situacao == App_Model_MatriculaSituacao::REPROVADO) { $link = $newLink; $link['query']['componenteCurricular'] = $id; $link['query']['etapa'] = 'Rc'; $notaRec = $i; if (isset($notas[$notaRec]) && $notas[$notaRec]->etapa == 'Rc') { $link['text'] = $notas[$notaRec]->notaArredondada; } $recuperacaoLink = $url->l($link['text'], $link['path'], array('query' => $link['query'])); $data[] = array('data' => $recuperacaoLink, 'attributes' => $attributes); } else { $data[] = array('data' => '', 'attributes' => $attributes); } } // Adiciona uma coluna extra caso o parecer seja por componente ao final do ano if ($parecerComponenteAnual) { $link = array('text' => '', 'path' => 'parecer', 'query' => array('matricula' => $this->getRequest()->matricula)); if (0 == count($parecer)) { $text = 'Lançar'; } else { $text = 'Editar'; } $link['query']['componenteCurricular'] = $id; // @todo Constante ou CoreExt_Enum $link['query']['etapa'] = 'An'; $link = $url->l($text, $link['path'], array('query' => $link['query'])); if (isset($mediaSituacao->situacao) && $mediaSituacao->situacao != App_Model_MatriculaSituacao::EM_ANDAMENTO) { $data[] = array('data' => $link, 'attributes' => $attributes); } else { $data[] = array('data' => '', 'attributes' => $attributes); } } // Informações extras como porcentagem de presença e situação do aluno if ($porComponente) { $data[] = array('data' => sprintf('%.2f%%', $faltaStats->porcentagemPresenca), 'attributes' => $attributes); } else { $data[] = array('data' => '', 'attributes' => $attributes); } $data[] = array('data' => $situacao->getValue($mediaSituacao->situacao), 'attributes' => $attributes); $iteration++; $class = $iteration % 2; $table->addBodyRow($data, $zebra[$class]); } $newLink = array('text' => 'Lançar falta', 'path' => 'falta', 'query' => array('matricula' => $matricula['cod_matricula'])); // Situação geral das faltas $data = array(0 => array('data' => 'Faltas', 'attributes' => array('style' => 'padding: 5px; text-align: left'))); $faltas = $this->_service->getFaltasGerais(); $new = $url->l($newLink['text'], $newLink['path'], array('query' => $newLink['query'])); // Listas faltas (para faltas no geral) for ($i = 1, $loop = count($etapas); $i <= $loop; $i++) { if (isset($faltas[$i])) { $link = $newLink; $link['query']['etapa'] = $faltas[$i]->etapa; $link = $porComponente ? '' : $url->l($faltas[$i]->quantidade, $link['path'], array('query' => $link['query'])); $data[] = array('data' => $link, 'attributes' => $attributes); if ($porComponente) { $data[] = array('data' => '', 'attributes' => $attributes); } } else { $new = $porComponente ? '' : $new; $data[] = array('data' => $new, 'attributes' => $attributes); $new = ''; if ($porComponente && !$nenhumaNota) { $data[] = array('data' => '', 'attributes' => $attributes); } } } if (!$nenhumaNota) { $data[] = array(); } if ($sit->recuperacao) { $data[] = array('data' => '', 'attributes' => $attributes); } if ($parecerComponenteAnual) { $data[] = array('data' => '', 'attributes' => $attributes); } // Porcentagem presença $data[] = array('data' => sprintf('%.2f%%', $faltasStats->porcentagemPresenca), 'attributes' => $attributes); $data[] = array('data' => $situacao->getValue($sit->falta->situacao), 'attributes' => $attributes); $table->addFooterRow($data, $zebra[$class ^ 1]); // Adiciona linha com links para lançamento de parecer descritivo geral por etapa if ($this->_service->getRegra()->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_GERAL) { $newLink = array('text' => 'Lançar parecer', 'path' => 'parecer', 'query' => array('matricula' => $matricula['cod_matricula'])); $data = array(0 => array('data' => 'Pareceres', 'attributes' => array('style' => 'padding: 5px; text-align: left'))); $pareceres = $this->_service->getPareceresGerais(); for ($i = 1, $loop = count($etapas); $i <= $loop; $i++) { if (isset($pareceres[$i])) { $link = $newLink; $link['text'] = 'Editar parecer'; $link['query']['etapa'] = $i; $data[] = array('data' => $url->l($link['text'], $link['path'], array('query' => $link['query'])), 'attributes' => $attributes); } else { if ('' == $newLink) { $link = ''; } else { $link = $url->l($newLink['text'], $newLink['path'], array('query' => $newLink['query'])); } $data[] = array('data' => $link, 'attributes' => $attributes); $newLink = ''; } } if ($sit->recuperacao) { $data[] = array('data' => '', 'attributes' => $attributes); } $data[] = array('data' => '', 'attributes' => $attributes); $data[] = array('data' => '', 'attributes' => $attributes); $table->addFooterRow($data); } // Adiciona tabela na página $this->addDetalhe(array('Disciplinas', '<div id="disciplinas">' . $table . '</div>')); // Adiciona link para lançamento de parecer descritivo anual geral if (FALSE == $sit->andamento && $this->_service->getRegra()->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_GERAL) { if (0 == count($this->_service->getPareceresGerais())) { $label = 'Lançar'; } else { $label = 'Editar'; } $link = array('text' => $label . ' parecer descritivo do aluno', 'path' => 'parecer', 'query' => array('matricula' => $this->getRequest()->matricula)); $this->addDetalhe(array('Parecer descritivo anual', $url->l($link['text'], $link['path'], array('query' => $link['query'])))); } // Caso o tipo de progressão seja manual, a situação das notas/faltas não // esteja mais em "andamento" e a matrícula esteja em andamento, exibe // botões de ação if ($this->_service->getRegra()->get('tipoProgressao') == RegraAvaliacao_Model_TipoProgressao::NAO_CONTINUADA_MANUAL && FALSE == $sit->andamento && $matricula['aprovado'] == App_Model_MatriculaSituacao::EM_ANDAMENTO) { $link = array('text' => 'sim', 'path' => 'boletim', 'query' => array('matricula' => $this->getRequest()->matricula, 'promove' => 1)); $sim = '<span class="confirm yes">' . $url->l($link['text'], $link['path'], array('query' => $link['query'])) . '</span>'; $link['text'] = 'não (retém o aluno)'; $link['query']['promove'] = 0; $nao = '<span class="confirm no">' . $url->l($link['text'], $link['path'], array('query' => $link['query'])) . '</span>'; $links = '<div style="padding: 5px 0 5px 0">' . $sim . $nao . '</div>'; $this->addDetalhe(array('Promover aluno?', $links)); } }
function renderHTML() { if ($_POST) { foreach ($_POST as $key => $value) { $this->{$key} = $value; } } if ($this->ref_ref_cod_serie) { $this->ref_cod_serie = $this->ref_ref_cod_serie; } $this->ref_cod_modulo = explode('-', $this->ref_cod_modulo); $this->ref_cod_modulo = array_pop($this->ref_cod_modulo); $fonte = 'arial'; $corTexto = '#000000'; if (empty($this->ref_cod_turma)) { echo '<script> alert("Erro ao gerar relatório!\\nNenhuma turma selecionada!"); window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); </script>'; return TRUE; } if ($this->ref_cod_escola) { $obj_escola = new clsPmieducarEscola($this->ref_cod_escola); $det_escola = $obj_escola->detalhe(); $this->nm_escola = $det_escola['nome']; $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']); $det_instituicao = $obj_instituicao->detalhe(); $this->nm_instituicao = $det_instituicao['nm_instituicao']; } $obj_calendario = new clsPmieducarEscolaAnoLetivo(); $lista_calendario = $obj_calendario->lista($this->ref_cod_escola, $this->ano, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL); $obj_turma = new clsPmieducarTurma($this->ref_cod_turma); $det_turma = $obj_turma->detalhe(); $this->nm_turma = $det_turma['nm_turma']; $obj_serie = new clsPmieducarSerie($this->ref_cod_serie); $det_serie = $obj_serie->detalhe(); $this->nm_serie = $det_serie['nm_serie']; $obj_pessoa = new clsPessoa_($det_turma['ref_cod_regente']); $det = $obj_pessoa->detalhe(); $this->nm_professor = $det['nome']; // $regraMapper = new RegraAvaliacao_Model_RegraDataMapper(); $this->regra = $regraMapper->find($det_serie['regra_avaliacao_id']); if (!$lista_calendario) { echo '<script> alert("Escola não possui calendário definido para este ano"); window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1)); </script>'; return TRUE; } $obj = new clsPmieducarSerie(); $obj->setOrderby('cod_serie, etapa_curso'); $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); $obj_curso = new clsPmieducarCurso($this->ref_cod_curso); $det_curso = $obj_curso->detalhe(); $this->nm_curso = $det_curso['nm_curso']; // Seleciona os alunos da turma $obj_matricula_turma = new clsPmieducarMatriculaTurma(); $obj_matricula_turma->setOrderby('nome_ascii'); $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, $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, NULL, NULL, NULL, TRUE, NULL, NULL, TRUE, NULL, $this->semestre); $componentes = $array_disc = $array_cab = array(); if ('f' == $this->tipo && $this->regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) { $array_disc = $array_cab = array("FALTAS"); } else { try { $componentes = App_Model_IedFinder::getComponentesTurma($this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_turma); } catch (App_Model_Exception $e) { } } if ($lst_matricula_turma) { $titulo = sprintf('Espelho de Notas Bimestral %dº Bimestre Ano %d', $this->ref_cod_modulo, $this->ano); $subtitulo = sprintf("%s\n%s\n%s\n%s - Turma: %s %s", $this->nm_instituicao, $this->nm_escola, $this->nm_curso, $this->nm_serie, $this->nm_turma, date('d/m/Y')); $relatorio = new relatorios($titulo, 210, FALSE, 'Espelho de Notas Bimestral', 'A4', $subtitulo); $relatorio->setMargem(20, 20, 50, 50); $relatorio->exibe_produzido_por = FALSE; if (0 == count($array_disc) && 0 < count($componentes)) { foreach ($componentes as $componente) { $array_disc[$componente->id] = $componente; $array_cab[] = str2upper($componente->abreviatura); } asort($array_disc); sort($array_cab); } $array_cab = array_merge(array('Cód.', 'Nome do Aluno'), $array_cab); $divisoes = array(40, 165); $divisoes_texto = array(40, 165); $tamanho_divisao = 32 + (10 - count($array_disc)) * 5; for ($ct = 0; $ct < 20; $ct++) { $divisoes[] = $tamanho_divisao; $divisoes_texto[] = $tamanho_divisao; } $relatorio->novalinha($array_cab, 0, 16, TRUE, 'arial', $divisoes, '#515151', '#D3D3D3', '#FFFFFF', FALSE, TRUE); foreach ($lst_matricula_turma as $matricula) { $boletim = new Avaliacao_Service_Boletim(array('matricula' => $matricula['ref_cod_matricula'], 'RegraDataMapper' => $regraMapper)); $tam_fonte = NULL; $tam_linha = 16; $componentes = $boletim->getComponentes(); foreach ($array_disc as $cid => $componente) { // Presença geral, seleciona apenas a quantidade de faltas da etapa if (0 == $cid) { $faltas[$cid] = $boletim->getFalta($this->ref_cod_modulo); break; } if (!in_array($cid, array_keys($componentes))) { $notas[$cid] = 'D'; $faltas[$cid] = 'D'; continue; } $notas[$cid] = $boletim->getNotaComponente($cid, $this->ref_cod_modulo); $faltas[$cid] = $boletim->getFalta($this->ref_cod_modulo, $cid); } // @todo WTF?! if (strlen($matricula['nome']) > 24) { $matricula['nome'] = explode(' ', $matricula['nome']); if (is_array($matricula['nome'])) { $nome_aluno = array_shift($matricula['nome']); } if (is_array($matricula['nome'])) { $nome_aluno .= ' ' . array_shift($matricula['nome']); } if (is_array($matricula['nome'])) { $nome_aluno .= ' ' . array_pop($matricula['nome']); } $matricula['nome'] = $nome_aluno; } unset($array_val); $array_val = array(); $array_val[] = $matricula['ref_cod_aluno']; $array_val[] = $matricula['nome']; foreach ($array_disc as $cid => $disc) { if ($this->tipo == 'n') { $array_val[] = $notas[$cid]->notaArredondada; continue; } else { $array_val[] = $faltas[$cid]->quantidade; continue; } $array_val[] = ''; } $relatorio->novalinha($array_val, 0, $tam_linha, FALSE, 'arial', $divisoes_texto, '#515151', '#d3d3d3', '#FFFFFF', FALSE, TRUE, NULL, $tam_fonte); } $this->get_link = $relatorio->fechaPdf(); } echo sprintf(' <script> window.onload=function() { parent.EscondeDiv("LoadImprimir"); window.location="download.php?filename=%s" } </script>', $this->get_link); echo sprintf(' <html> <center> 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> <span style="font-size: 10px;"> Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br> Clique na Imagem para Baixar o instalador<br><br> <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> </span> </center> </html>', $this->get_link); }
function renderHTML() { if ($_POST) { foreach ($_POST as $key => $value) { $this->{$key} = $value; } } if ($this->ref_ref_cod_serie) { $this->ref_cod_serie = $this->ref_ref_cod_serie; } $fonte = 'arial'; $corTexto = '#000000'; if (!is_numeric($this->ref_cod_escola) || !is_numeric($this->ref_cod_curso) || !is_numeric($this->ref_cod_serie) || !is_numeric($this->ref_cod_turma) || !is_numeric($this->ano)) { print $this->getError(); return; } // Instituição $obj_instituicao = new clsPmieducarInstituicao($this->ref_cod_instituicao); $nm_instituicao = $obj_instituicao->detalhe(); $nm_instituicao = $nm_instituicao['nm_instituicao']; // Escola $obj_escola = new clsPmieducarEscola($this->ref_cod_escola); $nm_escola = $obj_escola->detalhe(); $nm_escola = $nm_escola['nome']; // Curso $obj_curso = new clsPmieducarCurso($this->ref_cod_curso); $obj_curso->setCamposLista('media, media_exame, nm_curso'); $det_curso = $obj_curso->detalhe(); $nm_curso = $det_curso['nm_curso']; // Série $obj_serie = new clsPmieducarSerie($this->ref_cod_serie); $obj_serie->setCamposLista('nm_serie'); $det_serie = $obj_serie->detalhe(); $nm_serie = $det_serie['nm_serie']; $regraId = $det_serie['regra_avaliacao_id']; // Turma $obj_turma = new clsPmieducarTurma($this->ref_cod_turma); $obj_turma->setCamposLista('nm_turma'); $det_turma = $obj_turma->detalhe(); $nm_turma = $det_turma['nm_turma']; // Situação da matrícula do aluno (aprovado) $situacao = $this->ano == date('Y') ? App_Model_MatriculaSituacao::EM_ANDAMENTO : implode(', ', array(App_Model_MatriculaSituacao::APROVADO, App_Model_MatriculaSituacao::REPROVADO, App_Model_MatriculaSituacao::EM_ANDAMENTO)); $sql = sprintf(' SELECT m.cod_matricula, ( SELECT nome FROM pmieducar.aluno al, cadastro.pessoa WHERE al.cod_aluno = m.ref_cod_aluno AND al.ref_idpes = pessoa.idpes ) AS nome FROM pmieducar.matricula m, pmieducar.matricula_turma mt WHERE mt.ref_cod_turma = %d AND mt.ref_cod_matricula = m.cod_matricula AND m.aprovado IN (%s) AND mt.ativo = 1 AND m.ativo = 1 AND m.ano = %d ORDER BY nome', $this->ref_cod_turma, $situacao, $this->ano); $db = new clsBanco(); $db->Consulta($sql); // Mappers $regraMapper = new RegraAvaliacao_Model_RegraDataMapper(); $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper(); $regra = $regraMapper->find($regraId); if (is_null($regra->formulaRecuperacao)) { $regra = 'A regra de avaliação dessa série não possui uma fórmula de cálculo de recuperação.'; } else { $regra = sprintf('Recuperação: %s; fórmula: %s.', $regra->formulaRecuperacao, $regra->formulaRecuperacao->formulaMedia); } if ($db->Num_Linhas()) { $alunos = array(); // Instancia objeto de relatório padrão $detalhes = sprintf('%s%s%s%s%s%s%s - Turma: %s %s', $nm_instituicao, "\n", $nm_escola, "\n", $nm_curso, "\n", $nm_serie, $nm_turma, date('d/m/Y')); $relatorio = new relatorios('Relação de alunos em exame', 210, FALSE, 'Relação de alunos em exame', 'A4', $detalhes); $relatorio->exibe_produzido_por = FALSE; $relatorio->setMargem(20, 20, 20, 20); $relatorio->novalinha(array(sprintf('Nome Escola: %s Ano: %d', $nm_escola, $this->ano)), 0, 12, TRUE, 'arial', FALSE, '#000000', '#d3d3d3', '#FFFFFF', FALSE, TRUE); $relatorio->novalinha(array(sprintf('Curso: %s Ano/Série: %s Turma: %s', $nm_curso, $nm_serie, $nm_turma)), 0, 12, TRUE, 'arial', FALSE, '#000000', '#d3d3d3', '#FFFFFF', FALSE, TRUE); $relatorio->novalinha(array(sprintf('%s Data: %s', $regra, date('d/m/Y'))), 0, 12, TRUE, 'arial', FALSE, '#000000', '#d3d3d3', '#FFFFFF', FALSE, TRUE); $relatorio->novalinha(array('Mat.', 'Nome Aluno', 'Componentes', 'Média', 'Nota necessária (mín.)'), 0, 12, TRUE, 'arial', array(30, 180, 150, 60), '#515151', '#d3d3d3', '#FFFFFF', FALSE, TRUE); while ($db->ProximoRegistro()) { list($cod_matricula, $nome_aluno) = $db->Tupla(); $boletim = new Avaliacao_Service_Boletim(array('matricula' => $cod_matricula, 'RegraDataMapper' => $regraMapper, 'ComponenteDataMapper' => $componenteMapper)); $componentes = $boletim->getComponentes(); $medias = $boletim->getMediasComponentes(); $situacao = $boletim->getSituacaoComponentesCurriculares(); if ($situacao->situacao != App_Model_MatriculaSituacao::EM_EXAME) { continue; } foreach ($situacao->componentesCurriculares as $id => $situacaoComponente) { if ($situacaoComponente->situacao != App_Model_MatriculaSituacao::EM_EXAME) { continue; } $mediaRecuperacao = $boletim->preverNotaRecuperacao($id); if (!is_null($mediaRecuperacao)) { $previsao = sprintf('%s (%.2f)', $mediaRecuperacao->nome, $mediaRecuperacao->valorMinimo); } else { $previsao = 'Nenhuma nota possível.'; } $data = array($cod_matricula, $nome_aluno, $componentes[$id], $medias[$id][0]->mediaArredondada, $previsao); $relatorio->novalinha($data, 0, 12, FALSE, 'arial', array(30, 180, 150, 60), '#515151', '#d3d3d3', '#FFFFFF', FALSE, TRUE); } } } else { print $this->getError(); return; } $this->get_link = $relatorio->fechaPdf(); echo sprintf(' <script> window.onload=function() { parent.EscondeDiv("LoadImprimir"); window.location="download.php?filename=%s" } </script>', $this->get_link); echo sprintf(' <html> <center> 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> <span style="font-size: 10px;"> Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br> Clique na Imagem para Baixar o instalador<br><br> <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> </span> </center> </html>', $this->get_link); }