function renderHTML()
 {
     if ($_POST) {
         foreach ($_POST as $key => $value) {
             $this->{$key} = $value;
         }
     }
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     // Instancia o objeto clsPDF
     $this->pdf = new clsPDF('Boletim', 'BolTit', 'A4', '');
     $this->pdf->largura = 842.0;
     $this->pdf->altura = 595.0;
     $this->pdf->topmargin = 5;
     $this->pdf->bottommargirn = 5;
     $altura_linha = 13;
     // Instituição
     $instituicao = App_Model_IedFinder::getInstituicoes();
     $instituicao = $instituicao[$this->ref_cod_instituicao];
     // Escola
     $escola = new clsPmieducarEscola();
     $escola->cod_escola = $this->ref_cod_escola;
     $escola = $escola->detalhe();
     $escola = $escola['nome'];
     // Carrega as informações do curso
     $serie = new clsPmieducarSerie($this->ref_ref_cod_serie, NULL, NULL, $this->ref_cod_curso);
     // Dados da série
     $serie = $serie->detalhe();
     // Recupera a regra da série
     $regraMapper = new RegraAvaliacao_Model_RegraDataMapper();
     $regra = $regraMapper->find($serie['regra_avaliacao_id']);
     // Carrega alunos matriculados
     $matriculaTurma = new clsPmieducarMatriculaTurma();
     $matriculaTurma->setOrderby('nome_aluno');
     $matriculados = $matriculaTurma->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, NULL, NULL, NULL, $this->ano, NULL, TRUE);
     foreach ($matriculados as $matriculado) {
         $this->pdf->OpenPage();
         $this->page_y = 10;
         $codMatricula = $matriculado['ref_cod_matricula'];
         $nomeAluno = $matriculado['nome_aluno'];
         $turma = $matriculado['nm_turma'];
         $boletim = new Avaliacao_Service_Boletim(array('matricula' => $codMatricula));
         $matriculaData = $boletim->getOption('matriculaData');
         $curso = $matriculaData['curso_nome'];
         $serie = $matriculaData['serie_nome'];
         $this->addCabecalho($instituicao, $escola, $codMatricula, $nomeAluno, $curso, $turma, $serie);
         $this->inicio_y = $this->page_y - 25;
         $this->_notasFaltasComponentes($boletim);
         $situacao = $boletim->getSituacaoAluno();
         $this->page_y += 25;
         $this->rodape($codMatricula, $nomeAluno, $matriculaData['aprovado']);
         $this->pdf->ClosePage();
     }
     $this->pdf->CloseFile();
     $this->get_link = $this->pdf->GetLink();
     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);
 }
