From 8a28d98c78141195e657b79b02a3eb06bb72a8fb Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Sun, 30 May 2010 16:33:18 +0000 Subject: [PATCH] Refactoring para coding standards --- ieducar/intranet/educar_relatorio_diario_classe_temp.php | 518 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ieducar/intranet/educar_relatorio_diario_classe_temp_proc.php | 1600 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 files changed, 1038 insertions(+), 1080 deletions(-) diff --git a/ieducar/intranet/educar_relatorio_diario_classe_temp.php b/ieducar/intranet/educar_relatorio_diario_classe_temp.php index 1c0519c..bdd7040 100644 --- a/ieducar/intranet/educar_relatorio_diario_classe_temp.php +++ b/ieducar/intranet/educar_relatorio_diario_classe_temp.php @@ -1,346 +1,316 @@ + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * 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. + * + * @author Prefeitura Municipal de Itajaí + * @category i-Educar + * @license @@license@@ + * @package iEd_Pmieducar + * @since Arquivo disponível desde a versão 1.0.0 + * @version $Id$ + */ + +require_once 'include/clsBase.inc.php'; +require_once 'include/clsCadastro.inc.php'; +require_once 'include/clsBanco.inc.php'; +require_once 'include/pmieducar/geral.inc.php'; +require_once 'include/clsPDF.inc.php'; + +/** + * clsIndexBase class. + * + * @author Prefeitura Municipal de Itajaí + * @category i-Educar + * @license @@license@@ + * @package iEd_Pmieducar + * @since Classe disponível desde a versão 1.0.0 + * @version @@package_version@@ + */ class clsIndexBase extends clsBase { - function Formular() - { - $this->SetTitulo( "{$this->_instituicao} i-Educar - Diário de Classe" ); - $this->processoAp = "927"; - } + function Formular() + { + $this->SetTitulo($this->_instituicao . ' i-Educar - Diário de Classe'); + $this->processoAp = 927; + } } +/** + * indice class. + * + * @author Prefeitura Municipal de Itajaí + * @category i-Educar + * @license @@license@@ + * @package iEd_Pmieducar + * @since Classe disponível desde a versão 1.0.0 + * @version @@package_version@@ + */ class indice extends clsCadastro { + var $pessoa_logada; + var $ref_cod_instituicao; + var $ref_cod_escola; + var $ref_cod_serie; + var $ref_cod_turma; - /** - * Referencia pega da session para o idpes do usuario atual - * - * @var int - */ - var $pessoa_logada; + var $ano; + var $mes; + var $nm_escola; + var $nm_instituicao; + var $ref_cod_curso; + var $sequencial; + var $pdf; + var $pagina_atual = 1; + var $total_paginas = 1; + var $nm_professor; + var $nm_turma; + var $nm_serie; + var $nm_disciplina; - var $ref_cod_instituicao; - var $ref_cod_escola; - var $ref_cod_serie; - var $ref_cod_turma; + var $page_y = 125; - var $ano; - var $mes; + var $get_file; - var $nm_escola; - var $nm_instituicao; - var $ref_cod_curso; - var $sequencial; - var $pdf; - var $pagina_atual = 1; - var $total_paginas = 1; - var $nm_professor; - var $nm_turma; - var $nm_serie; - var $nm_disciplina; + var $cursos = array(); - var $page_y = 125; - - var $get_file; + var $get_link; - var $cursos = array(); + var $total; - var $get_link; + var $ref_cod_modulo; - var $total; - - //var $array_disciplinas = array(); - - var $ref_cod_modulo; - - var $meses_do_ano = array( - "1" => "JANEIRO" - ,"2" => "FEVEREIRO" - ,"3" => "MARÇO" - ,"4" => "ABRIL" - ,"5" => "MAIO" - ,"6" => "JUNHO" - ,"7" => "JULHO" - ,"8" => "AGOSTO" - ,"9" => "SETEMBRO" - ,"10" => "OUTUBRO" - ,"11" => "NOVEMBRO" - ,"12" => "DEZEMBRO" - ); - - - function Inicializar() - { - $retorno = "Novo"; - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - //$obj_permissoes = new clsPermissoes(); - //if($obj_permissoes->nivel_acesso($this->pessoa_logada) > 7) - //header("location: index.php"); - - return $retorno; - } - - function Gerar() - { - - $obj_permissoes = new clsPermissoes(); - $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada); - - //if(!$nivel_usuario) - //header("location: index.php"); - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - if($_POST){ - foreach ($_POST as $key => $value) { - $this->$key = $value; - - } - } - - - - $this->ano = $ano_atual = date("Y"); - //$this->mes = $mes_atual = date("n"); - /* - $lim = 5; - for($a = date('Y') ; $a < $ano_atual + $lim ; $a++ ) - $anos["{$a}"] = "{$a}"; - - $this->campoLista( "ano", "Ano",$anos, $this->ano,"",false ); - */ - - $this->campoNumero( "ano", "Ano", $this->ano, 4, 4, true ); - - $this->campoCheck("em_branco","Relatório em branco",""); - $this->campoNumero("numero_registros","Número de linhas","",3,3); - - // $this->campoLista( "mes", "Mês",$this->meses_do_ano, $this->mes,"",false ); - - $get_escola = true; - $obrigatorio = true; - $exibe_nm_escola = true; -// $get_escola_curso = true; - $get_curso = true; - $get_escola_curso_serie = true; - //$get_turma = true; - //$curso_padrao_ano_escolar = 1; - //$exibe_campo_lista_curso_escola = true; - include("include/pmieducar/educar_campo_lista.php"); - - /*$db = new clsBanco(); - $consulta ="SELECT distinct - m.cod_turma - ,m.nm_turma - ,s.cod_serie - ,s.nm_serie - ,m.ref_ref_cod_escola - FROM pmieducar.turma m - ,pmieducar.serie s - WHERE m.ref_ref_cod_serie = s.cod_serie"; - - $db->Consulta($consulta); - - $script = ""; -*/ - $opcoes_turma = array('' => 'Selecione'); - if ( ($this->ref_ref_cod_serie && $this->ref_cod_escola) || $this->ref_cod_curso ) - { - $obj_turma = new clsPmieducarTurma(); - $obj_turma->setOrderby("nm_turma ASC"); - $lst_turma = $obj_turma->lista( null, null, null, $this->ref_ref_cod_serie, $this->ref_cod_escola, null, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, $this->ref_cod_curso ); - if ( is_array( $lst_turma ) && count( $lst_turma ) ) - { - foreach ( $lst_turma as $turma ) - { - $opcoes_turma["{$turma['cod_turma']}"] = "{$turma['nm_turma']}"; - } - } - } - $this->campoLista("ref_cod_turma","Turma",$opcoes_turma,$this->ref_cod_turma); - - $this->campoLista("ref_cod_modulo","Módulo",array('' => 'Selecione'),""); - - if($this->ref_cod_escola) - $this->ref_ref_cod_escola = $this->ref_cod_escola; - - if($this->get_link) - $this->campoRotulo("rotulo11", "-", "Baixar Relatório"); - - $this->url_cancelar = "educar_index.php"; - $this->nome_url_cancelar = "Cancelar"; - - $this->acao_enviar = 'acao2()'; - $this->acao_executa_submit = false; - } + var $meses_do_ano = array( + 1 => 'JANEIRO', + 2 => 'FEVEREIRO', + 3 => 'MARÇO', + 4 => 'ABRIL', + 5 => 'MAIO', + 6 => 'JUNHO', + 7 => 'JULHO', + 8 => 'AGOSTO', + 9 => 'SETEMBRO', + 10 => 'OUTUBRO', + 11 => 'NOVEMBRO', + 12 => 'DEZEMBRO' + ); + function Inicializar() + { + $retorno = 'Novo'; + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + return $retorno; + } + + function Gerar() + { + $obj_permissoes = new clsPermissoes(); + $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada); + + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + if ($_POST) { + foreach ($_POST as $key => $value) { + $this->$key = $value; + } + } + + $this->ano = $ano_atual = date('Y'); + + $this->campoNumero('ano', 'Ano', $this->ano, 4, 4, TRUE); + + $this->campoCheck('em_branco', 'Relatório em branco', ''); + $this->campoNumero('numero_registros', 'Número de linhas', '', 3, 3); + + $get_escola = TRUE; + $obrigatorio = TRUE; + $exibe_nm_escola = TRUE; + $get_curso = TRUE; + $get_escola_curso_serie = TRUE; + + include 'include/pmieducar/educar_campo_lista.php'; + + $opcoes_turma = array('' => 'Selecione'); + + if (($this->ref_ref_cod_serie && $this->ref_cod_escola) || $this->ref_cod_curso) { + $obj_turma = new clsPmieducarTurma(); + $obj_turma->setOrderby('nm_turma ASC'); + + $lst_turma = $obj_turma->lista(NULL, NULL, NULL, $this->ref_ref_cod_serie, + $this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_curso); + + if (is_array($lst_turma) && count($lst_turma)) { + foreach ($lst_turma as $turma) { + $opcoes_turma[$turma['cod_turma']] = $turma['nm_turma']; + } + } + } + + $this->campoLista('ref_cod_turma', 'Turma', $opcoes_turma, $this->ref_cod_turma); + + $this->campoLista('ref_cod_modulo', 'Módulo', array('' => 'Selecione'), ''); + + if ($this->ref_cod_escola) { + $this->ref_ref_cod_escola = $this->ref_cod_escola; + } + + if ($this->get_link) { + $this->campoRotulo('rotulo11', '-', sprintf('Baixar Relatório', $this->get_link)); + } + + $this->url_cancelar = 'educar_index.php'; + $this->nome_url_cancelar = 'Cancelar'; + + $this->acao_enviar = 'acao2()'; + $this->acao_executa_submit = FALSE; + } } -// cria uma extensao da classe base +// Instancia objeto de página $pagina = new clsIndexBase(); -// cria o conteudo + +// Instancia objeto de conteúdo $miolo = new indice(); -// adiciona o conteudo na clsBase -$pagina->addForm( $miolo ); -// gera o html -$pagina->MakeAll(); +// Atribui o conteúdo à página +$pagina->addForm($miolo); +// Gera o código HTML +$pagina->MakeAll(); ?> - \ No newline at end of file diff --git a/ieducar/intranet/educar_relatorio_diario_classe_temp_proc.php b/ieducar/intranet/educar_relatorio_diario_classe_temp_proc.php index 8b9b74a..d0ce390 100644 --- a/ieducar/intranet/educar_relatorio_diario_classe_temp_proc.php +++ b/ieducar/intranet/educar_relatorio_diario_classe_temp_proc.php @@ -1,6 +1,6 @@ - * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL - * @package Core - * @subpackage Relatório - * @since Arquivo disponível desde a versão 1.0.0 - * @version $Id$ + * @author Prefeitura Municipal de Itajaí + * @category i-Educar + * @license @@license@@ + * @package iEd_Pmieducar + * @since Arquivo disponível desde a versão 1.0.0 + * @version $Id$ */ require_once 'include/clsBase.inc.php'; @@ -38,619 +34,604 @@ require_once 'include/clsBanco.inc.php'; require_once 'include/pmieducar/geral.inc.php'; require_once 'include/clsPDF.inc.php'; - +/** + * clsIndexBase class. + * + * @author Prefeitura Municipal de Itajaí + * @category i-Educar + * @license @@license@@ + * @package iEd_Pmieducar + * @since Classe disponível desde a versão 1.0.0 + * @version @@package_version@@ + */ class clsIndexBase extends clsBase { - function Formular() - { - $this->SetTitulo( "{$this->_instituicao} i-Educar - Diário de Classe" ); - $this->processoAp = "927"; - $this->renderMenu = false; - $this->renderMenuSuspenso = false; - } + function Formular() + { + $this->SetTitulo($this->_instituicao . ' i-Educar - Diário de Classe'); + $this->processoAp = 927; + $this->renderMenu = FALSE; + $this->renderMenuSuspenso = FALSE; + } } +/** + * indice class. + * + * @author Prefeitura Municipal de Itajaí + * @category i-Educar + * @license @@license@@ + * @package iEd_Pmieducar + * @since Classe disponível desde a versão 1.0.0 + * @version @@package_version@@ + */ class indice extends clsCadastro { + var $pessoa_logada; + + var $ref_cod_instituicao; + var $ref_cod_escola; + var $ref_cod_serie; + var $ref_cod_turma; + + var $ano; + var $mes; + var $mes_inicial; + var $mes_final; + + var $nm_escola; + var $nm_instituicao; + var $ref_cod_curso; + var $sequencial; + var $pdf; + var $pagina_atual = 1; + var $total_paginas = 1; + var $nm_professor; + var $nm_turma; + var $nm_serie; + var $nm_disciplina; + + var $numero_registros; + var $em_branco; + + var $page_y = 125; + + var $get_file; + + var $cursos = array(); + + var $get_link; + + var $total; + + var $ref_cod_modulo; + var $data_ini,$data_fim; + + var $z = 0; + + var $meses_do_ano = array( + 1 => 'JANEIRO', + 2 => 'FEVEREIRO', + 3 => 'MARÇO', + 4 => 'ABRIL', + 5 => 'MAIO', + 6 => 'JUNHO', + 7 => 'JULHO', + 8 => 'AGOSTO', + 9 => 'SETEMBRO', + 10 => 'OUTUBRO', + 11 => 'NOVEMBRO', + 12 => 'DEZEMBRO' + ); + + var $indefinido; + + 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; + } - /** - * Referencia pega da session para o idpes do usuario atual - * - * @var int - */ - var $pessoa_logada; - - - var $ref_cod_instituicao; - var $ref_cod_escola; - var $ref_cod_serie; - var $ref_cod_turma; - - var $ano; - var $mes; - var $mes_inicial; - var $mes_final; - - var $nm_escola; - var $nm_instituicao; - var $ref_cod_curso; - var $sequencial; - var $pdf; - var $pagina_atual = 1; - var $total_paginas = 1; - var $nm_professor; - var $nm_turma; - var $nm_serie; - var $nm_disciplina; - - var $numero_registros; - var $em_branco; - - var $page_y = 125; - - var $get_file; - - var $cursos = array(); - - var $get_link; - - var $total; - - var $ref_cod_modulo; - var $data_ini,$data_fim; - - var $z=0; - - var $meses_do_ano = array( - "1" => "JANEIRO" - ,"2" => "FEVEREIRO" - ,"3" => "MARÇO" - ,"4" => "ABRIL" - ,"5" => "MAIO" - ,"6" => "JUNHO" - ,"7" => "JULHO" - ,"8" => "AGOSTO" - ,"9" => "SETEMBRO" - ,"10" => "OUTUBRO" - ,"11" => "NOVEMBRO" - ,"12" => "DEZEMBRO" - ); - - var $indefinido; - - 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(empty($this->ref_cod_turma)) - { - echo ''; - 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']; - - $obj_pessoa = new clsPessoa_($det_turma["ref_cod_regente"]); - $det = $obj_pessoa->detalhe(); - $this->nm_professor = $det["nome"]; - - if(!$lista_calendario) - { - echo ''; - 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(); - - if($det_curso['falta_ch_globalizada']) - { - /** - * numero de semanas dos meses - */ - $db = new clsBanco(); - $consulta = "SELECT padrao_ano_escolar FROM pmieducar.curso WHERE cod_curso = {$this->ref_cod_curso}"; - $padrao_ano_escolar = $db->CampoUnico($consulta); - $total_semanas = 0; - if($padrao_ano_escolar) - { - $meses = $db->CampoUnico( " - SELECT to_char(data_inicio,'dd/mm') || '-' || to_char(data_fim,'dd/mm') - FROM - pmieducar.ano_letivo_modulo - ,pmieducar.modulo - WHERE modulo.cod_modulo = ano_letivo_modulo.ref_cod_modulo - AND modulo.ativo = 1 - AND ano_letivo_modulo.ref_cod_modulo = $this->ref_cod_modulo - AND ano_letivo_modulo.sequencial = $this->sequencial - AND ref_ano = $this->ano - AND ref_ref_cod_escola = '{$this->ref_cod_escola}' - ORDER BY - data_inicio,data_fim ASC - "); - $data = explode("-",$meses); - - if(!$this->data_ini) - $this->data_ini = $data[0]; - - if(!$this->data_fim) - $this->data_fim = $data[1]; - - $data_ini = explode("/",$data[0]); - $data_fim = explode("/",$data[1]); - - $meses = array($data_ini[1],$data_fim[1]); - $dias = array($data_ini[0],$data_fim[0]); - $total_semanas = 0; - - for($mes = (int)$meses[0];$mes<=(int)$meses[1];$mes++) - { - $mes_final = false; - if($mes == (int)$meses[0]) - $dia = $dias[0]; - elseif ($mes == (int)$meses[1]) - { - $dia = $dias[1]; - $mes_final = true; - } - else - $dia = 1; - - $total_semanas += $this->getNumeroDiasMes($dia,$mes,$this->ano,$mes_final);//,$lista_quadro_horarios[count($lista_quadro_horarios)-1]); - -// echo $total_semanas; -// die("###"); - } - //$total_semanas += $this->getNumeroDiasMes($this->mes + 1,$this->ano);//,$lista_quadro_horarios[count($lista_quadro_horarios)-1]); - } - else - { - $meses = $db->CampoUnico( " - SELECT to_char(data_inicio,'dd/mm') || '-' || to_char(data_fim,'dd/mm') - FROM - pmieducar.turma_modulo - ,pmieducar.modulo - WHERE modulo.cod_modulo = turma_modulo.ref_cod_modulo - AND ref_cod_turma = '{$this->ref_cod_turma}' - AND turma_modulo.ref_cod_modulo = $this->ref_cod_modulo - AND turma_modulo.sequencial = $this->sequencial - AND to_char(data_inicio,'yyyy') = $this->ano - ORDER BY - data_inicio,data_fim ASC - - "); - - $total_semanas = 0; - - $data = explode("-",$meses); - - if(!$this->data_ini) - $this->data_ini = $data[0]; - - if(!$this->data_fim) - $this->data_fim = $data[1]; - - $data_ini = explode("/",$data[0]); - $data_fim = explode("/",$data[1]); - - $meses = array($data_ini[1],$data_fim[1]); - $dias = array($data_ini[0],$data_fim[0]); - $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 = 1; - $mes_final = true; - } - else - $dia = 1; - $total_semanas += $this->getNumeroDiasMes($dia,$mes,$this->ano,$mes_final); - //**************************************************30032007/\ - } - - - } - - $this->pdf = new clsPDF("Diário de Classe - {$this->ano}", "Diário de Classe - {$data[0]} até {$data[1]} de {$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;//$total_semanas * count($lista_quadro_horarios); - - - if(!$this->em_branco) - { - $obj_matricula_turma = new clsPmieducarMatriculaTurma(); - $obj_matricula_turma->setOrderby("nome_ascii"); - $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,array(1,2,3),null,null,$this->ano,null,true,null,null,true); - } - - if($lista_matricula || $this->em_branco) - { - $this->pdf->OpenPage(); - $this->addCabecalho(); - - 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[] = ''; - } - } - - $num = 0; - foreach ($lista_matricula as $matricula) - { - - $num++; - - if($this->page_y > 500) - { - $this->desenhaLinhasVertical(); - $this->pdf->ClosePage(); - $this->pdf->OpenPage(); - $this->page_y = 125; - $this->addCabecalho(); - - - } - - - $this->pdf->quadrado_relativo( 30, $this->page_y , 782, 19); - $this->pdf->escreve_relativo($matricula['nome_aluno'] , 33 ,$this->page_y + 4,160, 15, $fonte, 7, $corTexto, 'left' ); - $this->pdf->escreve_relativo( sprintf("%02d",$num),757, $this->page_y + 4, 30, 30, $fonte, 7, $corTexto, 'left' ); - - $this->page_y +=19; - - - - } - - $this->desenhaLinhasVertical(); - - $this->rodape(); - $this->pdf->ClosePage(); - } - else - { - - echo ''; - - return; - } - - - //header( "location: " . $this->pdf->GetLink() ); - $this->pdf->CloseFile(); - $this->get_link = $this->pdf->GetLink(); - } - else - { - /** - * CARGA HORARIA NAO GLOBALIZADA - * GERAR UMA PAGINA PARA CADA DISICIPLINA - */ - //$obj_turma_disc = new clsPmieducarTurmaDisciplina(); - $obj_turma_disc = new clsPmieducarDisciplinaSerie(); - $obj_turma_disc->setCamposLista("ref_cod_disciplina"); - $lst_turma_disc = $obj_turma_disc->lista(null,$this->ref_cod_serie,1); - if($lst_turma_disc) - { - $this->indefinido = false; - $this->pdf = new clsPDF("Diário de Classe - {$this->ano}", "Diário de Classe - {$this->data_ini} até {$this->data_fim} de {$this->ano}", "A4", "", false, false); - foreach ($lst_turma_disc as $disciplina) - { - $obj_disc = new clsPmieducarDisciplina($disciplina); - $det_disc = $obj_disc->detalhe(); - $this->nm_disciplina = $det_disc['nm_disciplina']; - $this->page_y = 125; - - /** - * numero 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); -// if(!$quadro_horario) -// { -// echo ''; -// 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,$disciplina,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1); - -// die("


{$quadro_horario[0]},$this->ref_cod_serie,$this->ref_cod_escola,$disciplina"); - -// if(!$lista_quadro_horarios) -// { - //echo ''; - //die(); -// continue; -// } - $db = new clsBanco(); - $consulta = "SELECT padrao_ano_escolar FROM pmieducar.curso WHERE cod_curso = {$this->ref_cod_curso}"; - $padrao_ano_escolar = $db->CampoUnico($consulta); - - $total_semanas = 0; - if($padrao_ano_escolar) - { - $meses = $db->CampoUnico( " - SELECT to_char(data_inicio,'dd/mm') || '-' || to_char(data_fim,'dd/mm') - FROM - pmieducar.ano_letivo_modulo - ,pmieducar.modulo - WHERE modulo.cod_modulo = ano_letivo_modulo.ref_cod_modulo - AND modulo.ativo = 1 - AND ano_letivo_modulo.ref_cod_modulo = $this->ref_cod_modulo - AND ano_letivo_modulo.sequencial = $this->sequencial - AND ref_ano = $this->ano - AND ref_ref_cod_escola = '{$this->ref_cod_escola}' - ORDER BY - data_inicio,data_fim ASC - "); - $data = explode("-",$meses); - - if(!$this->data_ini) - $this->data_ini = $data[0]; - - if(!$this->data_fim) - $this->data_fim = $data[1]; - - $data_ini = explode("/",$data[0]); - $data_fim = explode("/",$data[1]); - - $meses = array($data_ini[1],$data_fim[1]); - $dias = array($data_ini[0],$data_fim[0]); - //for($mes = $meses[0];$mes<=$meses[1];$mes++) - // $total_semanas = $this->getNumeroDiasMes($mes,$this->ano);//,$lista_quadro_horarios[count($lista_quadro_horarios)-1]); - //$total_semanas += $this->getNumeroDiasMes($this->mes + 1,$this->ano);//,$lista_quadro_horarios[count($lista_quadro_horarios)-1]); - } - else - { - $meses = $db->CampoUnico( " - SELECT to_char(data_inicio,'mm') || '-' || to_char(data_fim,'mm') - FROM - pmieducar.turma_modulo - ,pmieducar.modulo - WHERE modulo.cod_modulo = turma_modulo.ref_cod_modulo - AND ref_cod_turma = '{$this->ref_cod_turma}' - AND turma_modulo.ref_cod_modulo = $this->ref_cod_modulo - AND turma_modulo.sequencial = $this->sequencial - AND to_char(data_inicio,'yyyy') = $this->ano - ORDER BY - data_inicio,data_fim ASC - - "); - - $data = explode("-",$meses); - - if(!$this->data_ini) - $this->data_ini = $data[0]; - - if(!$this->data_fim) - $this->data_fim = $data[1]; - - $data_ini = explode("/",$data[0]); - $data_fim = explode("/",$data[1]); - - - $meses = array($data_ini[1],$data_fim[1]); - $dias = array($data_ini[0],$data_fim[0]); - - //for($mes = $meses[0];$mes<=$meses[1];$mes++) - // $total_semanas = $this->getNumeroDiasMes($mes,$this->ano); - } - - $total_dias_semanas = 0; - //$total_semanas = $this->getNumeroSemanasMes($this->mes,$this->ano,$lista_quadro_horarios[0],$lista_quadro_horarios[count($lista_quadro_horarios)-1]); - //$total_semanas = $this->getNumeroSemanasMes($this->mes + 1,$this->ano,$lista_quadro_horarios[0],$lista_quadro_horarios[count($lista_quadro_horarios)-1]); - if($lista_quadro_horarios) { - - for($mes_ = $meses[0];$mes_<=$meses[1];$mes_++) - { - - $mes_final = false; - - foreach ($lista_quadro_horarios as $dia_semana) - { - if($mes_ == $meses[0]) // Last Change -> $mes to $mes_ - $dia = $dias[0]; - elseif ($mes == $meses[1]) - { - $dia = 1;//$dias[1]; - $mes_final = true; - } - else - $dia = 1; - $total_dias_semanas += $this->getDiasSemanaMes($dia, $mes_,$this->ano,$dia_semana,$mes_final); - } - } - } else { - $total_dias_semanas = 30; - $this->indefinido = true; - } - $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_dias_semanas; - - if(!$this->total) - break; - - if(!$this->em_branco) - { - $obj_matricula_turma = new clsPmieducarMatriculaTurma(); - $obj_matricula_turma->setOrderby("nome_ascii"); - $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,array( 1, 2, 3 ),null,null,$this->ano,null,true,null,null,true); - } - - - if($lista_matricula || $this->em_branco) - { - $this->pdf->OpenPage(); - $this->addCabecalho(); - - 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[] = ''; - } - } - - - $num = 0; - foreach ($lista_matricula as $matricula) - { - $num++; - - if($this->page_y > 500) - { - $this->desenhaLinhasVertical(); - $this->pdf->ClosePage(); - $this->pdf->OpenPage(); - $this->page_y = 125; - $this->addCabecalho(); - + $fonte = 'arial'; + $corTexto = '#000000'; - } + if (empty($this->ref_cod_turma)) { + echo ' + '; - //$obj_matricula = new clsPmieducarMatricula($matricula['ref_cod_matricula']); - //$det_matricula = $obj_matricula->detalhe(); + return TRUE; + } + $modulo_sequencial = explode('-', $this->ref_cod_modulo); + $this->ref_cod_modulo = $modulo_sequencial[0]; + $this->sequencial = $modulo_sequencial[1]; - //$obj_aluno = new clsPmieducarAluno(); - //$det_aluno = array_shift($obj_aluno->lista($matricula['ref_cod_aluno'])); + if ($this->ref_cod_escola) { + $obj_escola = new clsPmieducarEscola($this->ref_cod_escola); + $det_escola = $obj_escola->detalhe(); + $this->nm_escola = $det_escola['nome']; - $this->pdf->quadrado_relativo( 30, $this->page_y , 782, 19); - $this->pdf->escreve_relativo($matricula['nome_aluno'] , 33 ,$this->page_y + 4,160, 15, $fonte, 7, $corTexto, 'left' ); - $this->pdf->escreve_relativo( sprintf("%02d",$num),757, $this->page_y + 4, 30, 30, $fonte, 7, $corTexto, 'left' ); + $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']); + $det_instituicao = $obj_instituicao->detalhe(); + $this->nm_instituicao = $det_instituicao['nm_instituicao']; + } - $this->page_y +=19; + $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']; - } - $this->desenhaLinhasVertical(); - //$this->rodape(); - $this->pdf->ClosePage(); - } - else - { - - - echo ''; - - return; - } - - - } - /** - * gera diario de clase de avaliacoes - */ - - } - + $obj_pessoa = new clsPessoa_($det_turma["ref_cod_regente"]); + $det = $obj_pessoa->detalhe(); + $this->nm_professor = $det["nome"]; - //header( "location: " . $this->pdf->GetLink() ); -// $this->pdf->CloseFile(); -// $this->get_link = $this->pdf->GetLink(); - if($this->total) - { - $this->pdf->CloseFile(); - $this->get_link = $this->pdf->GetLink(); - } - else - { - $this->mensagem = "Não existem dias letivos cadastrados para esta turma"; - } - } - echo ""; + if (!$lista_calendario) { + echo ' + '; + return TRUE; + } - echo "
Se o download não iniciar automaticamente
clique aqui!

- Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.
+ $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(); + + if ($det_curso['falta_ch_globalizada']) { + /** + * numero de semanas dos meses + */ + $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) { + $meses = $db->CampoUnico(sprintf(" + SELECT + to_char(data_inicio,'dd/mm') || '-' || to_char(data_fim,'dd/mm') + FROM + pmieducar.ano_letivo_modulo, + pmieducar.modulo + WHERE + modulo.cod_modulo = ano_letivo_modulo.ref_cod_modulo + AND modulo.ativo = 1 + AND ano_letivo_modulo.ref_cod_modulo = %d + AND ano_letivo_modulo.sequencial = %d + AND ref_ano = + AND ref_ref_cod_escola = %d + ORDER BY + data_inicio, + data_fim ASC + ", $this->ref_cod_modulo, $this->sequencial, $this->ano, $this->ref_cod_escola)); + + $data = explode('-', $meses); + + if (!$this->data_ini) { + $this->data_ini = $data[0]; + } + + if (!$this->data_fim) { + $this->data_fim = $data[1]; + } + + $data_ini = explode('/', $data[0]); + $data_fim = explode('/', $data[1]); + + $meses = array($data_ini[1], $data_fim[1]); + $dias = array($data_ini[0], $data_fim[0]); + + $total_semanas = 0; + + for ($mes = (int)$meses[0]; $mes <= (int)$meses[1]; $mes++) { + $mes_final = FALSE; + + if ($mes == (int)$meses[0]) { + $dia = $dias[0]; + } + elseif ($mes == (int)$meses[1]) { + $dia = $dias[1]; + $mes_final = TRUE; + } + else { + $dia = 1; + } + + $total_semanas += $this->getNumeroDiasMes($dia, $mes, $this->ano, $mes_final); + } + } + else { + $meses = $db->CampoUnico(sprintf(" + SELECT + to_char(data_inicio,'dd/mm') || '-' || to_char(data_fim,'dd/mm') + FROM + pmieducar.turma_modulo, + pmieducar.modulo + WHERE + modulo.cod_modulo = turma_modulo.ref_cod_modulo + AND ref_cod_turma = %d + AND turma_modulo.ref_cod_modulo = %d + AND turma_modulo.sequencial = + AND to_char(data_inicio,'yyyy') = %d + ORDER BY + data_inicio, + data_fim ASC + ", $this->ref_cod_turma, $this->ref_cod_modulo, $this->sequencial, $this->ano)); + + $total_semanas = 0; + + $data = explode('-', $meses); + + if (!$this->data_ini) { + $this->data_ini = $data[0]; + } + + if (!$this->data_fim) { + $this->data_fim = $data[1]; + } + + $data_ini = explode('/', $data[0]); + $data_fim = explode('/', $data[1]); + + $meses = array($data_ini[1], $data_fim[1]); + $dias = array($data_ini[0], $data_fim[0]); + + $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 = 1; + $mes_final = TRUE; + } + else { + $dia = 1; + } + + $total_semanas += $this->getNumeroDiasMes($dia, $mes, $this->ano, $mes_final); + } + } + + $this->pdf = new clsPDF('Diário de Classe - ' . $this->ano, + sprintf('Diário de Classe - %s até %s de %d', $data[0], $data[1], $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'); + + $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, array(1,2,3), NULL, NULL, $this->ano, NULL, TRUE, NULL, NULL, TRUE); + } + + if ($lista_matricula || $this->em_branco) { + $this->pdf->OpenPage(); + $this->addCabecalho(); + + 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[] = ''; + } + } + + $num = 0; + foreach ($lista_matricula as $matricula) { + $num++; + + if ($this->page_y > 500) { + $this->desenhaLinhasVertical(); + $this->pdf->ClosePage(); + $this->pdf->OpenPage(); + $this->page_y = 125; + $this->addCabecalho(); + } + + $this->pdf->quadrado_relativo(30, $this->page_y, 782, 19); + + $this->pdf->escreve_relativo($matricula['nome_aluno'], 33, + $this->page_y + 4, 160, 15, $fonte, 7, $corTexto, 'left'); + + $this->pdf->escreve_relativo(sprintf('%02d', $num), 757, $this->page_y + 4, + 30, 30, $fonte, 7, $corTexto, 'left'); + + $this->page_y +=19; + } + + $this->desenhaLinhasVertical(); + + $this->rodape(); + $this->pdf->ClosePage(); + } + else { + echo ' + '; + + return; + } + + $this->pdf->CloseFile(); + $this->get_link = $this->pdf->GetLink(); + } + else + { + // Carga horária não globalizada gera uma página por disciplina + $obj_turma_disc = new clsPmieducarDisciplinaSerie(); + $obj_turma_disc->setCamposLista("ref_cod_disciplina"); + $lst_turma_disc = $obj_turma_disc->lista(null,$this->ref_cod_serie,1); + + if ($lst_turma_disc) { + $this->indefinido = FALSE; + + $this->pdf = new clsPDF('Diário de Classe - ' . $this->ano, + sprintf('Diário de Classe - %s até %s de %d', $this->data_ini, $this->data_fim, $this->ano), + 'A4', '', FALSE, FALSE + ); + + foreach ($lst_turma_disc as $disciplina) { + $obj_disc = new clsPmieducarDisciplina($disciplina); + $det_disc = $obj_disc->detalhe(); + $this->nm_disciplina = $det_disc['nm_disciplina']; + $this->page_y = 125; + + $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) { + $meses = $db->CampoUnico(sprintf(" + SELECT + to_char(data_inicio,'dd/mm') || '-' || to_char(data_fim,'dd/mm') + FROM + pmieducar.ano_letivo_modulo, + pmieducar.modulo + WHERE + modulo.cod_modulo = ano_letivo_modulo.ref_cod_modulo + AND modulo.ativo = 1 + AND ano_letivo_modulo.ref_cod_modulo = %d + AND ano_letivo_modulo.sequencial = %d + AND ref_ano = %d + AND ref_ref_cod_escola = %d + ORDER BY + data_inicio, + data_fim ASC + ", $this->ref_cod_modulo, $this->sequencial, $this->ano, $this->ref_cod_escola)); + + $data = explode('-', $meses); + + if (!$this->data_ini) { + $this->data_ini = $data[0]; + } + + if (!$this->data_fim) { + $this->data_fim = $data[1]; + } + + $data_ini = explode('/', $data[0]); + $data_fim = explode('/', $data[1]); + + $meses = array($data_ini[1], $data_fim[1]); + $dias = array($data_ini[0], $data_fim[0]); + } + else { + $meses = $db->CampoUnico( " + SELECT + to_char(data_inicio,'mm') || '-' || to_char(data_fim,'mm') + FROM + pmieducar.turma_modulo, + pmieducar.modulo + WHERE + modulo.cod_modulo = turma_modulo.ref_cod_modulo + AND ref_cod_turma = %d + AND turma_modulo.ref_cod_modulo = %d + AND turma_modulo.sequencial = %d + AND to_char(data_inicio,'yyyy') = %d + ORDER BY + data_inicio, + data_fim ASC + ", $this->ref_cod_turma, $this->ref_cod_modulo, $this->sequencial, $this->ano); + + $data = explode('-', $meses); + + if (!$this->data_ini) { + $this->data_ini = $data[0]; + } + + if (!$this->data_fim) { + $this->data_fim = $data[1]; + } + + $data_ini = explode('/', $data[0]); + $data_fim = explode('/', $data[1]); + + $meses = array($data_ini[1], $data_fim[1]); + $dias = array($data_ini[0], $data_fim[0]); + } + + $total_dias_semanas = 0; + + if ($lista_quadro_horarios) { + for ($mes_ = $meses[0]; $mes_ <= $meses[1]; $mes_++) { + $mes_final = FALSE; + + foreach ($lista_quadro_horarios as $dia_semana) { + if ($mes_ == $meses[0]) { + $dia = $dias[0]; + } + elseif ($mes == $meses[1]) { + $dia = 1; + $mes_final = TRUE; + } + else { + $dia = 1; + } + + $total_dias_semanas += $this->getDiasSemanaMes($dia, $mes_, + $this->ano,$dia_semana,$mes_final); + } + } + } + else { + $total_dias_semanas = 30; + $this->indefinido = TRUE; + } + + $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_dias_semanas; + + if (!$this->total) { + break; + } + + if(!$this->em_branco) { + $obj_matricula_turma = new clsPmieducarMatriculaTurma(); + $obj_matricula_turma->setOrderby('nome_ascii'); + + $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, array(1, 2, 3), NULL, NULL, $this->ano, NULL, TRUE, NULL, + NULL, TRUE + ); + } + + if ($lista_matricula || $this->em_branco) { + $this->pdf->OpenPage(); + $this->addCabecalho(); + + 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[] = ''; + } + } + + $num = 0; + + foreach ($lista_matricula as $matricula) { + $num++; + + if ($this->page_y > 500) { + $this->desenhaLinhasVertical(); + $this->pdf->ClosePage(); + $this->pdf->OpenPage(); + $this->page_y = 125; + $this->addCabecalho(); + } + + $this->pdf->quadrado_relativo(30, $this->page_y , 782, 19); + + $this->pdf->escreve_relativo($matricula['nome_aluno'], 33, + $this->page_y + 4, 160, 15, $fonte, 7, $corTexto, 'left'); + + $this->pdf->escreve_relativo(sprintf('%02d', $num), 757, + $this->page_y + 4, 30, 30, $fonte, 7, $corTexto, 'left'); + + $this->page_y += 19; + } + + $this->desenhaLinhasVertical(); + $this->pdf->ClosePage(); + } + else { + echo ' + '; + + return; + } + } + } + + if ($this->total) { + $this->pdf->CloseFile(); + $this->get_link = $this->pdf->GetLink(); + } + else { + $this->mensagem = "Não existem dias letivos cadastrados para esta turma"; + } + } - Clique na Imagem para Baixar o instalador

-
-
-
"; - } + echo sprintf(' + ', $this->get_link); + + echo sprintf(' + +
+ Se o download não iniciar automaticamente
clique aqui!

+ Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.
+ Clique na Imagem para Baixar o instalador

+
+
+
+ ', $this->get_link); + } public function addCabecalho() { @@ -676,254 +657,261 @@ class indice extends clsCadastro // Título principal $titulo = $config->get($config->titulo, 'i-Educar'); + $this->pdf->escreve_relativo($titulo, 30, 30, 782, 80, $fonte, 18, - $corTexto, 'center' ); - $this->pdf->escreve_relativo(date("d/m/Y"), 25, 30, 782, 80, $fonte, 10, + $corTexto, 'center'); + + $this->pdf->escreve_relativo(date('d/m/Y'), 25, 30, 782, 80, $fonte, 10, $corTexto, 'right'); // Dados escola - $this->pdf->escreve_relativo("Instituição:$this->nm_instituicao", 120, 52, - 300, 80, $fonte, 7, $corTexto, 'left' ); - $this->pdf->escreve_relativo("Escola:{$this->nm_escola}",132, 64, 300, 80, + $this->pdf->escreve_relativo('Instituição: ' . $this->nm_instituicao, 120, 52, + 300, 80, $fonte, 7, $corTexto, 'left'); + + $this->pdf->escreve_relativo('Escola: ' . $this->nm_escola,132, 64, 300, 80, $fonte, 7, $corTexto, 'left' ); $dif = 0; if ($this->nm_professor) { - $this->pdf->escreve_relativo("Prof.Regente:{$this->nm_professor}",111, 76, 300, 80, $fonte, 7, $corTexto, 'left' ); + $this->pdf->escreve_relativo('Prof. Regente: ' . $this->nm_professor,111, + 76, 300, 80, $fonte, 7, $corTexto, 'left'); } else { $dif = 12; } - $this->pdf->escreve_relativo("Série:{$this->nm_serie}",138, 88 - $dif, 300, + $this->pdf->escreve_relativo('Série: ' . $this->nm_serie, 138, 88 - $dif, 300, 80, $fonte, 7, $corTexto, 'left'); - $this->pdf->escreve_relativo("Turma:{$this->nm_turma}",134, 100 - $dif, 300, + + $this->pdf->escreve_relativo('Turma: ' . $this->nm_turma, 134, 100 - $dif, 300, 80, $fonte, 7, $corTexto, 'left'); // Título - $nm_disciplina = ""; + $nm_disciplina = ''; if ($this->nm_disciplina) { - $nm_disciplina = " - $this->nm_disciplina"; + $nm_disciplina = ' - ' . $this->nm_disciplina; } - $this->pdf->escreve_relativo("Diário de Frequência {$nm_disciplina}", 30, + $this->pdf->escreve_relativo('Diário de Frequência ' . $nm_disciplina, 30, 75, 782, 80, $fonte, 12, $corTexto, 'center'); $obj_modulo = new clsPmieducarModulo($this->ref_cod_modulo); $det_modulo = $obj_modulo->detalhe(); // Data - $this->pdf->escreve_relativo( "{$this->data_ini} até {$this->data_fim} de {$this->ano}", - 45, 100, 782, 80, $fonte, 10, $corTexto, 'center'); + $this->pdf->escreve_relativo(sprintf("%s até %s de %d", $this->data_ini, + $this->data_fim, $this->ano), 45, 100, 782, 80, $fonte, 10, $corTexto, 'center'); - $this->pdf->linha_relativa(201,125,612,0); - $this->page_y +=19; + $this->pdf->linha_relativa(201, 125, 612, 0); + $this->page_y += 19; if ($this->indefinido) { - $this->pdf->escreve_relativo("Dias de aula: Indefinido", 680, 100, 535, + $this->pdf->escreve_relativo('Dias de aula: Indefinido', 680, 100, 535, 80, $fonte, 10, $corTexto, 'left' ); } else { - $this->pdf->escreve_relativo("Dias de aula: {$this->total}", 715, 100, + $this->pdf->escreve_relativo('Dias de aula: ' . $this->total, 715, 100, 535, 80, $fonte, 10, $corTexto, 'left'); } } + function desenhaLinhasVertical() + { + $corTexto = '#000000'; + $largura_anos = 550; + + if ($this->total >= 1) { + $incremental = floor($largura_anos / ($this->total + 1)) ; + } + else { + $incremental = 1; + } + + $reta_ano_x = 200 ; + + $resto = $largura_anos - ($incremental * $this->total); + + for ($linha = 0; $linha < $this->total + 1; $linha++) { + if (($resto > 0) || $linha == 0) { + $reta_ano_x++; + $resto--; + } + + $this->pdf->linha_relativa($reta_ano_x, 125, 0, $this->page_y - 125); + + $reta_ano_x += $incremental; + } - function desenhaLinhasVertical() - { - $corTexto = '#000000'; - /** - * - */ - //612 - $largura_anos = 550; + $this->pdf->linha_relativa(812, 125, 0, $this->page_y - 125); - if($this->total >= 1) - { + $this->pdf->escreve_relativo('Nº:', 755, 128, 100, 80, $fonte, 7, $corTexto, 'left'); - $incremental = floor($largura_anos/ ($this->total +1)) ; + $this->pdf->linha_relativa(775, 125, 0, $this->page_y - 125); - }else { + $this->pdf->escreve_relativo('Faltas', 783, 128, 100, 80, $fonte, 7, $corTexto, 'left'); - $incremental = 1; - } - - $reta_ano_x = 200 ; - - - $resto = $largura_anos - ($incremental * $this->total); - - for($linha = 0;$linha <$this->total+1;$linha++) - { - - if(( $resto > 0) /*|| ($linha + 1 == $total && $resto >= 1) */|| $linha == 0) - { - $reta_ano_x++; - $resto--; - } - - $this->pdf->linha_relativa($reta_ano_x,125,0,$this->page_y - 125); - - $reta_ano_x += $incremental; - - } - - $this->pdf->linha_relativa(812,125,0,$this->page_y - 125); - - $this->pdf->escreve_relativo( "Nº:",755, 128, 100, 80, $fonte, 7, $corTexto, 'left' ); - $this->pdf->linha_relativa(775,125,0,$this->page_y - 125); - $this->pdf->escreve_relativo( "Faltas",783, 128, 100, 80, $fonte, 7, $corTexto, 'left' ); - - $this->rodape(); - $this->pdf->ClosePage(); - $this->pdf->OpenPage(); - $this->page_y = 125; - $this->addCabecalho(); + $this->rodape(); + $this->pdf->ClosePage(); + $this->pdf->OpenPage(); + $this->page_y = 125; + $this->addCabecalho(); - for($ct = 125;$ct < 500;$ct += 19) - { - $this->pdf->quadrado_relativo( 30, $ct , 782, 19); - } - $this->pdf->escreve_relativo( "Observações",30, 130, 782, 30, $fonte, 7, $corTexto, 'center' ); - $this->pdf->linha_relativa(418,144,0,360); - - /** - * - */ - } - - function rodape() - { - $corTexto = '#000000'; - $fonte = 'arial'; - $dataAtual = date("d/m/Y"); - $this->pdf->escreve_relativo( "Data: $dataAtual", 36,795, 100, 50, $fonte, 7, $corTexto, 'left' ); - - //$this->pdf->escreve_relativo( "Assinatura do Diretor(a)", 68,520, 100, 50, $fonte, 7, $corTexto, 'left' ); - $this->pdf->escreve_relativo( "Assinatura do Professor(a)", 695,520, 100, 50, $fonte, 7, $corTexto, 'left' ); - //$this->pdf->linha_relativa(52,517,130,0); - $this->pdf->linha_relativa(660,517,130,0); - } - - function Editar() - { - return false; - } - - function Excluir() - { - return false; - } - - - //function getNumeroSemanasMes($mes,$ano,$primeiro_dia_semana = null,$ultimo_dia_semana = null) - function getNumeroDiasMes($dia,$mes,$ano,$mes_final = false) - { - $year = $ano; - $month = $mes; - - $date = mktime(1, 1, 1, $month, $dia/*date("d")*/, $year); - - $first_day_of_month = strtotime("-" . (date("d", $date)-1) . " days", $date); - $last_day_of_month = strtotime("+" . (date("t", $first_day_of_month)-1) . " days", $first_day_of_month); - - //$first_week_day = date("l", $first_day_of_month); - $last_day_of_month = date("d", $last_day_of_month); - - $numero_dias = 0; - /** - * verifica se dia eh feriado - */ - $obj_calendario = new clsPmieducarCalendarioAnoLetivo(); - $obj_calendario->setCamposLista("cod_calendario_ano_letivo"); - $lista = $obj_calendario->lista(null,$this->ref_cod_escola,null,null,$this->ano,null,null,null,null,1); - if($lista) - { - $lista_calendario = array_shift($lista); - } - $obj_dia = new clsPmieducarCalendarioDia(); - $obj_dia->setCamposLista("dia"); - $dias_nao_letivo = $obj_dia->lista($lista_calendario,$mes,null,null,null,null,null,null,null,null,null,null,1,"'n'"); - if(!$dias_nao_letivo) - $dias_nao_letivo = array(); - if($mes_final) - { - $last_day_of_month = $dia; - $dia = 1; - } - for($day = $dia; $day <= $last_day_of_month; $day++) - { - $date = mktime(1, 1, 1, $month, $day, $year); - $dia_semana_corrente = getdate($date); - $dia_semana_corrente = $dia_semana_corrente['wday'] + 1; - - if( ($dia_semana_corrente != 1 && $dia_semana_corrente != 7) && (array_search($day,$dias_nao_letivo) === false)) - $numero_dias++; - } - - - return $numero_dias; - } - - function getDiasSemanaMes($dia,$mes,$ano,$dia_semana,$mes_final = false) - { - $year = $ano; - $month = $mes; - - $date = mktime(1, 1, 1, $month, $dia/*date("d")*/, $year); - - $first_day_of_month = strtotime("-" . (date("d", $date)-1) . " days", $date); - $last_day_of_month = strtotime("+" . (date("t", $first_day_of_month)-1) . " days", $first_day_of_month); - - //$first_week_day = date("l", $first_day_of_month); - $last_day_of_month = date("d", $last_day_of_month); - - $numero_dias = 0; - - - /** - * verifica se dia eh feriado - */ - $obj_calendario = new clsPmieducarCalendarioAnoLetivo(); - $obj_calendario->setCamposLista("cod_calendario_ano_letivo"); - $lista_calendario = $obj_calendario->lista(null,$this->ref_cod_escola,null,null,$this->ano,null,null,null,null,1); - if(is_array($lista_calendario)) - $lista_calendario = array_shift($lista_calendario); - $obj_dia = new clsPmieducarCalendarioDia(); - $obj_dia->setCamposLista("dia"); - $dias_nao_letivo = $obj_dia->lista($lista_calendario,$mes,null,null,null,null,null,null,null,null,null,null,1,"'n'"); - if(!$dias_nao_letivo) - $dias_nao_letivo = array(); - if($mes_final) - { - $last_day_of_month = $dia; - $dia = 1; - } - for($day = $dia; $day <= $last_day_of_month; $day++) - { - $date = mktime(1, 1, 1, $month, $day, $year); - $dia_semana_corrente = getdate($date); - $dia_semana_corrente = $dia_semana_corrente['wday'] + 1; - - $data_atual = "{$day}/{$mes}/{$ano}"; - $data_final = "{$this->data_fim}/{$ano}"; - - if(($dia_semana == $dia_semana_corrente) && (array_search($day,$dias_nao_letivo) === false) && data_maior($data_final, $data_atual)) - $numero_dias++; - } - return $numero_dias; - } + for ($ct = 125; $ct < 500; $ct += 19) { + $this->pdf->quadrado_relativo(30, $ct , 782, 19); + } + + $this->pdf->escreve_relativo('Observações', 30, 130, 782, 30, $fonte, 7, + $corTexto, 'center'); + + $this->pdf->linha_relativa(418, 144, 0, 360); + } + + function rodape() + { + $corTexto = '#000000'; + $fonte = 'arial'; + $dataAtual = date('d/m/Y'); + + $this->pdf->escreve_relativo('Data: ' . $dataAtual, 36, 795, 100, 50, + $fonte, 7, $corTexto, 'left'); + + $this->pdf->escreve_relativo('Assinatura do Professor(a)', 695, 520, 100, 50, + $fonte, 7, $corTexto, 'left'); + + $this->pdf->linha_relativa(660, 517, 130, 0); + } + + function Editar() + { + return FALSE; + } + + function Excluir() + { + return FALSE; + } + + function getNumeroDiasMes($dia, $mes, $ano, $mes_final = FALSE) + { + $year = $ano; + $month = $mes; + + $date = mktime(1, 1, 1, $month, $dia, $year); + + $first_day_of_month = strtotime('-' . (date('d', $date) - 1) . ' days', $date); + $last_day_of_month = strtotime('+' . (date('t', $first_day_of_month) - 1) . ' days', $first_day_of_month); + + $last_day_of_month = date('d', $last_day_of_month); + + $numero_dias = 0; + + // Verifica se é dia não-letivo + $obj_calendario = new clsPmieducarCalendarioAnoLetivo(); + $obj_calendario->setCamposLista('cod_calendario_ano_letivo'); + $lista = $obj_calendario->lista(NULL,$this->ref_cod_escola, NULL, NULL, + $this->ano, NULL, NULL, NULL, NULL, 1); + + if ($lista) { + $lista_calendario = array_shift($lista); + } + + $obj_dia = new clsPmieducarCalendarioDia(); + $obj_dia->setCamposLista('dia'); + $dias_nao_letivo = $obj_dia->lista($lista_calendario, $mes, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 'n'); + + if (!$dias_nao_letivo) { + $dias_nao_letivo = array(); + } + + if ($mes_final) { + $last_day_of_month = $dia; + $dia = 1; + } + + for ($day = $dia; $day <= $last_day_of_month; $day++) { + $date = mktime(1, 1, 1, $month, $day, $year); + $dia_semana_corrente = getdate($date); + $dia_semana_corrente = $dia_semana_corrente['wday'] + 1; + + if (($dia_semana_corrente != 1 && $dia_semana_corrente != 7) && + (array_search($day, $dias_nao_letivo) === FALSE) + ) { + $numero_dias++; + } + } + + return $numero_dias; + } + + function getDiasSemanaMes($dia, $mes, $ano, $dia_semana, $mes_final = FALSE) + { + $year = $ano; + $month = $mes; + + $date = mktime(1, 1, 1, $month, $dia, $year); + + $first_day_of_month = strtotime('-' . (date('d', $date)-1) . ' days', $date); + $last_day_of_month = strtotime('+' . (date('t', $first_day_of_month) - 1) . ' days', $first_day_of_month); + + $last_day_of_month = date('d', $last_day_of_month); + + $numero_dias = 0; + + // Verifica se é dia não-letivo + $obj_calendario = new clsPmieducarCalendarioAnoLetivo(); + $obj_calendario->setCamposLista('cod_calendario_ano_letivo'); + $lista_calendario = $obj_calendario->lista(NULL, $this->ref_cod_escola, NULL, + NULL,$this->ano, NULL, NULL, NULL, NULL, 1); + + if(is_array($lista_calendario)) { + $lista_calendario = array_shift($lista_calendario); + } + + $obj_dia = new clsPmieducarCalendarioDia(); + $obj_dia->setCamposLista('dia'); + + $dias_nao_letivo = $obj_dia->lista($lista_calendario, $mes, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 'n'); + + if (!$dias_nao_letivo) { + $dias_nao_letivo = array(); + } + + if ($mes_final) { + $last_day_of_month = $dia; + $dia = 1; + } + + for($day = $dia; $day <= $last_day_of_month; $day++) { + $date = mktime(1, 1, 1, $month, $day, $year); + $dia_semana_corrente = getdate($date); + $dia_semana_corrente = $dia_semana_corrente['wday'] + 1; + + $data_atual = sprintf('%d/%d/%d', $day, $mes, $ano); + $data_final = sprintf('%s/%d', $this->data_fim); + + if (($dia_semana == $dia_semana_corrente) && + (array_search($day, $dias_nao_letivo) === FALSE) && + data_maior($data_final, $data_atual) + ) { + $numero_dias++; + } + } + + return $numero_dias; + } } -// cria uma extensao da classe base + +// Instancia objeto de página $pagina = new clsIndexBase(); -// cria o conteudo + +// Instancia objeto de conteúdo $miolo = new indice(); -// adiciona o conteudo na clsBase -$pagina->addForm( $miolo ); -// gera o html -$pagina->MakeAll(); +// Atribui o conteúdo à página +$pagina->addForm($miolo); -?> +// Gera o código HTML +$pagina->MakeAll(); \ No newline at end of file -- libgit2 0.21.2