Commit e3d260b6e5124db447625a6141e5d8dc6727b3c8

Authored by Eriksen Costa Paixão
1 parent 09a1d9c4
Exists in master

Refactoring para coding standards

Showing 1 changed file with 1117 additions and 1083 deletions   Show diff stats
ieducar/intranet/educar_relatorio_boletim_proc.php
1 1 <?php
2 2  
3   -/*
  3 +/**
4 4 * i-Educar - Sistema de gestão escolar
5 5 *
6 6 * Copyright (C) 2006 Prefeitura Municipal de Itajaí
... ... @@ -19,17 +19,13 @@
19 19 * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
20 20 * com este programa; se não, escreva para a Free Software Foundation, Inc., no
21 21 * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
22   - */
23   -
24   -/**
25   - * Boletim de aluno.
26 22 *
27   - * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
28   - * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL
29   - * @package Core
30   - * @subpackage Aluno
31   - * @since Arquivo disponível desde a versão 1.0.0
32   - * @version $Id$
  23 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  24 + * @category i-Educar
  25 + * @license @@license@@
  26 + * @package Ied_Pmieducar
  27 + * @since Arquivo disponível desde a versão 1.0.0
  28 + * @version $Id$
33 29 */
34 30  
35 31 require_once 'include/clsBase.inc.php';
... ... @@ -38,966 +34,986 @@ require_once &#39;include/clsBanco.inc.php&#39;;
38 34 require_once 'include/pmieducar/geral.inc.php';
39 35 require_once 'include/clsPDF.inc.php';
40 36  
41   -
  37 +/**
  38 + * clsIndexBase class.
  39 + *
  40 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  41 + * @category i-Educar
  42 + * @license @@license@@
  43 + * @package iEd_Pmieducar
  44 + * @since Classe disponível desde a versão 1.0.0
  45 + * @version @@package_version@@
  46 + */
42 47 class clsIndexBase extends clsBase
43 48 {
44   - function Formular()
45   - {
46   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Boletim" );
47   - $this->processoAp = "664";
48   - $this->renderMenu = false;
49   - $this->renderMenuSuspenso = false;
50   - }
  49 + function Formular()
  50 + {
  51 + $this->SetTitulo($this->_instituicao . ' i-Educar - Boletim');
  52 + $this->processoAp = 664;
  53 + $this->renderMenu = FALSE;
  54 + $this->renderMenuSuspenso = FALSE;
  55 + }
51 56 }
52 57  
  58 +/**
  59 + * indice class.
  60 + *
  61 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  62 + * @category i-Educar
  63 + * @license @@license@@
  64 + * @package iEd_Pmieducar
  65 + * @since Classe disponível desde a versão 1.0.0
  66 + * @version @@package_version@@
  67 + */