Пример #2
0
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = 'S&eacute;rie - Detalhe';
     $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet');
     $this->cod_serie = $_GET["cod_serie"];
     $tmp_obj = new clsPmieducarSerie($this->cod_serie);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header('Location: educar_serie_lst.php');
         die;
     }
     $obj_ref_cod_curso = new clsPmieducarCurso($registro['ref_cod_curso']);
     $det_ref_cod_curso = $obj_ref_cod_curso->detalhe();
     $registro['ref_cod_curso'] = $det_ref_cod_curso['nm_curso'];
     $registro['ref_cod_instituicao'] = $det_ref_cod_curso['ref_cod_instituicao'];
     $obj_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']);
     $obj_instituicao_det = $obj_instituicao->detalhe();
     $registro['ref_cod_instituicao'] = $obj_instituicao_det['nm_instituicao'];
     $obj_permissoes = new clsPermissoes();
     $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         if ($registro['ref_cod_instituicao']) {
             $this->addDetalhe(array('Institui&ccedil;&atilde;o', $registro['ref_cod_instituicao']));
         }
     }
     if ($registro['ref_cod_curso']) {
         $this->addDetalhe(array('Curso', $registro['ref_cod_curso']));
     }
     if ($registro['nm_serie']) {
         $this->addDetalhe(array('S&eacute;rie', $registro['nm_serie']));
     }
     if ($registro['etapa_curso']) {
         $this->addDetalhe(array('Etapa Curso', $registro['etapa_curso']));
     }
     if ($regraId = $registro['regra_avaliacao_id']) {
         $mapper = new RegraAvaliacao_Model_RegraDataMapper();
         $regra = $mapper->find($regraId);
         $this->addDetalhe(array('Regra Avaliação', $regra));
     }
     if ($registro['concluinte']) {
         if ($registro['concluinte'] == 1) {
             $registro['concluinte'] = 'n&atilde;o';
         } else {
             if ($registro['concluinte'] == 2) {
                 $registro['concluinte'] = 'sim';
             }
         }
         $this->addDetalhe(array('Concluinte', $registro['concluinte']));
     }
     if ($registro['carga_horaria']) {
         $this->addDetalhe(array('Carga Hor&aacute;ria', $registro['carga_horaria']));
     }
     $this->addDetalhe(array('Dias letivos', $registro['dias_letivos']));
     if ($registro['intervalo']) {
         $this->addDetalhe(array('Intervalo', $registro['intervalo']));
     }
     if ($registro['observacao_historico']) {
         $this->addDetalhe(array('Observação histórico', $registro['observacao_historico']));
     }
     if ($obj_permissoes->permissao_cadastra(583, $this->pessoa_logada, 3)) {
         $this->url_novo = 'educar_serie_cad.php';
         $this->url_editar = "educar_serie_cad.php?cod_serie={$registro['cod_serie']}";
     }
     $this->url_cancelar = 'educar_serie_lst.php';
     $this->largura = '100%';
 }
 /**
  * Construtor.
  */
 function clsPmieducarSerie($cod_serie = NULL, $ref_usuario_exc = NULL, $ref_usuario_cad = NULL, $ref_cod_curso = NULL, $nm_serie = NULL, $etapa_curso = NULL, $concluinte = NULL, $carga_horaria = NULL, $data_cadastro = NULL, $data_exclusao = NULL, $ativo = NULL, $intervalo = NULL, $idade_inicial = NULL, $idade_final = NULL, $regra_avaliacao_id = NULL, $observacao_historico = null, $dias_letivos = null)
 {
     $db = new clsBanco();
     $this->_schema = "pmieducar.";
     $this->_tabela = "{$this->_schema}serie";
     $this->_campos_lista = $this->_todos_campos = "s.cod_serie, s.ref_usuario_exc, s.ref_usuario_cad, s.ref_cod_curso, s.nm_serie, s.etapa_curso, s.concluinte, s.carga_horaria, s.data_cadastro, s.data_exclusao, s.ativo, s.intervalo, s.idade_inicial, s.idade_final, s.regra_avaliacao_id, s.observacao_historico, s.dias_letivos";
     if (is_numeric($ref_cod_curso)) {
         if (class_exists("clsPmieducarCurso")) {
             $tmp_obj = new clsPmieducarCurso($ref_cod_curso);
             $curso = $tmp_obj->detalhe();
             if (FALSE != $curso) {
                 $this->ref_cod_curso = $ref_cod_curso;
             }
         } else {
             if ($db->CampoUnico("SELECT 1 FROM pmieducar.curso WHERE cod_curso = '{$ref_cod_curso}'")) {
                 $this->ref_cod_curso = $ref_cod_curso;
             }
         }
     }
     if (is_numeric($ref_usuario_exc)) {
         if (class_exists("clsPmieducarUsuario")) {
             $tmp_obj = new clsPmieducarUsuario($ref_usuario_exc);
             if (method_exists($tmp_obj, "existe")) {
                 if ($tmp_obj->existe()) {
                     $this->ref_usuario_exc = $ref_usuario_exc;
                 }
             } else {
                 if (method_exists($tmp_obj, "detalhe")) {
                     if ($tmp_obj->detalhe()) {
                         $this->ref_usuario_exc = $ref_usuario_exc;
                     }
                 }
             }
         } else {
             if ($db->CampoUnico("SELECT 1 FROM pmieducar.usuario WHERE cod_usuario = '{$ref_usuario_exc}'")) {
                 $this->ref_usuario_exc = $ref_usuario_exc;
             }
         }
     }
     if (is_numeric($ref_usuario_cad)) {
         if (class_exists("clsPmieducarUsuario")) {
             $tmp_obj = new clsPmieducarUsuario($ref_usuario_cad);
             if (method_exists($tmp_obj, "existe")) {
                 if ($tmp_obj->existe()) {
                     $this->ref_usuario_cad = $ref_usuario_cad;
                 }
             } else {
                 if (method_exists($tmp_obj, "detalhe")) {
                     if ($tmp_obj->detalhe()) {
                         $this->ref_usuario_cad = $ref_usuario_cad;
                     }
                 }
             }
         } else {
             if ($db->CampoUnico("SELECT 1 FROM pmieducar.usuario WHERE cod_usuario = '{$ref_usuario_cad}'")) {
                 $this->ref_usuario_cad = $ref_usuario_cad;
             }
         }
     }
     // Atribuibui a identificação de regra de avaliação
     if (!is_null($regra_avaliacao_id) && is_numeric($regra_avaliacao_id)) {
         $mapper = new RegraAvaliacao_Model_RegraDataMapper();
         if (isset($curso)) {
             $regras = $mapper->findAll(array(), array('id' => $regra_avaliacao_id, 'instituicao' => $curso['ref_cod_instituicao']));
             if (1 == count($regras)) {
                 $regra = $regras[0];
             }
         } else {
             $regra = $mapper->find($regra_avaliacao_id);
         }
         // Verificação fraca pois deixa ser uma regra de outra instituição
         if (isset($regra)) {
             $this->regra_avaliacao_id = $regra->id;
         }
     }
     if (is_numeric($cod_serie)) {
         $this->cod_serie = $cod_serie;
     }
     if (is_string($nm_serie)) {
         $this->nm_serie = $nm_serie;
     }
     if (is_numeric($etapa_curso)) {
         $this->etapa_curso = $etapa_curso;
     }
     if (is_numeric($concluinte)) {
         $this->concluinte = $concluinte;
     }
     if (is_numeric($carga_horaria)) {
         $this->carga_horaria = $carga_horaria;
     }
     if (is_string($data_cadastro)) {
         $this->data_cadastro = $data_cadastro;
     }
     if (is_string($data_exclusao)) {
         $this->data_exclusao = $data_exclusao;
     }
     if (is_numeric($ativo)) {
         $this->ativo = $ativo;
     }
     if (is_numeric($intervalo)) {
         $this->intervalo = $intervalo;
     }
     if (is_numeric($idade_inicial)) {
         $this->idade_inicial = $idade_inicial;
     }
     if (is_numeric($idade_final)) {
         $this->idade_final = $idade_final;
     }
     $this->observacao_historico = $observacao_historico;
     $this->dias_letivos = $dias_letivos;
 }
Пример #4
0
 function Gerar()
 {
     if ($_POST) {
         foreach ($_POST as $campo => $val) {
             $this->{$campo} = $this->{$campo} ? $this->{$campo} : $val;
         }
     }
     // primary keys
     $this->campoOculto("cod_serie", $this->cod_serie);
     $obrigatorio = TRUE;
     $get_curso = TRUE;
     include 'include/pmieducar/educar_campo_lista.php';
     $this->campoTexto("nm_serie", "S&eacute;rie", $this->nm_serie, 30, 255, TRUE);
     $opcoes = array("" => "Selecione");
     if ($this->ref_cod_curso) {
         $objTemp = new clsPmieducarCurso();
         $lista = $objTemp->lista($this->ref_cod_curso, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes_["{$registro['cod_curso']}"] = "{$registro['qtd_etapas']}";
             }
         }
         for ($i = 1; $i <= $opcoes_["{$registro['cod_curso']}"]; $i++) {
             $opcoes[$i] = "Etapa {$i}";
         }
     }
     $this->campoLista('etapa_curso', 'Etapa Curso', $opcoes, $this->etapa_curso);
     // Regra de avaliação
     $mapper = new RegraAvaliacao_Model_RegraDataMapper();
     $regras = array();
     if (!is_null($this->ref_cod_instituicao)) {
         $regras = $mapper->findAll(array(), array('instituicao' => $this->ref_cod_instituicao));
         $regras = CoreExt_Entity::entityFilterAttr($regras, 'id', 'nome');
     }
     $this->campoLista('regra_avaliacao_id', 'Regra Avaliação', $regras, $this->regra_avaliacao_id);
     $opcoes = array('' => 'Selecione', 1 => 'n&atilde;o', 2 => 'sim');
     $this->campoLista('concluinte', 'Concluinte', $opcoes, $this->concluinte);
     $this->campoMonetario('carga_horaria', 'Carga Hor&aacute;ria', $this->carga_horaria, 7, 7, TRUE);
     $this->campoNumero('intervalo', 'Intervalo', $this->intervalo, 2, 2, TRUE);
     $this->campoNumero('idade_inicial', 'Faixa et&aacute;ria', $this->idade_inicial, 2, 2, FALSE, '', '', FALSE, FALSE, TRUE);
     $this->campoNumero('idade_final', '&nbsp;até', $this->idade_final, 2, 2, FALSE);
 }
 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()
 {
     session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     foreach ($_POST as $key => $value) {
         $this->{$key} = $value;
     }
     $this->ref_cod_serie = $this->ref_ref_cod_serie;
     $fonte = 'arial';
     $corTexto = '#000000';
     if (!is_numeric($this->ref_cod_instituicao) || !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)) {
         echo '
     <script>
       alert("A turma não possui nenhum aluno com situação final definida");
       window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
     </script>';
         return TRUE;
     }
     $sql = sprintf("\n      SELECT\n        cod_matricula,\n        aprovado,\n        ref_ref_cod_serie,\n        (SELECT\n           nome\n         FROM\n           pmieducar.aluno a,\n           cadastro.pessoa p\n         WHERE\n           a.cod_aluno = m.ref_cod_aluno\n           AND p.idpes = a.ref_idpes\n        ) AS nome\n      FROM\n        pmieducar.matricula m,\n        pmieducar.matricula_turma mt\n      WHERE\n        mt.ref_cod_turma = %d\n        AND mt.ref_cod_matricula = m.cod_matricula\n        AND m.ativo = 1\n        AND mt.ativo = 1\n        AND aprovado IN (1, 2)\n        AND ano = %d\n      ORDER BY\n        ref_ref_cod_serie, nome", $this->ref_cod_turma, $this->ano);
     //verificar se a turma é multiseriada
     $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
     $det_turma = $obj_turma->detalhe();
     $ref_ref_cod_serie_mult = $det_turma['ref_ref_cod_serie_mult'];
     $db = new clsBanco();
     $db->Consulta($sql);
     if (!$db->numLinhas()) {
         echo '
     <script>
       alert("A turma não possui nenhum aluno com situação final definida");
       window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length - 1));
     </script>';
         return TRUE;
     }
     $numAlunos = $db->numLinhas();
     // Nome da instituição
     $obj_instituicao = new clsPmieducarInstituicao($this->ref_cod_instituicao);
     $det_instituicao = $obj_instituicao->detalhe();
     $this->nm_instituicao = $det_instituicao['nm_instituicao'];
     // Nome da escola
     $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
     $det_escola = $obj_escola->detalhe();
     $this->nm_escola = $det_escola['nome'];
     // Nome do curso
     $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
     $det_curso = $obj_curso->detalhe();
     $this->nm_curso = $det_curso['nm_curso'];
     // Série
     $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
     $obj_serie->setOrderby('nm_serie');
     $det_serie = $obj_serie->detalhe();
     $this->nm_serie = $det_serie['nm_serie'];
     // Seleciona a regra de avaliação da série
     $regraMapper = new RegraAvaliacao_Model_RegraDataMapper();
     $this->regra = $regraMapper->find($det_serie['regra_avaliacao_id']);
     // Carrega as definições de disciplina
     $componentes = App_Model_IedFinder::getComponentesTurma($this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_turma);
     foreach ($componentes as $id => $componente) {
         $this->componentes[$id] = $componente;
     }
     $this->presencaGeral = $this->regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL;
     $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
     $obj_turma->setCamposLista('nm_turma, hora_inicial');
     $det_turma = $obj_turma->detalhe();
     if ($det_turma['hora_inicial'] < '12:00') {
         $this->nm_turno = 'Matutino';
     } elseif ($det_turma['hora_inicial'] < '18:00') {
         $this->nm_turno = 'Vespertino';
     } else {
         $this->nm_turno = 'Noturno';
     }
     $this->nm_turma = $det_turma["nm_turma"];
     $this->buscaDiasLetivos();
     asort($this->componentes);
     $this->pdf = new clsPDF('Ata de Resultado Final - ' . $this->ano, 'Ata de Resultado Final', 'A4', '', FALSE, FALSE);
     $this->pdf->largura = 842.0;
     $this->pdf->altura = 595.0;
     $this->pdf->OpenPage();
     $this->addCabecalho();
     $esquerda = 3;
     $direita = 834;
     $tam_texto = 10;
     $altura = 130;
     $altura += 50;
     $espessura_linha = 0.3;
     $alunos_matriculados = array();
     while ($db->ProximoRegistro()) {
         list($cod_matricula, $aprovado, $ref_cod_serie, $nome) = $db->Tupla();
         $alunos_matriculados[$cod_matricula] = array('aprovado' => $aprovado, 'nome' => $nome, 'ref_cod_serie' => $ref_cod_serie);
     }
     if (is_array($alunos_matriculados) && count($alunos_matriculados)) {
         $this->getAlunoNotasFaltasTable($alunos_matriculados, $det_curso, $curso_conceitual);
     }
     $this->rodape();
     $this->pdf->CloseFile();
     $this->get_link = $this->pdf->GetLink();
     echo sprintf("\n        <script>\n          window.onload=function() {\n            parent.EscondeDiv('LoadImprimir');\n            window.location='download.php?filename=%s'\n          }\n        </script>", $this->get_link);
     echo sprintf("\n        <html>\n          <center>\n            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>\n            <span style='font-size: 10px;'>\n              Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>\n              Clique na Imagem para Baixar o instalador<br><br>\n              <a href=\"http://www.adobe.com.br/products/acrobat/readstep2.html\" target=\"new\"><br>\n                <img src=\"imagens/acrobat.gif\" width=\"88\" height=\"31\" border=\"0\">\n              </a>\n            </span>\n          </center>\n        </html>", $this->get_link);
 }
 function renderHTML()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     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 (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'];
     // Regra da série
     $regraMapper = new RegraAvaliacao_Model_RegraDataMapper();
     $this->regra = $regraMapper->find($det_serie['regra_avaliacao_id']);
     $obj_pessoa = new clsPessoa_($det_turma['ref_cod_regente']);
     $det = $obj_pessoa->detalhe();
     $this->nm_professor = $det['nome'];
     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_curso = new clsPmieducarCurso($this->ref_cod_curso);
     $det_curso = $obj_curso->detalhe();
     $this->nm_curso = $det_curso['nm_curso'];
     $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso['ref_cod_tipo_avaliacao']);
     $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();
     $conceitual = $det_tipo_avaliacao['conceitual'];
     $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);
     // Recupera os componentes curriculares da turma
     $componentes = App_Model_IedFinder::getComponentesTurma($this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_turma);
     // Recupera a quantidade de módulos e o nome do módulo da escola/turma
     $modulo = App_Model_IedFinder::getModulo($this->ref_cod_escola, $this->ref_cod_curso, $this->ref_cod_turma, $this->ano);
     $nomeModulo = $modulo['nome'][0];
     $modulos = $modulo['total'];
     if ($lst_matricula_turma) {
         $relatorio = new relatorios('Espelho de Notas Ano - ' . $this->ano, 210, FALSE, 'Espelho de Notas', 'A4', "{$this->nm_instituicao}\n{$this->nm_escola}\n{$this->nm_curso}\n{$this->nm_serie} -  Turma: {$this->nm_turma}         " . date('d/m/Y'));
         $relatorio->setMargem(20, 20, 20, 20);
         $relatorio->exibe_produzido_por = FALSE;
         $array_val = array(array(40, 'Cód.'), array(160, 'Nome do Aluno'));
         foreach (range(1, $modulos) as $num) {
             $array_val[] = array(30, $num . $nomeModulo);
         }
         $array_val[] = array(55, 'M.Parcial');
         $array_val[] = array(50, 'Exame');
         $array_val[] = array(50, 'M.Final');
         $array_val[] = array(38, 'Faltas');
         $arrFuncBody = '
     $values = array();
     foreach ($data as $d) {
       $values[] = $d[$index];
     }
     return $values;
   ';
         $arrFunc = create_function('$data, $index', $arrFuncBody);
         foreach ($componentes as $componente) {
             $relatorio->novalinha(array($componente->nome), 0, 16, TRUE, 'arial', array(400), '#515151', '#D3D3D3', '#FFFFFF', FALSE, TRUE);
             $relatorio->novalinha($arrFunc($array_val, 1), 0, 16, TRUE, 'arial', $arrFunc($array_val, 0), '#515151', '#D3D3D3', '#FFFFFF', FALSE, TRUE);
             foreach ($lst_matricula_turma as $matricula) {
                 $codMatricula = $matricula['ref_cod_matricula'];
                 if (!isset($this->boletim[$codMatricula])) {
                     $boletim = new Avaliacao_Service_Boletim(array('matricula' => $codMatricula, 'RegraDataMapper' => $regraMapper));
                 } else {
                     $boletim = $this->boletim[$codMatricula];
                 }
                 $media_final = $media_parcial = $nota_exame = '';
                 $medias = $boletim->getMediasComponentes();
                 $notas = $boletim->getNotasComponentes();
                 if ($boletim->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) {
                     $faltas = array_sum(CoreExt_Entity::entityFilterAttr($boletim->getFaltasGerais(), 'id', 'quantidade'));
                 } else {
                     $faltas = $boletim->getFaltasComponentes();
                     if (isset($faltas[$componente->id])) {
                         $faltas = array_sum(CoreExt_Entity::entityFilterAttr($faltas[$componente->id], 'id', 'quantidade'));
                     } else {
                         $faltas = '';
                     }
                 }
                 $etapas = range(1, count($notas[$componente->id]));
                 // Se tiver mais etapas nas notas lançadas, significa que prestou exame
                 if (count($etapas) > $modulos) {
                     array_pop($etapas);
                 }
                 $data = array(array(40, $matricula['ref_cod_aluno']), array(160, $matricula['nome']));
                 foreach ($etapas as $i) {
                     $data[] = array(30, $boletim->getNotaComponente($componente->id, $i)->notaArredondada);
                     $media_parcial = $medias[$componente->id][0]->mediaArredondada;
                     if ($i == $modulos) {
                         $media_final = $media_parcial;
                         $media_parcial = '';
                         $nota_exame = $boletim->getNotaComponente($componente->id, 'Rc')->notaArredondada;
                     }
                 }
                 // Adiciona entradas em branco no array de dados
                 for ($i = 0, $loop = $modulos - count($etapas); $i < $loop; $i++) {
                     $data[] = array(30, '');
                 }
                 $data[] = array(55, $media_parcial);
                 $data[] = array(50, $nota_exame);
                 $data[] = array(50, $media_final);
                 $data[] = array(38, $faltas);
                 $relatorio->novalinha($arrFunc($data, 1), 0, 12, FALSE, 'arial', $arrFunc($data, 0), '#515151', '#D3D3D3', '#FFFFFF', FALSE, TRUE);
             }
             $relatorio->quebraPagina();
         }
         $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()
 {
     global $coreExt;
     if ($_POST) {
         foreach ($_POST as $key => $value) {
             $this->{$key} = $value;
         }
     }
     $this->temporario = isset($_POST['temporario']) ? TRUE : FALSE;
     if ($this->ref_ref_cod_serie) {
         $this->ref_cod_serie = $this->ref_ref_cod_serie;
     }
     $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;
     }
     $modulo_sequencial = explode('-', $this->ref_cod_modulo);
     $this->ref_cod_modulo = $modulo_sequencial[0];
     $this->sequencial = $modulo_sequencial[1];
     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'];
     $regraId = $det_serie['regra_avaliacao_id'];
     $obj_pessoa = new clsPessoa_($det_turma['ref_cod_regente']);
     $det = $obj_pessoa->detalhe();
     $this->nm_professor = $det['nome'];
     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;
     }
     $altura_linha = 23;
     $inicio_escrita_y = 175;
     $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();
     // Seleciona a regra para verificar se a presença é geral
     $regraMapper = new RegraAvaliacao_Model_RegraDataMapper();
     $regra = $regraMapper->find($regraId);
     $presencaGeral = $regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL;
     // Seleciona o curso para ver se é padrão e decidir qual ano letivo pesquisar
     $db = new clsBanco();
     $consulta = sprintf('SELECT padrao_ano_escolar FROM pmieducar.curso WHERE cod_curso = \'%d\'', $this->ref_cod_curso);
     $padrao_ano_escolar = $db->CampoUnico($consulta);
     $total_semanas = 0;
     if ($padrao_ano_escolar) {
         // Seleciona o módulo do ano letivo da escola
         $data = $this->getDatasModulo($this->ref_cod_modulo, $this->sequencial, $this->ano, $this->ref_cod_escola);
     } else {
         // Seleciona o módulo do ano letivo da turma
         $data = $this->getDatasModulo($this->ref_cod_modulo, $this->sequencial, $this->ano, NULL, $this->ref_cod_turma);
     }
     $meses = $data['meses'];
     $dias = $data['dias'];
     if (!$this->data_ini) {
         $this->data_ini = $data['dataInicial'];
     }
     if (!$this->data_fim) {
         $this->data_fim = $data['dataFinal'];
     }
     $total_semanas = 0;
     for ($mes = $meses[0]; $mes <= $meses[1]; $mes++) {
         $mes_final = FALSE;
         if ($mes == $meses[0]) {
             $dia = $dias[0];
         } elseif ($mes == $meses[1]) {
             $dia = $dias[1];
             $mes_final = TRUE;
         } else {
             $dia = 1;
         }
         $total_semanas += $this->getNumeroDiasMes($this->ref_cod_turma, $dia, $mes, $this->ano, $mes_final);
         $total_semanas += $ndm;
     }
     $this->pdf = new clsPDF('Diário de Classe - ' . $this->ano, sprintf('Diário de Classe - %s até %s de %s', $this->data_ini, $this->data_fim, $this->ano), 'A4', '', FALSE, FALSE);
     $this->mes_inicial = (int) $meses[0];
     $this->mes_final = (int) $meses[1];
     $this->pdf->largura = 842.0;
     $this->pdf->altura = 595.0;
     $this->total = $total_semanas;
     if (!$this->em_branco) {
         $obj_matricula_turma = new clsPmieducarMatriculaTurma();
         $obj_matricula_turma->setOrderby('nome_ascii');
         $matriculaSituacao = array(App_Model_MatriculaSituacao::APROVADO, App_Model_MatriculaSituacao::REPROVADO, App_Model_MatriculaSituacao::EM_ANDAMENTO);
         $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, $matriculaSituacao, NULL, NULL, $this->ano, NULL, TRUE, NULL, NULL, TRUE);
     }
     if ($this->em_branco) {
         $lista_matricula = array();
         $this->numero_registros = $this->numero_registros ? $this->numero_registros : 20;
         for ($i = 0; $i < $this->numero_registros; $i++) {
             $lista_matricula[] = '';
         }
     }
     // Seleciona os componentes da escola/série
     $componentes = App_Model_IedFinder::getEscolaSerieDisciplina($this->ref_cod_serie, $this->ref_cod_escola);
     if (0 < count($componentes) && FALSE == $presencaGeral) {
         $this->total = $total_semanas = 0;
         foreach ($componentes as $componente) {
             $this->nm_disciplina = $componente->nome;
             $this->page_y = 125;
             if (FALSE == $presencaGeral) {
                 // Número de semanas dos meses
                 $obj_quadro = new clsPmieducarQuadroHorario();
                 $obj_quadro->setCamposLista('cod_quadro_horario');
                 $quadro_horario = $obj_quadro->lista(NULL, NULL, NULL, $this->ref_cod_turma, NULL, NULL, NULL, NULL, 1);
                 $total_semanas = 0;
                 $this->indefinido = FALSE;
                 if (!$quadro_horario) {
                     echo '
           <script>
             alert(\'Turma não possui quadro de horários\');
             window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
           </script>';
                     die;
                 }
                 $obj_quadro_horarios = new clsPmieducarQuadroHorarioHorarios();
                 $obj_quadro_horarios->setCamposLista('dia_semana');
                 $obj_quadro_horarios->setOrderby('1 asc');
                 $lista_quadro_horarios = $obj_quadro_horarios->lista($quadro_horario[0], $this->ref_cod_serie, $this->ref_cod_escola, $componente->id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
                 // Se não for retornado horário e o diário não for temporário, gera
                 // a lista para o próximo componente
                 if (FALSE == $lista_quadro_horarios && FALSE == $this->temporario) {
                     continue;
                 }
                 // Caso o diário seja temporário, gera lista de alunos para 30 dias
                 // por padrão
                 if (FALSE == $lista_quadro_horarios && TRUE == $this->temporario) {
                     $this->indefinido = TRUE;
                     $total_semanas = $coreExt['Config']->get($coreExt['Config']->report->diario_classe->dias_temporarios, 30);
                 }
                 for ($mes_ = $meses[0]; $mes_ <= $meses[1] && FALSE != $lista_quadro_horarios; $mes_++) {
                     $mes_final = FALSE;
                     foreach ($lista_quadro_horarios as $dia_semana) {
                         if ($mes_ == $meses[0]) {
                             $dia = $dias[0];
                         } elseif ($mes_ == $meses[1]) {
                             $dia = $dias[1];
                             $mes_final = TRUE;
                         } else {
                             $dia = 1;
                         }
                         $total_semanas += $this->getDiasSemanaMes($this->ref_cod_turma, $dia, $mes_, $this->ano, $dia_semana, $mes_final);
                     }
                 }
                 $this->total = $total_semanas;
             }
             if (!$this->total) {
                 continue;
             }
             $this->gerarListaAlunos($lista_matricula);
         }
     } else {
         $this->gerarListaAlunos($lista_matricula);
     }
     if ($this->total) {
         $this->pdf->CloseFile();
         $this->get_link = $this->pdf->GetLink();
     } else {
         $this->mensagem = 'Não existem dias letivos cadastrados para esta turma';
         return;
     }
     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);
 }