53 68 class indice extends clsCadastro
54 69 {
  70 + var $pessoa_logada;
  71 +
  72 + var $ref_cod_instituicao;
  73 + var $ref_cod_escola;
  74 + var $ref_cod_serie;
  75 + var $ref_cod_turma;
  76 +
  77 + var $ano;
  78 + var $mes;
  79 +
  80 + var $nm_escola;
  81 + var $nm_instituicao;
  82 + var $ref_cod_curso;
  83 + var $sequencial;
  84 + var $pdf;
  85 + var $pagina_atual = 1;
  86 + var $total_paginas = 1;
  87 + var $nm_professor;
  88 + var $nm_turma;
  89 + var $nm_serie;
  90 + var $nm_disciplina;
  91 + var $curso_com_exame = 0;
  92 + var $ref_cod_matricula;
  93 +
  94 + var $page_y = 135;
  95 +
  96 + var $nm_aluno;
  97 + var $array_modulos = array();
  98 + var $nm_curso;
  99 + var $get_link = false;
  100 +
  101 + var $total;
  102 +
  103 + var $ref_cod_modulo;
  104 + var $inicio_y;
  105 +
  106 + var $numero_registros;
  107 + var $em_branco;
  108 +
  109 + var $meses_do_ano = array(
  110 + 1 => 'JANEIRO',
  111 + 2 => 'FEVEREIRO',
  112 + 3 => 'MARÇO',
  113 + 4 => 'ABRIL',
  114 + 5 => 'MAIO',
  115 + 6 => 'JUNHO',
  116 + 7 => 'JULHO',
  117 + 8 => 'AGOSTO',
  118 + 9 => 'SETEMBRO',
  119 + 10 => 'OUTUBRO',
  120 + 11 => 'NOVEMBRO',
  121 + 12 => 'DEZEMBRO'
  122 + );
  123 +
  124 + var $segue_padrao_escolar = TRUE;
  125 + var $mostra_cabecalho_modulo = array();
  126 +
  127 + function renderHTML()
  128 + {
  129 + if ($_POST) {
  130 + foreach ($_POST as $key => $value) {
  131 + $this->$key = $value;
  132 + }
  133 + }
55 134  
  135 + @session_start();
  136 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  137 + @session_write_close();
56 138  
57   - /**
58   - * Referencia pega da session para o idpes do usuario atual
59   - *
60   - * @var int
61   - */
62   - var $pessoa_logada;
63   -
64   -
65   - var $ref_cod_instituicao;
66   - var $ref_cod_escola;
67   - var $ref_cod_serie;
68   - var $ref_cod_turma;
69   -
70   - var $ano;
71   - var $mes;
72   -
73   - var $nm_escola;
74   - var $nm_instituicao;
75   - var $ref_cod_curso;
76   - var $sequencial;
77   - var $pdf;
78   - var $pagina_atual = 1;
79   - var $total_paginas = 1;
80   - var $nm_professor;
81   - var $nm_turma;
82   - var $nm_serie;
83   - var $nm_disciplina;
84   - var $curso_com_exame = 0;
85   - var $ref_cod_matricula;
86   -
87   - var $page_y = 135;
88   -
89   -// var $ref_cod_matricula;
90   - var $nm_aluno;
91   - var $array_modulos = array();
92   - var $nm_curso;
93   - var $get_link = false;
94   - //var $cursos = array();
95   -
96   - var $total;
97   -
98   - //var $array_disciplinas = array();
99   -
100   - var $ref_cod_modulo;
101   - var $inicio_y;
102   -
103   - var $numero_registros;
104   - var $em_branco;
105   -
106   - var $meses_do_ano = array(
107   - "1" => "JANEIRO"
108   - ,"2" => "FEVEREIRO"
109   - ,"3" => "MAR&Ccedil;O"
110   - ,"4" => "ABRIL"
111   - ,"5" => "MAIO"
112   - ,"6" => "JUNHO"
113   - ,"7" => "JULHO"
114   - ,"8" => "AGOSTO"
115   - ,"9" => "SETEMBRO"
116   - ,"10" => "OUTUBRO"
117   - ,"11" => "NOVEMBRO"
118   - ,"12" => "DEZEMBRO"
119   - );
120   -
121   - /****************COLOCADO********************************/
122   - var $segue_padrao_escolar = true;
123   - var $mostra_cabecalho_modulo = array();
124   - /****************COLOCADO********************************/
125   -
126   -
127   - function renderHTML()
128   - {
129   -
130   - if($_POST){
131   - foreach ($_POST as $key => $value) {
132   - $this->$key = $value;
133   -
134   - }
135   - }
136   -
137   -
138   - @session_start();
139   - $this->pessoa_logada = $_SESSION['id_pessoa'];
140   - @session_write_close();
141   -
142   -
143   - if($this->ref_ref_cod_serie)
144   - $this->ref_cod_serie = $this->ref_ref_cod_serie;
145   -
146   - $fonte = 'arial';
147   - $corTexto = '#000000';
148   -
149   - if(empty($this->ref_cod_turma) && !$this->em_branco)
150   - {
151   - echo '<script>
152   - alert("Erro ao gerar relatório!\nNenhuma turma selecionada!");
153   - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
154   - </script>';
155   - return true;
156   - }
157   -
158   -
159   - if($this->ref_cod_escola){
160   -
161   - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
162   - $det_escola = $obj_escola->detalhe();
163   - $this->nm_escola = $det_escola['nome'];
164   -
165   - }
166   -
167   - $obj_instituicao = new clsPmieducarInstituicao($this->ref_cod_instituicao);
168   - $det_instituicao = $obj_instituicao->detalhe();
169   - $this->nm_instituicao = $det_instituicao['nm_instituicao'];
170   -
171   - $obj_calendario = new clsPmieducarEscolaAnoLetivo();
172   - $lista_calendario = $obj_calendario->lista($this->ref_cod_escola,$this->ano,null,null,null,null,null,null,null,1,null);
173   -
174   - $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
175   - $det_turma = $obj_turma->detalhe();
176   - $this->nm_turma = $det_turma['nm_turma'];
177   -
178   -
179   - $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
180   - $det_serie = $obj_serie->detalhe();
181   - $this->nm_serie = $det_serie['nm_serie'];
  139 + if ($this->ref_ref_cod_serie) {
  140 + $this->ref_cod_serie = $this->ref_ref_cod_serie;
  141 + }
182 142  
183   - $obj_pessoa = new clsPessoa_($det_turma["ref_cod_regente"]);
184   - $det = $obj_pessoa->detalhe();
185   - $this->nm_professor = $det["nome"];
  143 + $fonte = 'arial';
  144 + $corTexto = '#000000';
186 145  
187   - if(!$lista_calendario)
188   - {
189   - echo '<script>
190   - alert("Escola não possui calendário definido para este ano");
191   - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
192   - </script>';
193   - return true;
194   - }
  146 + if (empty($this->ref_cod_turma) && !$this->em_branco) {
  147 + echo '
  148 + <script>
  149 + alert("Erro ao gerar relatório!\nNenhuma turma selecionada!");
  150 + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
  151 + </script>';
195 152  
196   - $prox_mes = $this->mes + 1;
  153 + return TRUE;
  154 + }
197 155  
  156 + if ($this->ref_cod_escola) {
  157 + $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
  158 + $det_escola = $obj_escola->detalhe();
  159 + $this->nm_escola = $det_escola['nome'];
  160 + }
198 161  
  162 + $obj_instituicao = new clsPmieducarInstituicao($this->ref_cod_instituicao);
  163 + $det_instituicao = $obj_instituicao->detalhe();
  164 + $this->nm_instituicao = $det_instituicao['nm_instituicao'];
199 165  
200   - $obj = new clsPmieducarSerie();
201   - $obj->setOrderby('cod_serie,etapa_curso');
202   - $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);
  166 + $obj_calendario = new clsPmieducarEscolaAnoLetivo();
  167 + $lista_calendario = $obj_calendario->lista($this->ref_cod_escola, $this->ano,
  168 + NULL, NULL, NULL, NULL, NULL, NULL, NULL,1, NULL);
203 169  
204   - $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
205   - $det_curso = $obj_curso->detalhe();
206   - $this->nm_curso = $det_curso['nm_curso_upper'];
  170 + $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
  171 + $det_turma = $obj_turma->detalhe();
  172 + $this->nm_turma = $det_turma['nm_turma'];
207 173  
  174 + $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
  175 + $det_serie = $obj_serie->detalhe();
  176 + $this->nm_serie = $det_serie['nm_serie'];
208 177  
  178 + $obj_pessoa = new clsPessoa_($det_turma["ref_cod_regente"]);
  179 + $det = $obj_pessoa->detalhe();
  180 + $this->nm_professor = $det["nome"];
209 181  
210   - if(!$this->em_branco)
211   - {
212   - if($det_curso['padrao_ano_escolar'])
213   - {
214   - $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo();
215   - $obj_ano_letivo_modulo->setOrderby("data_inicio asc");
216   - $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($this->ano,$this->ref_cod_escola,null,null);
  182 + if (!$lista_calendario) {
  183 + echo '
  184 + <script>
  185 + alert("Escola não possui calendário definido para este ano");
  186 + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
  187 + </script>';
217 188  
218   - if($lst_ano_letivo_modulo)
219   - {
220   - foreach ($lst_ano_letivo_modulo as $modulo) {
  189 + return TRUE;
  190 + }
221 191  
222   - $obj_modulo = new clsPmieducarModulo($modulo['ref_cod_modulo']);
223   - $det_modulo = $obj_modulo->detalhe();
224   - $this->array_modulos[] = $det_modulo;
  192 + $prox_mes = $this->mes + 1;
  193 +
  194 + $obj = new clsPmieducarSerie();
  195 + $obj->setOrderby('cod_serie,etapa_curso');
  196 +
  197 + $lista_serie_curso = $obj->lista(NULL, NULL, NULL,$this->ref_cod_curso, NULL,
  198 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao);
  199 +
  200 + $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
  201 + $det_curso = $obj_curso->detalhe();
  202 +
  203 + $this->nm_curso = $det_curso['nm_curso_upper'];
  204 +
  205 + if (!$this->em_branco) {
  206 + if ($det_curso['padrao_ano_escolar']) {
  207 + $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo();
  208 + $obj_ano_letivo_modulo->setOrderby("data_inicio asc");
  209 + $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($this->ano,
  210 + $this->ref_cod_escola, NULL, NULL);
  211 +
  212 + if ($lst_ano_letivo_modulo) {
  213 + foreach ($lst_ano_letivo_modulo as $modulo) {
  214 + $obj_modulo = new clsPmieducarModulo($modulo['ref_cod_modulo']);
  215 + $det_modulo = $obj_modulo->detalhe();
  216 + $this->array_modulos[] = $det_modulo;
  217 + }
  218 + }
  219 +
  220 + if (!$this->em_branco) {
  221 + $obj_disc_serie = new clsPmieducarEscolaSerieDisciplina();
  222 + $lst_disc_serie = $obj_disc_serie->lista($this->ref_cod_serie,
  223 + $this->ref_cod_escola, NULL, 1);
  224 +
  225 + if (is_array($lst_disc_serie)) {
  226 + foreach ($lst_disc_serie as $key => $disciplina) {
  227 + $obj_disc = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);
  228 + $det_disc = $obj_disc->detalhe();
  229 + $lst_disc_serie[$key]['nm_disciplina'] = $det_disc['nm_disciplina'];
  230 + $array_disc[$key] = $det_disc['nm_disciplina'];
  231 + }
  232 +
  233 + array_multisort($array_disc,SORT_ASC,$lst_disc_serie);
  234 + }
  235 + }
  236 + }
  237 + else {
  238 + $obj_turma_modulo = new clsPmieducarTurmaModulo();
  239 + $lst_turma_modulo = $obj_turma_modulo->lista($this->ref_cod_turma, NULL,
  240 + NULL, NULL, NULL, NULL, NULL);
  241 +
  242 + if ($lst_turma_modulo) {
  243 + $this->segue_padrao_escolar = FALSE;
  244 +
  245 + foreach ($lst_turma_modulo as $modulo) {
  246 + $obj_modulo = new clsPmieducarModulo($modulo['ref_cod_modulo']);
  247 + $det_modulo = $obj_modulo->detalhe();
  248 + $this->array_modulos[] = $det_modulo;
  249 +
  250 + $nm_modulo = substr(strtoupper($det_modulo['nm_tipo']), 0, 1);
  251 + }
  252 +
  253 + for ($i = 0; $i < count($this->array_modulos); $i++) {
  254 + $this->mostra_cabecalho_modulo[$i] = ($i + 1) . 'º' . $nm_modulo;
  255 + }
  256 + }
  257 +
  258 + if (!$this->em_branco) {
  259 + $obj_disc_serie = new clsPmieducarEscolaSerieDisciplina();
  260 + $lst_disc_serie = $obj_disc_serie->lista($this->ref_cod_serie,$this->ref_cod_escola,null,1);
  261 +
  262 + if (is_array($lst_disc_serie)) {
  263 + foreach ($lst_disc_serie as $key => $disciplina) {
  264 + $obj_disc = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);
  265 + $det_disc = $obj_disc->detalhe();
  266 + $lst_disc_serie[$key]['nm_disciplina'] = $det_disc['nm_disciplina'];
  267 + }
  268 + }
  269 + }
  270 + }
  271 + }
  272 + else {
  273 + $this->array_modulos = array(
  274 + array('nm_tipo' => 'Bimestre'),
  275 + array('nm_tipo' => 'Bimestre'),
  276 + array('nm_tipo' => 'Bimestre'),
  277 + array('nm_tipo' => 'Bimestre')
  278 + );
  279 + }
225 280  
226   - }
227   - }
  281 + if ($det_curso['media_exame']) {
  282 + $this->curso_com_exame = 1;
  283 + }
228 284  
229   - if(!$this->em_branco)
230   - {
231   - $obj_disc_serie = new clsPmieducarEscolaSerieDisciplina();
232   - $lst_disc_serie = $obj_disc_serie->lista($this->ref_cod_serie, $this->ref_cod_escola, null, 1);
  285 + $media_curso = $det_curso['media'];
233 286  
234   - if(is_array($lst_disc_serie))
235   - {
236   - foreach ($lst_disc_serie as $key => $disciplina)
237   - {
238   - $obj_disc = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);
239   - $det_disc = $obj_disc->detalhe();
240   - $lst_disc_serie[$key]['nm_disciplina'] = $det_disc['nm_disciplina'];
241   - $array_disc[$key] = $det_disc['nm_disciplina'];
242   -
243   - }
244   - array_multisort($array_disc,SORT_ASC,$lst_disc_serie);
245   - //ksort($lst_disc_serie);
246   - //echo '<pre>';print_r($lst_disc_serie);die;
247   - }
248   - }
249   -
250   - }
251   - else
252   - {
253   - $obj_turma_modulo = new clsPmieducarTurmaModulo();
254   - $lst_turma_modulo = $obj_turma_modulo->lista($this->ref_cod_turma,null,null,null,null,null,null);
  287 + if (!$this->em_branco) {
  288 + $obj_matricula_turma = new clsPmieducarMatriculaTurma();
  289 + $obj_matricula_turma->setOrderby("nome_aluno");
  290 + $lista_matricula = $obj_matricula_turma->lista($this->ref_cod_matricula,
  291 + $this->ref_cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1,
  292 + $this->ref_cod_serie, $this->ref_cod_curso, $this->ref_cod_escola,
  293 + $this->ref_cod_instituicao, NULL, NULL, NULL, NULL, NULL,$this->ano,
  294 + NULL, TRUE);
  295 + }
255 296  
256   - if($lst_turma_modulo)
257   - {
  297 + $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso['ref_cod_tipo_avaliacao']);
  298 + $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();
  299 + $curso_conceitual = $det_tipo_avaliacao['conceitual'];
  300 +
  301 + if ($lista_matricula || $this->em_branco) {
  302 + if ($this->em_branco) {
  303 + $lista_matricula = array();
  304 + $lista_matricula[] = '';
  305 + $this->numero_registros = $this->numero_registros? $this->numero_registros : 20;
  306 +
  307 + for ($i = 0 ; $i < $this->numero_registros; $i++) {
  308 + $lst_disc_serie[] = '';
  309 + }
  310 + }
  311 +
  312 + if (!$curso_conceitual) {
  313 + $this->pdf = new clsPDF('Boletim', 'Boletim ' . $this->ano, 'A4', '', FALSE, FALSE);
  314 +
  315 + $this->pdf->largura = 842.0;
  316 + $this->pdf->altura = 595.0;
  317 +
  318 + $this->pdf->topmargin = 5;
  319 + $this->pdf->bottommargirn = 5;
  320 +
  321 + $altura_linha = 13;
  322 +
  323 + $this->pdf->OpenPage();
  324 + $this->page_y = 10;
  325 +
  326 + $flag_tamanho = false;
  327 + $tamanho = $this->page_y;
  328 +
  329 + foreach ($lista_matricula as $matricula) {
  330 + $reprovou = false;
  331 +
  332 + if (!$this->em_branco) {
  333 + $obj_matricula = new clsPmieducarMatricula($matricula['ref_cod_matricula']);
  334 + $det_matricula = $obj_matricula->detalhe();
  335 + $this->ref_cod_matricula = $matricula['ref_cod_matricula'];
  336 + $this->nm_aluno = $matricula['nome_aluno'];
  337 + }
  338 +
  339 + if ($this->page_y + $tamanho > 540) {
  340 + $this->pdf->ClosePage();
  341 + $this->pdf->OpenPage();
  342 + $this->page_y = 10;
  343 + }
  344 +
  345 + $this->addCabecalho();
  346 + $this->inicio_y = $this->page_y - 25;
  347 +
  348 + if (!$this->em_branco) {
  349 + $obj_matricula = new clsPmieducarMatricula($matricula['ref_cod_matricula']);
  350 + $det_matricula = $obj_matricula->detalhe();
  351 +
  352 + $obj_aluno = new clsPmieducarAluno();
  353 + $det_aluno = array_shift($obj_aluno->lista($det_matricula['ref_cod_aluno']));
  354 + }
  355 +
  356 + foreach ($lst_disc_serie as $key => $disciplina) {
  357 + $this->pdf->quadrado_relativo(30, $this->page_y, 782, $altura_linha, 0.5);
  358 +
  359 + $inc = (strlen($det_disc['nm_disciplina']) > 40) ? -2 : +2;
  360 + $fonte_dis = 7;
  361 +
  362 + $this->pdf->escreve_relativo($disciplina['nm_disciplina'] , 33,
  363 + $this->page_y + $inc, 170, 15, $fonte, $fonte_dis, $corTexto, 'left');
  364 +
  365 + /**
  366 + * notas
  367 + */
  368 + $largura_anos = 620;
  369 + $altura = 30;
  370 +
  371 + if (sizeof($this->array_modulos) + $this->curso_com_exame + 2 >= 1) {
  372 + $incremental = (int) ceil($largura_anos / (sizeof($this->array_modulos) + $this->curso_com_exame + 2));
  373 + }
  374 + else {
  375 + $incremental = 1;
  376 + }
  377 +
  378 + $reta_ano_x = 209;
  379 + $anos_x = 209;
  380 +
  381 + if (!$this->em_branco) {
  382 + $obj_nota = new clsPmieducarNotaAluno();
  383 + $obj_nota->setOrderby('cod_nota_aluno asc');
  384 +
  385 + if ($det_curso['padrao_ano_escolar'] == 1) {
  386 + $det_nota = $obj_nota->lista(NULL,NULL, NULL,$this->ref_cod_serie,
  387 + $this->ref_cod_escola, $disciplina['ref_cod_disciplina'],
  388 + $matricula['ref_cod_matricula'], NULL, NULL, NULL, NULL, NULL,
  389 + NULL,1, NULL);
  390 + }
  391 + else {
  392 + $det_nota = $obj_nota->lista(NULL, NULL, NULL, $this->ref_cod_serie,
  393 + $this->ref_cod_escola, NULL, $matricula['ref_cod_matricula'],
  394 + NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL,
  395 + $disciplina['ref_cod_disciplina']);
  396 + }
  397 +
  398 + if (is_array($det_nota)) {
  399 + usort($det_nota, 'cmp');
  400 + }
  401 +
  402 + $obj_dispensa = new clsPmieducarDispensaDisciplina();
  403 +
  404 + $matricula_dispensa_disciplina = $obj_dispensa->lista(
  405 + $matricula['ref_cod_matricula'], $this->ref_cod_serie,
  406 + $this->ref_cod_escola, $disciplina['ref_cod_disciplina'],
  407 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
  408 + }
  409 +
  410 + $dispensas = array();
  411 + $completo = TRUE;
  412 +
  413 + if (count($det_nota) < count($this->array_modulos) || !$det_nota) {
  414 + if (!$det_nota) {
  415 + $det_nota = array();
  416 + }
  417 +
  418 + for ($ct = count($det_nota); $ct <= count($this->array_modulos); $ct++) {
  419 + if ($matricula_dispensa_disciplina) {
  420 + $det_nota[$ct] = array('D');
  421 + $dispensas[$ct] = 1;
  422 + }
  423 + else {
  424 + $det_nota[$ct] = array('');
  425 + }
  426 +
  427 + $completo = FALSE;
  428 + }
  429 + }
  430 +
  431 + if (!$this->em_branco) {
  432 + if ($det_curso['falta_ch_globalizada']) {
  433 + $obj_falta = new clsPmieducarFaltas();
  434 + $obj_falta->setOrderby("sequencial asc");
  435 + $det_falta = $obj_falta->lista($matricula['ref_cod_matricula'],
  436 + NULL, NULL, NULL, NULL, NULL);
  437 +
  438 + if(is_array($det_falta)) {
  439 + $total_faltas = 0;
  440 + foreach ($det_falta as $key => $value) {
  441 + $total_faltas += $det_falta[$key]['faltas'] = $value['falta'];
  442 + }
  443 +
  444 + $det_falta['total'] = $total_faltas;
  445 + }
  446 +
  447 + if(count($det_nota) < count($this->array_modulos) || !$det_nota) {
  448 + if (!$det_falta) {
  449 + $det_falta = array();
  450 + }
  451 +
  452 + for ($ct = count($det_nota); $ct <= count($this->array_modulos); $ct++) {
  453 + $det_falta[$ct] = array('');
  454 + $det_falta[$ct]['faltas'] = '0';
  455 + }
  456 + }
  457 + }
  458 + else {
  459 + $obj_falta = new clsPmieducarFaltaAluno();
  460 + $obj_falta->setOrderby("cod_falta_aluno asc");
  461 +
  462 + if($det_curso['padrao_ano_escolar'] == 1) {
  463 + $det_falta = $obj_falta->lista(NULL, NULL, NULL, $this->ref_cod_serie,
  464 + $this->ref_cod_escola, $disciplina['ref_cod_disciplina'],
  465 + $matricula['ref_cod_matricula'], NULL, NULL, NULL, NULL, NULL, 1);
  466 + }
  467 + else {
  468 + $det_falta = $obj_falta->lista(NULL, NULL, NULL, $this->ref_cod_serie,
  469 + $this->ref_cod_escola, NULL, $matricula['ref_cod_matricula'],
  470 + NULL, NULL, NULL, NULL, NULL, 1, NULL, $disciplina['ref_cod_disciplina']);
  471 + }
  472 +
  473 + $total_faltas = 0;
  474 +
  475 + if (is_array($det_falta)) {
  476 + foreach ($det_falta as $key => $value) {
  477 + $total_faltas += $det_falta[$key]['faltas'];
  478 + }
  479 + }
  480 +
  481 + $det_falta['total'] = $total_faltas;
  482 + }
  483 + }
  484 +
  485 + if ($det_nota){
  486 + $soma_notas = 0;
  487 + $notas_primeiro_regular = array();
  488 +
  489 + foreach ($det_nota as $key => $nota) {
  490 + $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores(
  491 + $nota['ref_ref_cod_tipo_avaliacao'], $nota['ref_sequencial'],
  492 + NULL, NULL, NULL, NULL);
  493 +
  494 + $det_tipo_av_val = $obj_tipo_av_val->detalhe();
  495 +
  496 + if (dbBool($det_serie['ultima_nota_define'])) {
  497 + $soma_notas = $det_tipo_av_val['valor'];
  498 + }
  499 + else {
  500 + $soma_notas += $det_tipo_av_val['valor'];
  501 + }
  502 +
  503 + if ( count($this->array_modulos) == count($det_nota) ) {
  504 + $frequencia_minima = $det_curso['frequencia_minima'];
  505 + $hora_falta = $det_curso['hora_falta'];
  506 + $carga_horaria_curso = $det_curso['carga_horaria'];
  507 + }
  508 +
  509 + if ($det_tipo_av_val['conceitual']) {
  510 + // situacao definida pelo professor
  511 + $aprovado = $this->aprovado;
  512 + }
  513 + elseif ((count($this->array_modulos) <= $nota['modulo']) &&
  514 + ($aprovado == 3) && !$det_tipo_av_val['conceitual']) {
  515 +
  516 + // aluno aprovado
  517 + $aprovado = 1;
  518 + }
  519 +
  520 + if ($key < (count($this->array_modulos))) {
  521 + /**
  522 + * variavel de controle para verificacao de media
  523 + */
  524 + $media_sem_exame = TRUE;
  525 +
  526 + if ($det_tipo_av_val['valor']) {
  527 + $nota = sprintf('%01.1f', $det_tipo_av_val['valor']);
  528 + }
  529 + else {
  530 + $nota = '-';
  531 + }
  532 +
  533 + if ($this->em_branco) {
  534 + $nota = '';
  535 + }
  536 +
  537 + $nota = $dispensas[$key] ? 'D' : str_replace('.', ',', $nota);
  538 +
  539 + $this->pdf->escreve_relativo($nota, $anos_x + 10, $this->page_y + 2,
  540 + ($incremental / 3), $altura, $fonte, 9, $corTexto, 'center');
  541 +
  542 + if ($det_curso['falta_ch_globalizada']) {
  543 + $falta = ' - ';
  544 + }
  545 + else {
  546 + if ($det_falta[$key]['faltas']) {
  547 + $falta = $det_falta[$key]['faltas'];
  548 + }
  549 + else {
  550 + $falta = '0';
  551 + }
  552 + }
  553 +
  554 + if ($this->em_branco) {
  555 + $falta = '';
  556 + }
  557 +
  558 + $falta = $dispensas[$key] ? 'D' : $falta;
  559 + $this->pdf->escreve_relativo($falta, $anos_x + ($incremental / 2) + 10,
  560 + $this->page_y + 2, ($incremental / 3), $altura, $fonte, 9,
  561 + $corTexto, 'center');
  562 +
  563 + if (count($this->array_modulos) == count($det_nota) &&
  564 + $key == count($det_nota) - 1) {
  565 + $this->pdf->escreve_relativo($this->em_branco ? '' : '-',
  566 + $anos_x + $incremental / 3 + $incremental, $this->page_y + 2,
  567 + ($incremental / 3), $altura, $fonte, 9, $corTexto, 'center');
  568 + }
  569 + }
  570 + else {
  571 + /**
  572 + * variavel de controle para verificacao de media
  573 + */
  574 + $media_sem_exame = FALSE;
  575 +
  576 + if (
  577 + $this->curso_com_exame &&
  578 + ($det_matricula['aprovado'] == 1 || $det_matricula['aprovado'] == 2)
  579 + ) {
  580 + $nota = sprintf('%01.2f', $det_nota[$key]['nota']);
  581 + $nota = str_replace('.', ',', $nota);
  582 + $nota = $dispensas[$key] ? 'D' : $nota;
  583 + $this->pdf->escreve_relativo($nota, $anos_x + $incremental / 3,
  584 + $this->page_y + 2, ($incremental / 3), $altura, $fonte, 9,
  585 + $corTexto, 'center');
  586 +
  587 + $nota_exame = TRUE;
  588 + $exame_nota = $det_nota[$key]["nota"];
  589 + }
  590 + }
  591 +
  592 + $anos_x += $incremental;
  593 + $reta_ano_x += $incremental;
  594 + }
  595 +
  596 + if (!dbBool($det_serie['ultima_nota_define'])) {
  597 + if (!$nota_exame) {
  598 + // soh esta parte eh do codigo original
  599 + $media = $soma_notas / count($det_nota);
  600 + $media_ = $media;
  601 + }
  602 + else {
  603 + $media = ($soma_notas + $exame_nota * 2) / (count($det_nota) + 1);
  604 + }
  605 + }
  606 + else {
  607 + $media = $soma_notas;
  608 + }
  609 +
  610 + $det_media = array();
  611 +
  612 + if ($media >= $det_curso['media'] || $nota_exame) {
  613 + $obj_media = new clsPmieducarTipoAvaliacaoValores();
  614 + $det_media = $obj_media->lista($det_curso['ref_cod_tipo_avaliacao'],
  615 + $det_curso['ref_sequencial'], NULL, NULL, $media, $media);
  616 + }
  617 +
  618 + $nota_exame = FALSE;
  619 +
  620 + if ($det_media && is_array($det_media)) {
  621 + $det_media = array_shift($det_media);
  622 + $media = $det_media['valor'];
  623 + $media = sprintf('%01.1f', $media);
  624 + $media = str_replace('.', ',', $media);
  625 + }
  626 + elseif (dbBool($det_serie['ultima_nota_define'])) {
  627 + $media = sprintf('%01.1f', $media);
  628 + $media = str_replace('.', ',', $media);
  629 + }
  630 +
  631 + if (count($det_nota) <= count($this->array_modulos) && $this->curso_com_exame) {
  632 + $anos_x += $incremental;
  633 + $reta_ano_x += $incremental;
  634 + }
  635 +
  636 + if (
  637 + count($det_nota) == 4 &&
  638 + (
  639 + $det_matricula['aprovado'] == 1 || $det_matricula['aprovado'] == 2 ||
  640 + !(
  641 + (
  642 + $det_matricula['aprovado'] == 7 ||
  643 + (str_replace(",",".",$media) < $media_curso_ && !$nota_exame)
  644 + )
  645 + )
  646 + )
  647 + ) {
  648 + if ($dispensas[$key]) {
  649 + $this->pdf->escreve_relativo("D", $anos_x + 5, $this->page_y + 2,
  650 + ($incremental / 3), $altura, $fonte, 9, $corTexto, 'center');
  651 + }
  652 + else {
  653 + $this->pdf->escreve_relativo($media, $anos_x + 5, $this->page_y + 2,
  654 + ($incremental / 3), $altura, $fonte, 9, $corTexto, 'center');
  655 + }
  656 + }
  657 + else {
  658 + $this->pdf->escreve_relativo('-', $anos_x + 5, $this->page_y + 2,
  659 + ($incremental / 3), $altura, $fonte, 9, $corTexto, 'center');
  660 + }
  661 +
  662 + if($det_curso['falta_ch_globalizada']) {
  663 + $falta = ' - ';
  664 + }
  665 + else {
  666 + if ($det_falta['total']) {
  667 + $falta = $det_falta['total'];
  668 + }
  669 + else {
  670 + $falta = '0';
  671 + }
  672 + }
  673 +
  674 + if ($this->em_branco) {
  675 + $falta = '';
  676 + }
  677 +
  678 + $falta = $dispensas[$key] ? 'D' : $falta;
  679 + $this->pdf->escreve_relativo($falta, $anos_x + ($incremental / 2) + 2,
  680 + $this->page_y + 2, ($incremental / 3), $altura, $fonte, 9, $corTexto, 'center');
  681 + }
  682 +
  683 + $anos_x += $incremental;
  684 + $reta_ano_x += $incremental;
  685 +
  686 + $sit = '';
  687 +
  688 + if ($completo) {
  689 + if ($media_sem_exame) {
  690 + $media_curso_ = $det_curso['media'];
  691 + }
  692 + else {
  693 + $media_curso_ = $det_curso['media_exame'];
  694 + }
  695 +
  696 + $sit = (str_replace(',', '.', $media) >= $media_curso_) ?
  697 + 'APROVADO' : 'REPROVADO';
  698 +
  699 + $sit = ($det_matricula['aprovado'] == 3 && str_replace(',', '.', $media) >= $media_curso_) ?
  700 + 'APROVADO' : $sit;
  701 +
  702 + if ($det_matricula['aprovado'] != 1 && $det_matricula['aprovado'] != 2) {
  703 + $sit = ($det_matricula['aprovado'] == 7 || (str_replace(',', '.', $media) < $media_curso_ && !$nota_exame)) ?
  704 + 'EM EXAME' : $sit;
  705 + }
  706 +
  707 + if ($this->em_branco) {
  708 + $sit = '';
  709 + }
  710 +
  711 + $sit = $dispensas[$key] ? 'D' : $sit;
  712 + $this->pdf->escreve_relativo($sit, $anos_x - 12,$this->page_y + 2,
  713 + $incremental, $altura, $fonte, 8, $corTexto, 'center');
  714 + }
  715 +
  716 + $this->page_y +=$altura_linha;
  717 +
  718 + }
  719 + // end foreach
  720 +
  721 + if ($det_curso['falta_ch_globalizada']) {
  722 + $this->pdf->quadrado_relativo(30, $this->page_y , 782, $altura_linha, 0.5);
  723 + $fonte_dis = 7;
  724 + $this->pdf->escreve_relativo('TOTAL FALTAS' , 80 ,$this->page_y + 2,
  725 + 170, 15, $fonte, 8, $corTexto, 'left');
  726 +
  727 + $reta_ano_x = 209 ;
  728 + $anos_x = 209;
  729 +
  730 + if (is_array($det_falta)) {
  731 + $total_faltas = array_pop($det_falta);
  732 + }
  733 +
  734 + if($det_falta) {
  735 + foreach ($det_falta as $key => $value) {
  736 + $incr = $anos_x + ($incremental / 2)+ 10;
  737 + if (count($det_nota) <= count($this->array_modulos) &&
  738 + $this->curso_com_exame && (count($det_falta) == $key)) {
  739 + $incr = $anos_x +($incremental/3);
  740 + }
  741 +
  742 + $this->pdf->escreve_relativo($det_falta[$key]['faltas'] ? $det_falta[$key]['faltas'] : '0',
  743 + $incr, $this->page_y + 2, ($incremental / 3), $altura, $fonte,
  744 + 9, $corTexto, 'center');
  745 +
  746 + $anos_x += $incremental;
  747 + $reta_ano_x += $incremental;
  748 + }
  749 + }
  750 +
  751 + $reta_ano_x += $incremental;
  752 +
  753 + if (count($det_nota) >= count($this->array_modulos) && $this->curso_com_exame) {
  754 + $anos_x += $incremental;
  755 + $reta_ano_x += $incremental;
  756 + }
  757 +
  758 + $this->page_y +=$altura_linha;
  759 + }
  760 +
  761 + $this->desenhaLinhasVertical();
  762 + $sit = '';
  763 +
  764 + if ($completo) {
  765 + if ($det_matricula['aprovado'] == 1) {
  766 + $sit = 'APROVADO';
  767 + }
  768 + elseif ($det_matricula['aprovado'] == 2) {
  769 + $sit = 'REPROVADO';
  770 + }
  771 + elseif ($det_matricula['aprovado'] == 7) {
  772 + $sit = 'EM EXAME';
  773 + }
  774 + }
  775 +
  776 + if ($sit) {
  777 + $this->pdf->escreve_relativo('ALUNO ' . $sit , 150, $this->page_y + 30,
  778 + 530, $altura, $fonte, 9, $corTexto, 'center');
  779 + }
  780 +
  781 + $this->rodape();
  782 +
  783 + $this->page_y += 50;
  784 +
  785 + $this->pdf->linha_relativa(30,$this->page_y - 15, 785, 0, 0.1);
  786 +
  787 + if (!$flag_tamanho) {
  788 + $tamanho = $this->page_y - $tamanho;
  789 + }
  790 + }
  791 + }
  792 + /**
  793 + * conceitual
  794 + */
  795 + else {
  796 + $this->pdf = new clsPDF('Alunos Matriculados - ' . $this->ano,
  797 + 'Alunos Matriculados - Sintético', 'A4', '', FALSE, FALSE);
  798 +
  799 + foreach ($lista_matricula as $matricula) {
  800 + if (!$this->em_branco) {
  801 + $obj_matricula = new clsPmieducarMatricula($matricula['ref_cod_matricula']);
  802 + $det_matricula = $obj_matricula->detalhe();
  803 +
  804 + $this->ref_cod_matricula = $matricula['ref_cod_matricula'];
  805 + $this->nm_aluno = $matricula['nome_aluno'];
  806 + }
  807 +
  808 + $page_open = FALSE;
  809 +
  810 + if ($lst_disc_serie) {
  811 + foreach ($lst_disc_serie as $disciplina) {
  812 + if (!$page_open) {
  813 + $x_quadrado = 30;
  814 + $this->page_y = 95;
  815 + $altura_caixa = 85;
  816 +
  817 + $this->pdf->OpenPage();
  818 + $this->addCabecalhoc();
  819 + $this->addCabecalhoc2();
  820 +
  821 + $page_open = TRUE;
  822 + }
  823 +
  824 + $altura_caixa = 15 + (int) ((strlen($disciplina['nm_disciplina']) / 60 ) * 7);
  825 +
  826 + $this->pdf->quadrado_relativo(30, $this->page_y, 535, $altura_caixa);
  827 +
  828 + $this->pdf->linha_relativa(440, $this->page_y, 0, $altura_caixa, '0.1');
  829 +
  830 + $this->pdf->escreve_relativo($disciplina['nm_disciplina'], 35,
  831 + $this->page_y + 5, 400, 120, 'arial', '8', '#000000', 'justify');
  832 +
  833 + if (!$this->em_branco) {
  834 + $obj_nota = new clsPmieducarNotaAluno();
  835 + $obj_nota->setOrderby('cod_nota_aluno asc');
  836 +
  837 + if ($det_curso['padrao_ano_escolar'] == 1) {
  838 + $det_nota = $obj_nota->lista(NULL, NULL, NULL, $this->ref_cod_serie,
  839 + $this->ref_cod_escola, $disciplina['ref_cod_disciplina'],
  840 + $matricula['ref_cod_matricula'], NULL, NULL, NULL, NULL, NULL,
  841 + NULL, 1, NULL);
  842 + }
  843 + else {
  844 + $det_nota = $obj_nota->lista(NULL, NULL, NULL, $this->ref_cod_serie,
  845 + $this->ref_cod_escola, $disciplina['ref_cod_disciplina'],
  846 + $matricula['ref_cod_matricula'], NULL, NULL, NULL, NULL,
  847 + NULL, NULL, 1, NULL, NULL);
  848 + }
  849 + }
  850 +
  851 + $x_bim = 440 + 31;
  852 +
  853 + for ($i = 1; $i <= 4; $i++) {
  854 + if(is_array($det_nota)) {
  855 + $nota = array_shift($det_nota);
  856 + $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores(
  857 + $nota['ref_ref_cod_tipo_avaliacao'], $nota['ref_sequencial'],
  858 + NULL, NULL, NULL, NULL);
  859 +
  860 + $det_tipo_av_val = $obj_tipo_av_val->detalhe();
  861 + }
  862 + else {
  863 + $det_tipo_av_val = NULL;
  864 + }
  865 +
  866 + if ($i<=3) {
  867 + $this->pdf->linha_relativa($x_bim, $this->page_y, 0,
  868 + $altura_caixa, '0.1');
  869 + }
  870 +
  871 + $this->pdf->escreve_relativo($det_tipo_av_val['nome'],
  872 + $x_bim - 31, $this->page_y + ($altura_caixa / 3), 31, 120,
  873 + 'arial', '10', '#000000', 'center');
  874 +
  875 + $x_bim += 31;
  876 + }
  877 +
  878 + $this->page_y += $altura_caixa;
  879 + }
  880 + }
  881 + else {
  882 + $x_quadrado = 30;
  883 + $altura_caixa = 85;
  884 + $this->page_y = 95;
  885 +
  886 + $this->pdf->OpenPage();
  887 + $this->addCabecalhoc();
  888 + $this->addCabecalhoc2();
  889 +
  890 + $page_open = TRUE;
  891 + }
  892 +
  893 + $this->pdf->quadrado_relativo(30, $this->page_y, 535, 15);
  894 + $this->pdf->linha_relativa(440, $this->page_y, 0, 15, '0.1');
  895 + $this->pdf->escreve_relativo('TOTAL DE FALTAS', 35, $this->page_y + 2,
  896 + 400, 120, 'arial', '8', '#000000', 'justify');
  897 +
  898 + if ($det_curso['falta_ch_globalizada']) {
  899 + if (!$this->em_branco) {
  900 + $obj_falta = new clsPmieducarFaltas();
  901 + $obj_falta->setOrderby('sequencial asc');
  902 + $det_falta = $obj_falta->lista($matricula['ref_cod_matricula'],
  903 + NULL, NULL, NULL, NULL, NULL);
  904 + }
  905 +
  906 + if (is_array($det_falta)) {
  907 + $total_faltas = 0;
  908 + foreach ($det_falta as $key => $value) {
  909 + $total_faltas += $det_falta[$key]['faltas'] = $value['falta'];
  910 + }
  911 +
  912 + $det_falta['total'] = $total_faltas;
  913 + }
  914 + }
  915 +
  916 + $x_bim = 440 + 31;
  917 +
  918 + for ($i = 1; $i <= 4; $i++) {
  919 + if (is_array($det_falta)) {
  920 + $falta = array_shift($det_falta);
  921 + $falta = $falta['faltas'];
  922 + }
  923 + else {
  924 + $falta = NULL;
  925 + }
  926 +
  927 + if ($i<=3) {
  928 + $this->pdf->linha_relativa($x_bim, $this->page_y, 0, 15, '0.1');
  929 + }
  930 +
  931 + $this->pdf->escreve_relativo($falta, $x_bim - 31, $this->page_y + 2,
  932 + 31, 120, 'arial', '10', '#000000', 'center');
  933 + $x_bim += 31;
  934 + }
  935 +
  936 + $obj_matricula_situacao = new clsPmieducarMatricula($matricula['ref_cod_matricula']);
  937 + $obj_matricula_situacao->setCamposLista('aprovado');
  938 + $det_matricula_situacao = $obj_matricula_situacao->detalhe();
  939 +
  940 + if ($det_matricula_situacao['aprovado'] == 1) {
  941 + $situacao = 'APROVADO';
  942 + }
  943 + elseif ($det_matricula_situacao['aprovado'] == 2) {
  944 + $situacao = 'REPROVADO';
  945 + }
  946 + else {
  947 + $situacao = 'EM ANDAMENTO';
  948 + }
  949 +
  950 + $this->pdf->quadrado_relativo(30, $this->page_y + 15, 535, 15);
  951 +
  952 + $this->pdf->linha_relativa(440, $this->page_y + 15, 0, 15, '0.1');
  953 +
  954 + $this->pdf->escreve_relativo('SITUAÇÃO', 35, $this->page_y + 15 + 2,
  955 + 400, 120, 'arial', '8', '#000000', 'justify');
  956 +
  957 + $this->pdf->escreve_relativo($situacao, 440, $this->page_y + 15 + 2,
  958 + 120, 120, 'arial', '10', '#000000', 'center');
  959 +
  960 + $this->page_y += 35; // original é 25
  961 +
  962 + $legenda = "LEGENDA:\n
  963 + D = Desenvolvida
  964 + PD = Parcialmente Desenvolvida
  965 + ID = Iniciando o Desenvolvimento
  966 + ND = Não Desenvolvida
  967 + CNA = Competência Não Avaliada";
  968 +
  969 + $this->pdf->escreve_relativo($legenda, 36,$this->page_y, 200, 50, $fonte,
  970 + 7, $corTexto, 'left' );
  971 +
  972 + $this->page_y += 75;
  973 + $altura_obs = 60;
  974 +
  975 + $this->pdf->quadrado_relativo(30, $this->page_y, 535, $altura_obs, 0.1,
  976 + '#000000', '#FFFFFF');
  977 + $this->pdf->escreve_relativo('OBS: ' , 33, $this->page_y + 3 , 545, 60,
  978 + $fonte, 8, $corTexto, 'justify');
  979 +
  980 + $this->pdf->ClosePage();
  981 + }
  982 + }
  983 + }
  984 + else {
  985 + echo '
  986 + <script>
  987 + alert("Turma não possui matrículas no ano selecionado");
  988 + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
  989 + </script>';
258 990  
  991 + return;
  992 + }
259 993  
260   - /****************COLOCADO********************************/
261   - $this->segue_padrao_escolar = false;
262   - /****************COLOCADO********************************/
263   -
264   - foreach ($lst_turma_modulo as $modulo) {
265   -
266   - $obj_modulo = new clsPmieducarModulo($modulo['ref_cod_modulo']);
267   - $det_modulo = $obj_modulo->detalhe();
268   - $this->array_modulos[] = $det_modulo;
269   -
270   - /****************COLOCADO********************************/
271   - $nm_modulo = substr(strtoupper($det_modulo["nm_tipo"]), 0, 1);
272   - /****************COLOCADO********************************/
273   - }
274   -
275   - /****************COLOCADO********************************/
276   - for ($i = 0; $i < count($this->array_modulos); $i++) {
277   - $this->mostra_cabecalho_modulo[$i] = ($i+1)."º".$nm_modulo;
278   - }
279   - /****************COLOCADO********************************/
280   -
281   - }
282   -
283   - //$obj_disc_serie = new clsPmieducarDisciplinaSerie();
284   - //$lst_disc_serie = $obj_disc_serie->lista(null, $this->ref_cod_serie, 1);
285   - if(!$this->em_branco)
286   - {
287   - $obj_disc_serie = new clsPmieducarEscolaSerieDisciplina();
288   -// $lst_disc_serie = $obj_disciplinas->lista($this->ref_cod_serie,$this->ref_cod_escola,null,1);
289   - $lst_disc_serie = $obj_disc_serie->lista($this->ref_cod_serie,$this->ref_cod_escola,null,1);
290   -
291   - if(is_array($lst_disc_serie))
292   - {
293   - foreach ($lst_disc_serie as $key => $disciplina)
294   - {
295   - $obj_disc = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);
296   - $det_disc = $obj_disc->detalhe();
297   - $lst_disc_serie[$key]['nm_disciplina'] = $det_disc['nm_disciplina'];
298   -
299   - }
300   -
301   - }
302   - }
303   -
304   - }
305   - }
306   - else
307   - {
308   - $this->array_modulos = array(array('nm_tipo' => 'Bimestre'),array('nm_tipo' => 'Bimestre'),array('nm_tipo' => 'Bimestre'),array('nm_tipo' => 'Bimestre'));
309   - }
310   -
311   - if($det_curso['media_exame'])
312   - $this->curso_com_exame = 1;
313   -
314   - $media_curso = $det_curso['media'];
315   -
316   - if(!$this->em_branco)
317   - {
318   - $obj_matricula_turma = new clsPmieducarMatriculaTurma();
319   - $obj_matricula_turma->setOrderby("nome_aluno");
320   - $lista_matricula = $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,null,null,null,$this->ano,null,true);
321   - }
322   - $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso['ref_cod_tipo_avaliacao']);
323   - $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();
324   - $curso_conceitual = $det_tipo_avaliacao['conceitual'];
325   -
326   - if($lista_matricula || $this->em_branco)
327   - {
328   - if($this->em_branco)
329   - {
330   - $lista_matricula = array();
331   - $lista_matricula[] = '';
332   - $this->numero_registros = $this->numero_registros? $this->numero_registros : 20;
333   - for ($i = 0 ; $i < $this->numero_registros; $i++)
334   - {
335   - $lst_disc_serie[] = '';
336   - }
337   - }
338   -
339   -
340   - if(!$curso_conceitual)
341   - {
342   - $this->pdf = new clsPDF("Boletim", "Boletim {$this->ano}", "A4", "", false, false);
343   -
344   - $this->pdf->largura = 842.0;
345   - $this->pdf->altura = 595.0;
346   -
347   - $this->pdf->topmargin = 5;
348   - $this->pdf->bottommargirn = 5;
349   -
350   -
351   -
352   - $altura_linha = 13;
353   - //$inicio_escrita_y = 50;
354   -
355   - $this->pdf->OpenPage();
356   - //$this->page_y = 95;
357   - $this->page_y = 10;
358   -
359   - $flag_tamanho = false;
360   - $tamanho = $this->page_y;
361   - foreach ($lista_matricula as $matricula)
362   - {
363   - $reprovou = false;
364   - if(!$this->em_branco)
365   - {
366   - $obj_matricula = new clsPmieducarMatricula($matricula['ref_cod_matricula']);
367   - $det_matricula = $obj_matricula->detalhe();
368   - $this->ref_cod_matricula = $matricula['ref_cod_matricula'];
369   - $this->nm_aluno = $matricula['nome_aluno'];
370   - }
371   -
372   - if($this->page_y + $tamanho > 540)
373   - {
374   - //$this->desenhaLinhasVertical();
375   - $this->pdf->ClosePage();
376   - $this->pdf->OpenPage();
377   - $this->page_y = 10;
378   - //$this->addCabecalho();
379   -
380   - }
381   -
382   - $this->addCabecalho();
383   - $this->inicio_y = $this->page_y - 25;
384   -
385   -
386   - if(!$this->em_branco)
387   - {
388   - $obj_matricula = new clsPmieducarMatricula($matricula['ref_cod_matricula']);
389   - $det_matricula = $obj_matricula->detalhe();
390   -
391   - $obj_aluno = new clsPmieducarAluno();
392   - $det_aluno = array_shift($obj_aluno->lista($det_matricula['ref_cod_aluno']));
393   - }
394   -
395   - foreach ($lst_disc_serie as $key => $disciplina)
396   - {
397   - $this->pdf->quadrado_relativo( 30, $this->page_y , 782, $altura_linha,0.5);
398   - $inc = (strlen($det_disc['nm_disciplina']) > 40 )? -2 : +2;
399   - $fonte_dis = 7;//(strlen($det_disc['nm_disciplina']) > 40 )? 7 : 9;
400   - $this->pdf->escreve_relativo($disciplina['nm_disciplina'] , 33 ,$this->page_y +$inc,170, 15, $fonte, $fonte_dis, $corTexto, 'left' );
401   -
402   - /**
403   - * notas
404   - */
405   - $largura_anos = 620;
406   - $altura = 30;
407   -
408   - if(sizeof($this->array_modulos) + $this->curso_com_exame + 2 >= 1)
409   - {
410   -
411   - $incremental = (int)ceil($largura_anos/ (sizeof($this->array_modulos) + $this->curso_com_exame + 2));
412   -
413   - }else {
414   -
415   - $incremental = 1;
416   - }
417   -
418   - $reta_ano_x = 209 ;
419   - $anos_x = 209;
420   -
421   -
422   - if(!$this->em_branco)
423   - {
424   - $obj_nota = new clsPmieducarNotaAluno();
425   - $obj_nota->setOrderby("cod_nota_aluno asc");
426   -
427   - if($det_curso['padrao_ano_escolar'] == 1)
428   - $det_nota = $obj_nota->lista(null,nul,null,$this->ref_cod_serie,$this->ref_cod_escola,$disciplina['ref_cod_disciplina'],$matricula['ref_cod_matricula'],null,null,null,null,null,null,1,null);
429   - else
430   - $det_nota = $obj_nota->lista(null,nul,null,$this->ref_cod_serie,$this->ref_cod_escola,null,$matricula['ref_cod_matricula'],null,null,null,null,null,null,1,null,$disciplina['ref_cod_disciplina']);
431   -
432   - if (is_array($det_nota))
433   - usort($det_nota, "cmp");
434   -
435   -
436   - $obj_dispensa = new clsPmieducarDispensaDisciplina();
437   - $matricula_dispensa_disciplina = $obj_dispensa->lista($matricula['ref_cod_matricula'],$this->ref_cod_serie,$this->ref_cod_escola,$disciplina['ref_cod_disciplina'],null,null,null,null,null,null,null,1);
438   - }
439   - $dispensas = array();
440   - $completo = true;
441   - if(count($det_nota) < count($this->array_modulos) || !$det_nota)
442   - {
443   - if(!$det_nota)
444   - $det_nota = array();
445   -
446   - for ($ct = count($det_nota);$ct <= count($this->array_modulos);$ct++)
447   - {
448   - if ($matricula_dispensa_disciplina)
449   - {
450   - $det_nota[$ct] = array('D');
451   - $dispensas[$ct] = 1;
452   - }
453   - else
454   - {
455   - $det_nota[$ct] = array('');
456   - }
457   -
458   - $completo = false;
459   - }
460   - }
461   -
462   - if(!$this->em_branco)
463   - {
464   - if($det_curso['falta_ch_globalizada'])
465   - {
466   - $obj_falta = new clsPmieducarFaltas();
467   - $obj_falta->setOrderby("sequencial asc");
468   - $det_falta = $obj_falta->lista($matricula['ref_cod_matricula'],null,null,null,null,null);
469   - if(is_array($det_falta))
470   - {
471   - $total_faltas = 0;
472   - foreach ($det_falta as $key => $value)
473   - {
474   - $total_faltas += $det_falta[$key]['faltas'] = $value['falta'];
475   - }
476   -
477   - $det_falta['total'] = $total_faltas;
478   -
479   - }
480   - if(count($det_nota) < count($this->array_modulos) || !$det_nota)
481   - {
482   - if(!$det_falta)
483   - $det_falta = array();
484   - for ($ct = count($det_nota);$ct <= count($this->array_modulos);$ct++)
485   - {
486   - $det_falta[$ct] = array('');
487   - $det_falta[$ct]['faltas'] = '0';
488   - }
489   - }
490   -
491   - }
492   - else
493   - {
494   - $obj_falta = new clsPmieducarFaltaAluno();
495   - $obj_falta->setOrderby("cod_falta_aluno asc");
496   - if($det_curso['padrao_ano_escolar'] == 1)
497   - $det_falta = $obj_falta->lista(null,null,null,$this->ref_cod_serie,$this->ref_cod_escola,$disciplina['ref_cod_disciplina'],$matricula['ref_cod_matricula'],null,null,null,null,null,1);
498   - else
499   - $det_falta = $obj_falta->lista(null,null,null,$this->ref_cod_serie,$this->ref_cod_escola,null,$matricula['ref_cod_matricula'],null,null,null,null,null,1,null,$disciplina['ref_cod_disciplina']);
500   -
501   - $total_faltas = 0;
502   - if(is_array($det_falta))
503   -
504   - foreach ($det_falta as $key => $value)
505   - {
506   - $total_faltas += $det_falta[$key]['faltas'];
507   - }
508   -
509   - $det_falta['total'] = $total_faltas;
510   - }
511   - }
512   -
513   -
514   - if($det_nota){
515   - $soma_notas = 0;
516   -
517   - /*********************COLOCADO*****************/
518   - $notas_primeiro_regular = array();
519   - /*********************COLOCADO*****************/
520   -
521   - foreach ($det_nota as $key => $nota) {
522   -
523   - $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores($nota['ref_ref_cod_tipo_avaliacao'],$nota['ref_sequencial'],null,null,null,null);
524   - $det_tipo_av_val = $obj_tipo_av_val->detalhe();
525   -
526   - if (dbBool($det_serie["ultima_nota_define"]))
527   - {
528   - $soma_notas = $det_tipo_av_val["valor"];
529   - }
530   - else
531   - {
532   - $soma_notas += $det_tipo_av_val['valor'];
533   - }
534   - if ( count($this->array_modulos) == count($det_nota) )
535   - {
536   - $frequencia_minima = $det_curso["frequencia_minima"];
537   - $hora_falta = $det_curso["hora_falta"];
538   - $carga_horaria_curso = $det_curso["carga_horaria"];
539   -
540   -
541   - }
542   -
543   - if ($det_tipo_av_val['conceitual'] )
544   - $aprovado = $this->aprovado; // situacao definida pelo professor
545   - else if( (count($this->array_modulos) <= $nota['modulo']) && ($aprovado == 3) && !$det_tipo_av_val['conceitual'] )
546   - $aprovado = 1; // aluno aprovado
547   -
548   - /**
549   - *
550   - */
551   - if($key < (count($this->array_modulos)) )
552   - {
553   - /**
554   - * variavel de controle para verificacao de media
555   - */
556   - $media_sem_exame = true;
557   -
558   - //$det_tipo_av_val['valor'] = $det_tipo_av_val['valor'] ? $det_tipo_av_val['valor'] : '0,0';
559   - if($det_tipo_av_val['valor'])
560   - $nota = sprintf("%01.1f",$det_tipo_av_val['valor']);
561   - else
562   - $nota = "-";
563   -
564   - if($this->em_branco)
565   - $nota = "";
566   -
567   - $nota = $dispensas[$key] ? "D" : str_replace(".",",",$nota);
568   -
569   - $this->pdf->escreve_relativo( $nota, $anos_x + 10,$this->page_y + 2, ($incremental/3), $altura, $fonte, 9, $corTexto, 'center' );
570   - if($det_curso['falta_ch_globalizada'])
571   - {//
572   -
573   - $falta = " - ";
574   - }
575   - else
576   - {
577   - if($det_falta[$key]['faltas'])
578   - $falta = $det_falta[$key]['faltas'];
579   - else
580   - $falta = "0";
581   - }
582   -
583   - if($this->em_branco)
584   - $falta = "";
585   - $falta = $dispensas[$key] ? "D" : $falta;
586   - $this->pdf->escreve_relativo( $falta, $anos_x +($incremental/2)+ 10,$this->page_y + 2, ($incremental/3), $altura, $fonte, 9, $corTexto, 'center' );
587   - if(count($this->array_modulos) == count($det_nota) && $key == count($det_nota) - 1)
588   - {
589   -
590   - $this->pdf->escreve_relativo( $this->em_branco?"":"-", $anos_x +$incremental/3+$incremental,$this->page_y + 2, ($incremental/3), $altura, $fonte, 9, $corTexto, 'center' );
591   - }
592   -
593   - }
594   - else
595   - {
596   - /**
597   - * variavel de controle para verificacao de media
598   - */
599   - $media_sem_exame = false;
600   - if($this->curso_com_exame && ($det_matricula['aprovado'] == 1 || $det_matricula['aprovado'] == 2) )
601   - {
602   - $nota = sprintf("%01.2f",$det_nota[$key]['nota']);
603   - $nota = str_replace(".",",",$nota);
604   - $nota = $dispensas[$key] ? "D" : $nota;
605   - $this->pdf->escreve_relativo($nota/*$det_tipo_av_val['nome']*/, $anos_x +$incremental/3,$this->page_y + 2, ($incremental/3), $altura, $fonte, 9, $corTexto, 'center' );
606   -
607   - /****************COLOCADO*********************/
608   - $nota_exame = true;
609   - $exame_nota = $det_nota[$key]["nota"];
610   - /****************COLOCADO*********************/
611   -
612   - }
613   - }
614   -
615   -
616   - $anos_x += $incremental;
617   -
618   - $reta_ano_x += $incremental;
619   - }
620   -
621   -
622   - /****************COLOCADO*********************/
623   - if (!dbBool($det_serie["ultima_nota_define"]))
624   - {
625   - if (!$nota_exame)
626   - {
627   - $media = $soma_notas / count($det_nota); //soh esta parte eh do codigo original
628   - $media_ = $media;
629   - }
630   - else
631   - {
632   - $media = ($soma_notas + $exame_nota * 2) / (count($det_nota)+1);
633   - }
634   - }
635   - else
636   - {
637   - $media = $soma_notas;
638   - }
639   -// $nota_exame = false;
640   - /****************COLOCADO*********************/
641   -
642   - /****************COLOCADO*********************/
643   - $det_media = array();
644   - if ($media >= $det_curso['media'] || $nota_exame) {
645   - $obj_media = new clsPmieducarTipoAvaliacaoValores();
646   - $det_media = $obj_media->lista($det_curso['ref_cod_tipo_avaliacao'],$det_curso['ref_sequencial'],null,null,$media,$media);
647   - }
648   - $nota_exame =false;
649   - if($det_media && is_array($det_media))
650   - {
651   - $det_media = array_shift($det_media);
652   - $media = $det_media['valor'];
653   - $media = sprintf("%01.1f",$media);
654   - $media = str_replace(".",",",$media);
655   - }
656   - elseif (dbBool($det_serie["ultima_nota_define"]))
657   - {
658   - $media = sprintf("%01.1f",$media);
659   - $media = str_replace(".",",",$media);
660   - }
661   - if(count($det_nota) <= count($this->array_modulos) && $this->curso_com_exame)
662   - {
663   - $anos_x += $incremental;
664   -
665   - $reta_ano_x += $incremental;
666   - }
667   -
668   - if( count($det_nota) == 4 && ($det_matricula['aprovado'] == 1 || $det_matricula['aprovado'] == 2 || !(($det_matricula['aprovado'] == 7 || (str_replace(",",".",$media) < $media_curso_ && !$nota_exame)))))
669   - {
670   - if ($dispensas[$key])
671   - $this->pdf->escreve_relativo( "D", $anos_x +5,$this->page_y + 2, ($incremental/3), $altura, $fonte, 9, $corTexto, 'center' );
672   - else
673   - $this->pdf->escreve_relativo( $media, $anos_x +5,$this->page_y + 2, ($incremental/3), $altura, $fonte, 9, $corTexto, 'center' );
674   - }
675   - else
676   - {
677   - $this->pdf->escreve_relativo( "-", $anos_x +5,$this->page_y + 2, ($incremental/3), $altura, $fonte, 9, $corTexto, 'center' );
678   - }
679   - if($det_curso['falta_ch_globalizada'])
680   - {
681   -
682   - $falta = " - ";
683   - }
684   - else
685   - {
686   - if($det_falta['total'])
687   - $falta = $det_falta['total'];
688   - else
689   - $falta = "0";
690   - }
691   - if($this->em_branco)
692   - $falta = "";
693   - $falta = $dispensas[$key] ? "D" : $falta;
694   - $this->pdf->escreve_relativo( $falta, $anos_x +($incremental/2)+2,$this->page_y + 2, ($incremental/3), $altura, $fonte, 9, $corTexto, 'center' );
695   -
696   -
697   - }
698   - $anos_x += $incremental;
699   -
700   - $reta_ano_x += $incremental;
701   - $sit = "";
702   -
703   - if($completo){
704   -
705   - if($media_sem_exame)
706   - $media_curso_ = $det_curso['media'];
707   - else
708   - $media_curso_ = $det_curso['media_exame'];
709   -
710   -
711   -// $sit = (str_replace(",",".",$media_) >= $media_curso_)? "APROVADO" : "REPROVADO";
712   -
713   - $sit = (str_replace(",",".",$media) >= $media_curso_)? "APROVADO" : "REPROVADO";
714   - $sit = ($det_matricula['aprovado'] == 3 && str_replace(",",".",$media) >= $media_curso_)? "APROVADO" : $sit;
715   -
716   -// $sit = ($det_matricula['aprovado'] == 3)? "EM ANDAMENTO" : $sit; //original
717   - /********COLOCADO****************/
718   - if ($det_matricula["aprovado"] != 1 && $det_matricula["aprovado"] != 2)
719   - $sit = ($det_matricula['aprovado'] == 7 || (str_replace(",",".",$media) < $media_curso_ && !$nota_exame))? "EM EXAME" : $sit;
720   - /********COLOCADO****************/
721   -// $sit = ($det_matricula['aprovado'] == 7)? "EM EXAME" : $sit;//original
722   -
723   - if($this->em_branco)
724   - $sit = "";
725   - $sit = $dispensas[$key] ? "D" : $sit;
726   - $this->pdf->escreve_relativo(/*($det_media['nota'] >= $media_curso)*//*$det_media*/$sit, $anos_x -12,$this->page_y + 2, $incremental, $altura, $fonte, 8, $corTexto, 'center' );
727   -
728   - }
729   -
730   - $this->page_y +=$altura_linha;
731   -
732   - /**
733   - *
734   - */
735   - }
736   - if($det_curso['falta_ch_globalizada'])
737   - {
738   -
739   -
740   - $this->pdf->quadrado_relativo( 30, $this->page_y , 782, $altura_linha,0.5);
741   - $fonte_dis = 7;//(strlen($det_disc['nm_disciplina']) > 40 )? 7 : 9;
742   - $this->pdf->escreve_relativo("TOTAL FALTAS" , 80 ,$this->page_y +2,170, 15, $fonte, 8, $corTexto, 'left' );
743   -
744   - $reta_ano_x = 209 ;
745   - $anos_x = 209;
746   -
747   - if(is_array($det_falta))
748   - $total_faltas = array_pop($det_falta);
749   -
750   - if($det_falta)
751   - foreach ($det_falta as $key => $value)
752   - {
753   - $incr = $anos_x +($incremental/2)+ 10;
754   - if(count($det_nota) <= count($this->array_modulos) && $this->curso_com_exame && (count($det_falta) == $key))
755   - {
756   - $incr = $anos_x +($incremental/3);
757   - }
758   -
759   - $this->pdf->escreve_relativo($det_falta[$key]['faltas']? $det_falta[$key]['faltas'] : "0" , $incr,$this->page_y + 2, ($incremental/3), $altura, $fonte, 9, $corTexto, 'center' );
760   -
761   - $anos_x += $incremental;
762   -
763   - $reta_ano_x += $incremental;
764   -
765   - }
766   - $reta_ano_x += $incremental;
767   - if(count($det_nota) >= count($this->array_modulos) && $this->curso_com_exame)
768   - {
769   - $anos_x += $incremental;
770   -
771   - $reta_ano_x += $incremental;
772   - }
773   -
774   -
775   -
776   - //$this->pdf->escreve_relativo($total_faltas? $total_faltas : "-" , $anos_x +($incremental/2)+5,$this->page_y + 5, ($incremental/3), $altura, $fonte, 9, $corTexto, 'center' );
777   -
778   - $this->page_y +=$altura_linha;
779   - }
780   -
781   - $this->desenhaLinhasVertical();
782   - $sit = "";
783   -
784   - if($completo)
785   - {
786   - if($det_matricula['aprovado'] == 1 )
787   - $sit = "APROVADO";
788   - elseif ($det_matricula['aprovado'] == 2)
789   - $sit = "REPROVADO";
790   - elseif ($det_matricula['aprovado'] == 7)
791   - $sit = "EM EXAME";
792   - }
793   - if($sit)
794   - $this->pdf->escreve_relativo( "ALUNO ".$sit , 150,$this->page_y + 30, 530, $altura, $fonte, 9, $corTexto, 'center' );
795   - $this->rodape();
796   -
797   - $this->page_y += 50;
798   -
799   - $this->pdf->linha_relativa(30,$this->page_y - 15,785,0,0.1);
800   -
801   - if(!$flag_tamanho)
802   - $tamanho = $this->page_y - $tamanho;
803   - }
804   -
805   - //$this->rodape();
806   -
807   -
808   - }
809   - /**
810   - * conceitual
811   - */
812   - else
813   - {
814   - $this->pdf = new clsPDF("Alunos Matriculados - {$this->ano}", "Alunos Matriculados - Sintético", "A4", "", false, false);
815   - foreach ($lista_matricula as $matricula)
816   - {
817   -
818   - if(!$this->em_branco)
819   - {
820   - $obj_matricula = new clsPmieducarMatricula($matricula['ref_cod_matricula']);
821   - $det_matricula = $obj_matricula->detalhe();
822   - $this->ref_cod_matricula = $matricula['ref_cod_matricula'];
823   - $this->nm_aluno = $matricula['nome_aluno'];
824   - }
825   -
826   - $page_open = false;
827   - if($lst_disc_serie)
828   - {
829   - foreach ($lst_disc_serie as $disciplina)
830   - {
831   - if(!$page_open)
832   - {
833   - $x_quadrado = 30;
834   - $this->page_y = 95;
835   - $altura_caixa = 85;
836   - $this->pdf->OpenPage();
837   - $this->addCabecalhoc();
838   - $this->addCabecalhoc2();
839   -
840   - $page_open = true;
841   - }
842   - $altura_caixa = 15 + (int)((strlen($disciplina['nm_disciplina']) / 60 ) * 7) ;
843   - $this->pdf->quadrado_relativo( 30, $this->page_y, 535, $altura_caixa );
844   - $this->pdf->linha_relativa( 440, $this->page_y, 0, $altura_caixa, '0.1');
845   - $this->pdf->escreve_relativo($disciplina['nm_disciplina'],35,$this->page_y + 5,400,120,"arial","8","#000000","justify");
846   -
847   -
848   - if(!$this->em_branco)
849   - {
850   - $obj_nota = new clsPmieducarNotaAluno();
851   - $obj_nota->setOrderby("cod_nota_aluno asc");
852   -
853   - if($det_curso['padrao_ano_escolar'] == 1)
854   - $det_nota = $obj_nota->lista(null,nul,null,$this->ref_cod_serie,$this->ref_cod_escola,$disciplina['ref_cod_disciplina'],$matricula['ref_cod_matricula'],null,null,null,null,null,null,1,null);
855   - else
856   - $det_nota = $obj_nota->lista(null,nul,null,$this->ref_cod_serie,$this->ref_cod_escola,$disciplina['ref_cod_disciplina'],$matricula['ref_cod_matricula'],null,null,null,null,null,null,1,null,null);
857   -// $det_nota = $obj_nota->lista(null,nul,null,$this->ref_cod_serie,$this->ref_cod_escola,null,$matricula['ref_cod_matricula'],null,null,null,null,null,null,1,null,$disciplina['ref_cod_disciplina']);
858   - }
859   -
860   - $x_bim = 440 + 31;
861   - for ($i=1;$i <= 4;$i++)
862   - {
863   - if(is_array($det_nota))
864   - {
865   - $nota = array_shift($det_nota);
866   - $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores($nota['ref_ref_cod_tipo_avaliacao'],$nota['ref_sequencial'],null,null,null,null);
867   - $det_tipo_av_val = $obj_tipo_av_val->detalhe();
868   -
869   - }
870   - else
871   - $det_tipo_av_val = null;
872   - if($i<=3)
873   - $this->pdf->linha_relativa( $x_bim, $this->page_y, 0, $altura_caixa, '0.1');
874   - $this->pdf->escreve_relativo("{$det_tipo_av_val['nome']}",$x_bim-31,$this->page_y + ($altura_caixa / 3),31,120,"arial","10","#000000","center");
875   - $x_bim += 31;
876   - }
877   -
878   - $this->page_y += $altura_caixa;
879   - }
880   - }
881   - else
882   - {
883   - $x_quadrado = 30;
884   - $this->page_y = 95;
885   - $altura_caixa = 85;
886   - $this->pdf->OpenPage();
887   - $this->addCabecalhoc();
888   - $this->addCabecalhoc2();
889   -
890   - $page_open = true;
891   - }
892   -
893   - ////////////////////
894   - $this->pdf->quadrado_relativo( 30, $this->page_y, 535, 15 );
895   - $this->pdf->linha_relativa( 440, $this->page_y, 0, 15, '0.1');
896   - $this->pdf->escreve_relativo("TOTAL DE FALTAS",35,$this->page_y + 2,400,120,"arial","8","#000000","justify");
897   - if($det_curso['falta_ch_globalizada'])
898   - {
899   -
900   - if(!$this->em_branco)
901   - {
902   - $obj_falta = new clsPmieducarFaltas();
903   - $obj_falta->setOrderby("sequencial asc");
904   - $det_falta = $obj_falta->lista($matricula['ref_cod_matricula'],null,null,null,null,null);
905   - }
906   - if(is_array($det_falta))
907   - {
908   - $total_faltas = 0;
909   - foreach ($det_falta as $key => $value)
910   - {
911   - $total_faltas += $det_falta[$key]['faltas'] = $value['falta'];
912   - }
913   -
914   - $det_falta['total'] = $total_faltas;
915   -
916   - }
917   - }
918   -
919   - $x_bim = 440 + 31;
920   - for ($i=1;$i <= 4;$i++)
921   - {
922   - if(is_array($det_falta))
923   - {
924   - $falta = array_shift($det_falta);
925   - $falta = $falta['faltas'];
926   -
927   - }
928   - else
929   - $falta = null;
930   - if($i<=3)
931   - $this->pdf->linha_relativa( $x_bim, $this->page_y, 0, 15, '0.1');
932   - $this->pdf->escreve_relativo("$falta",$x_bim-31,$this->page_y + 2,31,120,"arial","10","#000000","center");
933   - $x_bim += 31;
934   - }
935   - /********************COLOCADO*************************/
936   - $obj_matricula_situacao = new clsPmieducarMatricula($matricula["ref_cod_matricula"]);
937   - $obj_matricula_situacao->setCamposLista("aprovado");
938   - $det_matricula_situacao = $obj_matricula_situacao->detalhe();
939   - if ($det_matricula_situacao["aprovado"] == 1)
940   - $situacao = "APROVADO";
941   - elseif ($det_matricula_situacao["aprovado"] == 2)
942   - $situacao = "REPROVADO";
943   - else
944   - $situacao = "EM ANDAMENTO";
945   - $this->pdf->quadrado_relativo( 30, $this->page_y+15, 535, 15 );
946   - $this->pdf->linha_relativa( 440, $this->page_y+15, 0, 15, '0.1');
947   - $this->pdf->escreve_relativo("SITUAÇÃO",35,$this->page_y +15+ 2,400,120,"arial","8","#000000","justify");
948   - $this->pdf->escreve_relativo($situacao, 440, $this->page_y + 15 + 2, 120, 120, "arial", "10", "#000000", "center");
949   - /////////////////////
950   - $this->page_y += 35; //original é 25
951   - /********************COLOCADO*************************/
952   -// $this->page_y += 25; //original
953   -
954   - $this->pdf->escreve_relativo( "LEGENDA: \n
955   - D = Desenvolvida
956   - PD = Parcialmente Desenvolvida
957   - ID = Iniciando o Desenvolvimento
958   - ND = Não Desenvolvida
959   - CNA = Competência Não Avaliada", 36,$this->page_y, 200, 50, $fonte, 7, $corTexto, 'left' );
960   -
961   - $this->page_y += 75;
962   - $altura_obs = 60;
963   -
964   - $this->pdf->quadrado_relativo( 30, $this->page_y , 535, $altura_obs,0.1,"#000000","#FFFFFF" );
965   - $this->pdf->escreve_relativo( "OBS: ",33, $this->page_y + 3 , 545, 60, $fonte, 8, $corTexto, 'justify' );
966   -
967   - $this->pdf->ClosePage();
968   -
969   - }
970   - }
971   -
972   -
973   - }
974   - else
975   - {
976   -
977   - echo '<script>
978   - alert("Turma não possui matrículas no ano selecionado");
979   - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
980   - </script>';
981   -
982   - return;
983   -
984   - }
985   -
986   - $this->pdf->CloseFile();
987   - $this->get_link = $this->pdf->GetLink();
988   - //header( "location: " . $this->pdf->GetLink() );
989   -
990   - //return true;
991   - echo "<script>window.onload=function(){parent.EscondeDiv('LoadImprimir');window.location='download.php?filename=".$this->get_link."'}</script>";
992   -
993   - echo "<html><center>Se o download não iniciar automaticamente <br /><a target='blank' href='" . $this->get_link . "' style='font-size: 16px; color: #000000; text-decoration: underline;'>clique aqui!</a><br><br>
994   - <span style='font-size: 10px;'>Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
995   -
996   - Clique na Imagem para Baixar o instalador<br><br>
997   - <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>
998   - </span>
999   - </center>";
1000   - }
  994 + $this->pdf->CloseFile();
  995 + $this->get_link = $this->pdf->GetLink();
  996 +
  997 + echo sprintf('
  998 + <script>
  999 + window.onload = function()
  1000 + {
  1001 + parent.EscondeDiv("LoadImprimir");
  1002 + window.location="download.php?filename=%s"
  1003 + }
  1004 + </script>', $this->get_link);
  1005 +
  1006 + echo sprintf('
  1007 + <html>
  1008 + <center>
  1009 + 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>
  1010 + <span style="font-size: 10px;">Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
  1011 + Clique na Imagem para Baixar o instalador<br><br>
  1012 + <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>
  1013 + </span>
  1014 + </center>
  1015 + </html>', $this->get_link);
  1016 + }
1001 1017  
1002 1018 function addCabecalho()
1003 1019 {
... ... @@ -1023,127 +1039,132 @@ class indice extends clsCadastro
1023 1039 $this->pdf->insertImageScaled('gif', $logo, 50, $this->page_y + 52, 41);
1024 1040  
1025 1041 // Título principal
1026   - $titulo = $config->get($config->titulo, "i-Educar");
  1042 + $titulo = $config->get($config->titulo, 'i-Educar');
1027 1043 $this->pdf->escreve_relativo($titulo, 30,
1028 1044 $this->page_y + 2, 782, 80, $fonte, 18, $corTexto, 'center');
1029 1045  
1030 1046 // Dados escola
1031   - $this->pdf->escreve_relativo("Instituição: $this->nm_instituicao", 110,
  1047 + $this->pdf->escreve_relativo('Instituição: ' . $this->nm_instituicao, 110,
1032 1048 $this->page_y + 27, 400, 80, $fonte, 10, $corTexto, 'left');
1033   - $this->nm_escola || $this->em_branco? $this->pdf->escreve_relativo( "Escola: {$this->nm_escola}",127, $this->page_y + 43, 300, 80, $fonte, 10, $corTexto, 'left' ) : NULL;
  1049 +
  1050 + $this->nm_escola || $this->em_branco? $this->pdf->escreve_relativo(
  1051 + 'Escola: ' . $this->nm_escola, 127, $this->page_y + 43, 300, 80, $fonte,
  1052 + 10, $corTexto, 'left') : NULL;
1034 1053 $dif = 0;
1035 1054  
1036 1055 if ($this->nm_professor) {
1037   - $this->pdf->escreve_relativo("Prof.Regente: {$this->nm_professor}",
  1056 + $this->pdf->escreve_relativo('Prof. Regente: ' . $this->nm_professor,
1038 1057 111, $this->page_y + 36, 300, 80, $fonte, 7, $corTexto, 'left');
1039 1058 }
1040 1059 else {
1041 1060 $dif = 15;
1042 1061 }
1043 1062  
1044   - $this->pdf->quadrado_relativo(30, $this->page_y + 68, 782, 12,$espessura_linha);
1045   - $this->pdf->quadrado_relativo(30, $this->page_y + 83, 782, 12,$espessura_linha);
1046   - $this->pdf->escreve_relativo("Aluno: ".$this->nm_aluno,37, $this->page_y + 70,
  1063 + $this->pdf->quadrado_relativo(30, $this->page_y + 68, 782, 12, $espessura_linha);
  1064 +
  1065 + $this->pdf->quadrado_relativo(30, $this->page_y + 83, 782, 12, $espessura_linha);
  1066 +
  1067 + $this->pdf->escreve_relativo('Aluno: ' . $this->nm_aluno, 37, $this->page_y + 70,
1047 1068 200, 80, $fonte, 7, $corTexto, 'left');
1048   - $this->pdf->escreve_relativo("Matricula: ".str2upper($this->ref_cod_matricula),
  1069 +
  1070 + $this->pdf->escreve_relativo('Matricula: ' . str2upper($this->ref_cod_matricula),
1049 1071 222, $this->page_y + 70, 300, 80, $fonte, 7, $corTexto, 'left');
1050   - $this->pdf->escreve_relativo("Turma: ".str2upper($this->nm_turma),300,
  1072 +
  1073 + $this->pdf->escreve_relativo('Turma: ' . str2upper($this->nm_turma), 300,
1051 1074 $this->page_y + 70, 300, 80, $fonte, 7, $corTexto, 'left');
1052 1075  
1053   - $this->pdf->escreve_relativo("Curso: $this->nm_curso",37, $this->page_y + 85,
  1076 + $this->pdf->escreve_relativo('Curso: ' . $this->nm_curso, 37, $this->page_y + 85,
1054 1077 300, 80, $fonte, 7, $corTexto, 'left');
1055   - $this->pdf->escreve_relativo("Ano/Série/Etapa: " . ($this->nm_serie ? str2upper($this->nm_serie) : $this->ano),
  1078 +
  1079 + $this->pdf->escreve_relativo('Ano/Série/Etapa: ' .
  1080 + ($this->nm_serie ? str2upper($this->nm_serie) : $this->ano),
1056 1081 200, $this->page_y + 85, 300, 80, $fonte, 7, $corTexto, 'left');
1057 1082  
1058 1083 // Título
1059   - $this->pdf->escreve_relativo("Boletim Escolar - $this->ano", 30,
  1084 + $this->pdf->escreve_relativo('Boletim Escolar - ' . $this->ano, 30,
1060 1085 $this->page_y + 30, 782, 80, $fonte, 12, $corTexto, 'center');
1061 1086  
1062 1087 $obj_modulo = new clsPmieducarModulo($this->ref_cod_modulo);
  1088 +
1063 1089 $det_modulo = $obj_modulo->detalhe();
1064 1090  
1065 1091 // Data
1066   - $this->pdf->escreve_relativo("Data de Emissão: " . date("d/m/Y"), 700,
  1092 + $this->pdf->escreve_relativo('Data de Emissão: ' . date('d/m/Y'), 700,
1067 1093 $this->page_y + 50, 535, 80, $fonte, 8, $corTexto, 'left');
  1094 +
1068 1095 $this->page_y +=100;
1069 1096 $this->novoCabecalho();
1070 1097 }
1071 1098  
1072 1099  
1073   - function desenhaLinhasVertical()
1074   - {
1075   -
1076   - /**
1077   - *
1078   - */
1079   -
1080   - $espessura_linha = 0.5;
1081   - $largura_anos = 620;
1082   -
1083   - if(count($this->array_modulos) + $this->curso_com_exame >= 1)
1084   - {
1085   -
1086   - $incremental = floor($largura_anos/ (count($this->array_modulos) + $this->curso_com_exame + 2/*situacao*/)) ;
1087   -
1088   - }else {
1089   -
1090   - $incremental = 1;
1091   - }
1092   -
1093   - $reta_ano_x = 209 ;
1094   -
1095   - $resto = $largura_anos - ($incremental * (count($this->array_modulos) + $this->curso_com_exame + 1 /*situacao*/));
1096   -
1097   - for($linha = 0;$linha <count($this->array_modulos) + $this->curso_com_exame + 2 ;$linha++)
1098   - {
  1100 + function desenhaLinhasVertical()
  1101 + {
  1102 + $espessura_linha = 0.5;
  1103 + $largura_anos = 620;
1099 1104  
1100   - $this->pdf->linha_relativa($reta_ano_x,$this->inicio_y,0,$this->page_y - $this->inicio_y ,$espessura_linha);
  1105 + if (count($this->array_modulos) + $this->curso_com_exame >= 1) {
  1106 + $incremental = floor($largura_anos / (count($this->array_modulos) + $this->curso_com_exame + 2));
  1107 + }
  1108 + else {
  1109 + $incremental = 1;
  1110 + }
1101 1111  
1102   - if(($this->curso_com_exame && $linha != count($this->array_modulos) && $linha != count($this->array_modulos)+2) || (!$this->curso_com_exame && $linha != (count($this->array_modulos) + 1 )) )
1103   - $this->pdf->linha_relativa($reta_ano_x+($incremental/2),$this->inicio_y + 12 ,0,$this->page_y - $this->inicio_y - 12,$espessura_linha);
  1112 + $reta_ano_x = 209 ;
1104 1113  
1105   - $reta_ano_x += $incremental;
  1114 + $resto = $largura_anos - ($incremental * (count($this->array_modulos) + $this->curso_com_exame + 1));
1106 1115  
  1116 + for ($linha = 0;$linha <count($this->array_modulos) + $this->curso_com_exame + 2 ;$linha++) {
  1117 + $this->pdf->linha_relativa($reta_ano_x,$this->inicio_y,0,$this->page_y - $this->inicio_y ,$espessura_linha);
1107 1118  
  1119 + if (
  1120 + ($this->curso_com_exame && $linha != count($this->array_modulos) && $linha != count($this->array_modulos) + 2) ||
  1121 + (!$this->curso_com_exame && $linha != count($this->array_modulos) + 1)
  1122 + ) {
  1123 + $this->pdf->linha_relativa($reta_ano_x + ($incremental / 2),
  1124 + $this->inicio_y + 12, 0, $this->page_y - $this->inicio_y - 12,
  1125 + $espessura_linha);
  1126 + }
1108 1127  
1109   - }
  1128 + $reta_ano_x += $incremental;
  1129 + }
1110 1130  
1111   - $this->pdf->linha_relativa(812,$this->inicio_y,0,$this->page_y - $this->inicio_y,$espessura_linha);
  1131 + $this->pdf->linha_relativa(812, $this->inicio_y, 0,
  1132 + $this->page_y - $this->inicio_y,$espessura_linha);
  1133 + }
1112 1134  
  1135 + function rodape()
  1136 + {
  1137 + $corTexto = '#000000';
  1138 + $fonte = 'arial';
  1139 + $dataAtual = date('d/m/Y');
1113 1140  
1114   - /**
1115   - *
1116   - */
1117   - }
  1141 + $this->pdf->escreve_relativo('Data: ' . $dataAtual, 36, $this->page_y + 2,
  1142 + 100, 50, $fonte, 7, $corTexto, 'left');
1118 1143  
1119   - function rodape()
1120   - {
1121   - $corTexto = '#000000';
1122   - $fonte = 'arial';
1123   - $dataAtual = date("d/m/Y");
1124   - $this->pdf->escreve_relativo( "Data: $dataAtual", 36,$this->page_y + 2, 100, 50, $fonte, 7, $corTexto, 'left' );
  1144 + if (!$this->em_branco) {
  1145 + $this->pdf->escreve_relativo('Estou ciente do aproveitamento de ' .
  1146 + str2upper($this->nm_aluno) . ', matrícula nº: ' . $this->ref_cod_matricula . '.',
  1147 + 68, $this->page_y + 12, 600, 50, $fonte, 9, $corTexto, 'left');
  1148 + }
1125 1149  
1126   - if(!$this->em_branco)
1127   - $this->pdf->escreve_relativo( "Estou ciente do aproveitamento de ".str2upper($this->nm_aluno).", matrícula nº: $this->ref_cod_matricula.", 68,$this->page_y +12, 600, 50, $fonte, 9, $corTexto, 'left' );
  1150 + $this->pdf->escreve_relativo('Assinatura do Responsável(a)', 677,
  1151 + $this->page_y + 18, 200, 50, $fonte, 7, $corTexto, 'left');
1128 1152  
1129   - $this->pdf->escreve_relativo( "Assinatura do Responsável(a)", 677,$this->page_y +18, 200, 50, $fonte, 7, $corTexto, 'left' );
1130   - $this->pdf->linha_relativa(660,$this->page_y+18,130,0,0.4);
1131   - }
  1153 + $this->pdf->linha_relativa(660, $this->page_y + 18, 130, 0, 0.4);
  1154 + }
1132 1155  
1133   - function Editar()
1134   - {
1135   - return false;
1136   - }
  1156 + function Editar()
  1157 + {
  1158 + return FALSE;
  1159 + }
1137 1160  
1138   - function Excluir()
1139   - {
1140   - return false;
1141   - }
  1161 + function Excluir()
  1162 + {
  1163 + return FALSE;
  1164 + }
1142 1165  
1143 1166 public function novoCabecalho()
1144 1167 {
1145   -
1146   -
1147 1168 $altura2 = 300;
1148 1169 $altura = 50;
1149 1170 $espessura_linha = 0.5;
... ... @@ -1154,13 +1175,14 @@ class indice extends clsCadastro
1154 1175  
1155 1176 $inicio_escrita_y = $this->page_y;
1156 1177  
1157   - $this->pdf->linha_relativa(30,$this->page_y ,782,0,$espessura_linha);
1158   - $this->pdf->escreve_relativo( 'Disciplina', 110,$this->page_y , 50, $altura, $fonte, 9, $corTexto, 'left' );
  1178 + $this->pdf->linha_relativa(30, $this->page_y, 782, 0, $espessura_linha);
1159 1179  
1160   - $this->pdf->linha_relativa(30,$this->page_y,0,25,$espessura_linha);
  1180 + $this->pdf->escreve_relativo('Disciplina', 110, $this->page_y, 50, $altura,
  1181 + $fonte, 9, $corTexto, 'left');
1161 1182  
1162   - $largura_anos = 605;
  1183 + $this->pdf->linha_relativa(30, $this->page_y, 0, 25, $espessura_linha);
1163 1184  
  1185 + $largura_anos = 605;
1164 1186  
1165 1187 if (sizeof($this->array_modulos) + $this->curso_com_exame + 2 >= 1) {
1166 1188 $incremental = (int) ceil($largura_anos / (sizeof($this->array_modulos) + $this->curso_com_exame + 2));
... ... @@ -1170,18 +1192,21 @@ class indice extends clsCadastro
1170 1192 }
1171 1193  
1172 1194 $reta_ano_x = 209 ;
1173   - $anos_x = 209;
  1195 + $anos_x = 209;
1174 1196  
1175 1197 $ct = 0;
1176 1198  
1177 1199 $num_modulo = 1;
1178 1200  
1179 1201 foreach ($this->array_modulos as $key => $modulo) {
1180   - $this->pdf->escreve_relativo($num_modulo++."º ".$modulo['nm_tipo'], $anos_x ,$inicio_escrita_y + 1, $incremental, $altura, $fonte, 9, $corTexto, 'center' );
  1202 + $this->pdf->escreve_relativo($num_modulo++ . 'º ' . $modulo['nm_tipo'],
  1203 + $anos_x ,$inicio_escrita_y + 1, $incremental, $altura, $fonte, 9,
  1204 + $corTexto, 'center');
1181 1205  
1182 1206 // Médias
1183 1207 $this->pdf->escreve_relativo('Nota', $anos_x + 8, $inicio_escrita_y + 12,
1184 1208 ($incremental / 3), $altura, $fonte, 9, $corTexto, 'center');
  1209 +
1185 1210 $this->pdf->escreve_relativo('Faltas', $anos_x +($incremental / 2) + 8,
1186 1211 $inicio_escrita_y + 12, ($incremental / 3), $altura, $fonte, 9,
1187 1212 $corTexto, 'center');
... ... @@ -1195,6 +1220,7 @@ class indice extends clsCadastro
1195 1220 if ($this->curso_com_exame) {
1196 1221 $this->pdf->escreve_relativo('Exame Final', $anos_x + 5,
1197 1222 $inicio_escrita_y + 4, $incremental, $altura, $fonte, 9, $corTexto, 'center');
  1223 +
1198 1224 $anos_x += $incremental;
1199 1225 $reta_ano_x += $incremental;
1200 1226 }
... ... @@ -1229,100 +1255,108 @@ class indice extends clsCadastro
1229 1255 $config = $coreExt['Config']->app->template->pdf;
1230 1256  
1231 1257 // Variável que controla a altura atual das caixas
1232   - $altura = 30;
1233   - $fonte = 'arial';
  1258 + $altura = 30;
  1259 + $fonte = 'arial';
1234 1260 $corTexto = '#000000';
1235 1261  
1236 1262 // Cabeçalho
1237 1263 $logo = $config->get($config->logo, 'imagens/brasao.gif');
1238 1264  
1239   - $this->pdf->quadrado_relativo( 30, $altura, 535, 85 );
  1265 + $this->pdf->quadrado_relativo(30, $altura, 535, 85);
1240 1266 $this->pdf->insertImageScaled('gif', $logo, 50, 95, 41);
1241 1267  
1242 1268 // Título principal
1243   - $titulo = $config->get($config->titulo, "i-Educar");
  1269 + $titulo = $config->get($config->titulo, 'i-Educar');
1244 1270 $this->pdf->escreve_relativo($titulo, 30, 30, 535, 80, $fonte, 18,
1245 1271 $corTexto, 'center');
1246 1272  
1247 1273 // Dados escola
1248   - $this->pdf->escreve_relativo("Instituição:".str2upper($this->nm_instituicao),
  1274 + $this->pdf->escreve_relativo('Instituição: ' . str2upper($this->nm_instituicao),
1249 1275 120, 50, 300, 80, $fonte, 10, $corTexto, 'left');
1250   - $this->pdf->escreve_relativo("Escola:".str2upper($this->nm_escola),136, 62,
  1276 +
  1277 + $this->pdf->escreve_relativo('Escola: ' . str2upper($this->nm_escola), 136, 62,
1251 1278 380, 80, $fonte, 10, $corTexto, 'left');
1252   - $this->pdf->escreve_relativo("Curso:".str2upper($this->nm_curso)." Turma:" . str2upper($this->nm_turma),
  1279 +
  1280 + $this->pdf->escreve_relativo('Curso: ' . str2upper($this->nm_curso) .
  1281 + ' Turma: ' . str2upper($this->nm_turma),
1253 1282 136, 74, 500, 80, $fonte, 10, $corTexto, 'left');
1254   - $this->pdf->escreve_relativo("Aluno:".str2upper($this->nm_aluno), 136, 86,
  1283 +
  1284 + $this->pdf->escreve_relativo('Aluno: ' . str2upper($this->nm_aluno), 136, 86,
1255 1285 300, 80, $fonte, 10, $corTexto, 'left');
1256 1286  
1257 1287 // Título
1258   - $this->pdf->escreve_relativo("B O L E T I M E S C O L A R", 30, 98, 535,
  1288 + $this->pdf->escreve_relativo('B O L E T I M E S C O L A R', 30, 98, 535,
1259 1289 80, $fonte, 14, $corTexto, 'center');
1260 1290  
1261 1291 // Data
1262 1292 $mes = date('n');
1263 1293 }
1264 1294  
  1295 + function addCabecalhoc2()
  1296 + {
  1297 + $fonte = 'arial';
  1298 + $corTexto = '#000000';
  1299 + $x_quadrado = 30;
  1300 + $altura_caixa = 20;
  1301 +
  1302 + $this->page_y += $altura_caixa;
  1303 +
  1304 + $this->pdf->quadrado_relativo($x_quadrado, $this->page_y + 10, 535, $altura_caixa);
1265 1305  
1266   - function addCabecalhoc2()
1267   - {
1268   - $fonte = 'arial';
1269   - $corTexto = '#000000';
1270   - $x_quadrado = 30;
1271   - $altura_caixa = 20;
1272   -
1273   - $this->page_y += $altura_caixa;
1274   -
1275   - $this->pdf->quadrado_relativo( $x_quadrado, $this->page_y+10, 535, $altura_caixa );
1276   - $this->pdf->escreve_relativo( "COMPETÊNCIAS", 30, $this->page_y + 15, 405, $altura_caixa, $fonte, 9, $corTexto, 'center' );
1277   -
1278   - $this->pdf->linha_relativa( 440, $this->page_y + 10, 0, $altura_caixa, '0.1');
1279   -
1280   - /***************************COLOCADO DENTRO DO IF ORIGINAL************/
1281   - /***************************COLOCADO ELSE TAMBEM**********************/
1282   - if ($this->segue_padrao_escolar)
1283   - {
1284   - $x_bim = 440 + 31;
1285   - for ($i=1;$i <= 4;$i++)
1286   - {
1287   - if($i <= 3)
1288   - $this->pdf->linha_relativa( $x_bim, $this->page_y + 10, 0, $altura_caixa, '0.1');
1289   - $this->pdf->escreve_relativo("{$i}ºBIM",$x_bim-31,$this->page_y + 15,31,120,"arial","10","#000000","center");
1290   - $x_bim += 31;
1291   - }
1292   - $this->page_y += $altura_caixa + 10;
1293   - }
1294   - else
1295   - {
1296   - $x_bim = 440 + 31;
1297   - for ($i=1;$i <= 4;$i++)
1298   - {
1299   - if($i <= 3)
1300   - $this->pdf->linha_relativa( $x_bim, $this->page_y + 10, 0, $altura_caixa, '0.1');
1301   - $this->pdf->escreve_relativo($this->mostra_cabecalho_modulo[$i-1],$x_bim-31,$this->page_y + 15,31,120,"arial","10","#000000","center");
1302   - $x_bim += 31;
1303   - }
1304   - $this->page_y += $altura_caixa + 10;
1305   - }
1306   -
1307   - $this->page_y += $altura_caixa + 10;
1308   -
1309   - }
  1306 + $this->pdf->escreve_relativo('COMPETÊNCIAS', 30, $this->page_y + 15, 405,
  1307 + $altura_caixa, $fonte, 9, $corTexto, 'center');
  1308 +
  1309 + $this->pdf->linha_relativa(440, $this->page_y + 10, 0, $altura_caixa, '0.1');
  1310 +
  1311 + if ($this->segue_padrao_escolar) {
  1312 + $x_bim = 440 + 31;
  1313 +
  1314 + for ($i=1;$i <= 4;$i++) {
  1315 + if ($i <= 3) {
  1316 + $this->pdf->linha_relativa($x_bim, $this->page_y + 10, 0, $altura_caixa, '0.1');
  1317 + }
  1318 +
  1319 + $this->pdf->escreve_relativo($i . 'ºBIM', $x_bim - 31, $this->page_y + 15,
  1320 + 31, 120, 'arial', '10', '#000000', 'center');
  1321 +
  1322 + $x_bim += 31;
  1323 + }
  1324 +
  1325 + $this->page_y += $altura_caixa + 10;
  1326 + }
  1327 + else {
  1328 + $x_bim = 440 + 31;
  1329 + for ($i = 1; $i <= 4; $i++) {
  1330 + if($i <= 3) {
  1331 + $this->pdf->linha_relativa($x_bim, $this->page_y + 10, 0, $altura_caixa, '0.1');
  1332 + }
  1333 +
  1334 + $this->pdf->escreve_relativo($this->mostra_cabecalho_modulo[$i-1],
  1335 + $x_bim - 31, $this->page_y + 15, 31, 120, 'arial', '10', '#000000', 'center');
  1336 +
  1337 + $x_bim += 31;
  1338 + }
  1339 +
  1340 + $this->page_y += $altura_caixa + 10;
  1341 + }
  1342 +
  1343 + $this->page_y += $altura_caixa + 10;
  1344 + }
1310 1345 }
1311 1346  
1312 1347 function cmp($a, $b)
1313 1348 {
1314   - return $a["modulo"] > $b["modulo"];
  1349 + return $a['modulo'] > $b['modulo'];
1315 1350 }
1316 1351  
1317   -// cria uma extensao da classe base
  1352 +// Instancia objeto de página
1318 1353 $pagina = new clsIndexBase();
1319   -// cria o conteudo
  1354 +
  1355 +// Instancia objeto de conteúdo
1320 1356 $miolo = new indice();
1321   -// adiciona o conteudo na clsBase
1322   -$pagina->addForm( $miolo );
1323   -// gera o html
1324   -$pagina->MakeAll();
1325 1357  
  1358 +// Atribui o conteúdo à página
  1359 +$pagina->addForm($miolo);
1326 1360  
1327   -?>
1328   -<script>
  1361 +// Gera o código HTML
  1362 +$pagina->MakeAll();
1329 1363 \ No newline at end of file
... ...