Пример #9
0
 /**
  * Retorna uma instância de RegraAvaliacao_Model_Regra a partir dos dados
  * da matrícula.
  *
  * @param int $codMatricula
  * @param RegraAvaliacao_Model_RegraDataMapper $mapper
  * @return RegraAvaliacao_Model_Regra
  * @throws App_Model_Exception
  */
 public static function getRegraAvaliacaoPorMatricula($codMatricula, RegraAvaliacao_Model_RegraDataMapper $mapper = NULL)
 {
     $matricula = self::getMatricula($codMatricula);
     $serie = self::getSerie($matricula['ref_ref_cod_serie']);
     if (is_null($mapper)) {
         require_once 'RegraAvaliacao/Model/RegraDataMapper.php';
         $mapper = new RegraAvaliacao_Model_RegraDataMapper();
     }
     return $mapper->find($serie['regra_avaliacao_id']);
 }
 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);
 }
Пример #11
0
 * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
 * do GNU para mais detalhes.
 *
 * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
 * com este programa; se não, escreva para a Free Software Foundation, Inc., no
 * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
 *
 * Retorna um XML com todas as regras de avaliação para uma determinada
 * instituição.
 *
 * @author    Prefeitura Municipal de Itajaí <*****@*****.**>
 * @category  i-Educar
 * @license   @@license@@
 * @package   iEd_Pmieducar
 * @since     Arquivo disponível desde a versão 1.0.0
 * @todo      Refatorar para um design pattern como Service Layer em conjunto
 *   com um controller que permita respostas em JSON/XML.
 * @version   $Id$
 */
header('Content-type: text/xml; charset=ISO-8859-1');
require_once 'include/clsBanco.inc.php';
require_once 'RegraAvaliacao/Model/RegraDataMapper.php';
print "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n<query xmlns=\"sugestoes\">\n";
if (isset($_GET['ins']) && is_numeric($_GET['ins'])) {
    $mapper = new RegraAvaliacao_Model_RegraDataMapper();
    $regras = $mapper->findAll(array('id', 'nome'), array('instituicao' => $_GET['ins']));
    foreach ($regras as $regra) {
        print sprintf('  <regra id="%d">%s</regra>%s', $regra->id, $regra->nome, PHP_EOL);
    }
}
print '</query>';