function Inicializar()
 {
     $retorno = "Novo";
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     $this->cod_turma_tipo = $_GET["cod_turma_tipo"];
     $obj_permissoes = new clsPermissoes();
     $obj_permissoes->permissao_cadastra(570, $this->pessoa_logada, 7, "educar_turma_tipo_lst.php");
     if (is_numeric($this->cod_turma_tipo)) {
         $obj = new clsPmieducarTurmaTipo($this->cod_turma_tipo);
         $registro = $obj->detalhe();
         if ($registro) {
             foreach ($registro as $campo => $val) {
                 // passa todos os valores obtidos no registro para atributos do objeto
                 $this->{$campo} = $val;
             }
             //$obj_ref_cod_escola = new clsPmieducarEscola( $this->ref_cod_escola );
             //$det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
             //$this->ref_cod_instituicao = $det_ref_cod_escola["ref_cod_instituicao"];
             $this->fexcluir = $obj_permissoes->permissao_excluir(570, $this->pessoa_logada, 7);
             $retorno = "Editar";
         }
     }
     $this->url_cancelar = $retorno == "Editar" ? "educar_turma_tipo_det.php?cod_turma_tipo={$registro["cod_turma_tipo"]}" : "educar_turma_tipo_lst.php";
     $nomeMenu = $retorno == "Editar" ? $retorno : "Cadastrar";
     $localizacao = new LocalizacaoSistema();
     $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "Início", "educar_index.php" => "i-Educar - Escola", "" => "{$nomeMenu} de turma"));
     $this->enviaLocalizacao($localizacao->montar());
     $this->nome_url_cancelar = "Cancelar";
     return $retorno;
 }
 function Inicializar()
 {
     $retorno = "Novo";
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     $this->cod_turma_tipo = $_GET["cod_turma_tipo"];
     $obj_permissoes = new clsPermissoes();
     $obj_permissoes->permissao_cadastra(570, $this->pessoa_logada, 7, "educar_turma_tipo_lst.php");
     if (is_numeric($this->cod_turma_tipo)) {
         $obj = new clsPmieducarTurmaTipo($this->cod_turma_tipo);
         $registro = $obj->detalhe();
         if ($registro) {
             foreach ($registro as $campo => $val) {
                 // passa todos os valores obtidos no registro para atributos do objeto
                 $this->{$campo} = $val;
             }
             //$obj_ref_cod_escola = new clsPmieducarEscola( $this->ref_cod_escola );
             //$det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
             //$this->ref_cod_instituicao = $det_ref_cod_escola["ref_cod_instituicao"];
             $this->fexcluir = $obj_permissoes->permissao_excluir(570, $this->pessoa_logada, 7);
             $retorno = "Editar";
         }
     }
     $this->url_cancelar = $retorno == "Editar" ? "educar_turma_tipo_det.php?cod_turma_tipo={$registro["cod_turma_tipo"]}" : "educar_turma_tipo_lst.php";
     $this->nome_url_cancelar = "Cancelar";
     return $retorno;
 }
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Turma Tipo - Detalhe";
     $this->cod_turma_tipo = $_GET["cod_turma_tipo"];
     $tmp_obj = new clsPmieducarTurmaTipo($this->cod_turma_tipo);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header("location: educar_turma_tipo_lst.php");
         die;
     }
     if (class_exists("clsPmieducarInstituicao")) {
         $obj_instituicao = new clsPmieducarInstituicao($registro["ref_cod_instituicao"]);
         $obj_instituicao_det = $obj_instituicao->detalhe();
         $registro["ref_cod_instituicao"] = $obj_instituicao_det['nm_instituicao'];
     } else {
         $cod_instituicao = "Erro na geração";
         echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarInstituicao\n-->";
     }
     $obj_permissao = new clsPermissoes();
     $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         if ($registro["ref_cod_instituicao"]) {
             $this->addDetalhe(array("Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}"));
         }
     }
     if ($registro["nm_tipo"]) {
         $this->addDetalhe(array("Turma Tipo", "{$registro["nm_tipo"]}"));
     }
     if ($registro["sgl_tipo"]) {
         $this->addDetalhe(array("Sigla", "{$registro["sgl_tipo"]}"));
     }
     $obj_permissao = new clsPermissoes();
     if ($obj_permissao->permissao_cadastra(570, $this->pessoa_logada, 7)) {
         $this->url_novo = "educar_turma_tipo_cad.php";
         $this->url_editar = "educar_turma_tipo_cad.php?cod_turma_tipo={$registro["cod_turma_tipo"]}";
     }
     $this->url_cancelar = "educar_turma_tipo_lst.php";
     $this->largura = "100%";
     $localizacao = new LocalizacaoSistema();
     $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "In&iacute;cio", "educar_index.php" => "i-Educar - Escola", "" => "Detalhe do tipo de turma"));
     $this->enviaLocalizacao($localizacao->montar());
 }
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Turma Tipo - Detalhe";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $this->cod_turma_tipo = $_GET["cod_turma_tipo"];
     $tmp_obj = new clsPmieducarTurmaTipo($this->cod_turma_tipo);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header("location: educar_turma_tipo_lst.php");
         die;
     }
     if (class_exists("clsPmieducarInstituicao")) {
         $obj_instituicao = new clsPmieducarInstituicao($registro["ref_cod_instituicao"]);
         $obj_instituicao_det = $obj_instituicao->detalhe();
         $registro["ref_cod_instituicao"] = $obj_instituicao_det['nm_instituicao'];
     } else {
         $cod_instituicao = "Erro na gera&ccedil;&atilde;o";
         echo "<!--\nErro\nClasse n&atilde;o existente: clsPmieducarInstituicao\n-->";
     }
     $obj_permissao = new clsPermissoes();
     $nivel_usuario = $obj_permissao->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         if ($registro["ref_cod_instituicao"]) {
             $this->addDetalhe(array("Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}"));
         }
     }
     if ($registro["nm_tipo"]) {
         $this->addDetalhe(array("Turma Tipo", "{$registro["nm_tipo"]}"));
     }
     if ($registro["sgl_tipo"]) {
         $this->addDetalhe(array("Sigla", "{$registro["sgl_tipo"]}"));
     }
     $obj_permissao = new clsPermissoes();
     if ($obj_permissao->permissao_cadastra(570, $this->pessoa_logada, 7)) {
         $this->url_novo = "educar_turma_tipo_cad.php";
         $this->url_editar = "educar_turma_tipo_cad.php?cod_turma_tipo={$registro["cod_turma_tipo"]}";
     }
     $this->url_cancelar = "educar_turma_tipo_lst.php";
     $this->largura = "100%";
 }
    function Gerar()
    {
        @session_start();
        $this->pessoa_logada = $_SESSION['id_pessoa'];
        session_write_close();
        $this->titulo = 'Matricula Turma - Detalhe';
        $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet');
        foreach ($_POST as $key => $value) {
            $this->{$key} = $value;
        }
        if (!$this->ref_cod_matricula) {
            header('Location: educar_matricula_lst.php');
            die;
        }
        $obj_mat_turma = new clsPmieducarMatriculaTurma();
        $det_mat_turma = $obj_mat_turma->lista($this->ref_cod_matricula, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
        if ($det_mat_turma) {
            $det_mat_turma = array_shift($det_mat_turma);
            $obj_turma = new clsPmieducarTurma($det_mat_turma['ref_cod_turma']);
            $det_turma = $obj_turma->detalhe();
            $this->nm_turma = $det_turma['nm_turma'];
            $this->ref_cod_turma_origem = $det_turma['cod_turma'];
            $this->sequencial = $det_mat_turma['sequencial'];
        }
        // #TODO adicionar ano da matricula atual
        #$tmp_obj = new clsPmieducarMatriculaTurma( );
        #$lista = $tmp_obj->lista(NULL, $this->ref_cod_turma, NULL, NULL, NULL, NULL,
        #  NULL, NULL, 1);
        #$total_alunos = 0;
        #if ($lista) {
        #  $total_alunos = count($lista);
        #}
        $tmp_obj = new clsPmieducarTurma();
        $lst_obj = $tmp_obj->lista($this->ref_cod_turma);
        $registro = array_shift($lst_obj);
        $db = new clsBanco();
        $ano = $db->CampoUnico("select ano from pmieducar.matricula where cod_matricula = {$this->ref_cod_matricula}");
        $sql = "select count(cod_matricula) as qtd_matriculas from pmieducar.matricula, pmieducar.matricula_turma, pmieducar.aluno where aluno.cod_aluno = matricula.ref_cod_aluno and ano = {$ano} and aluno.ativo = 1 and matricula.ativo = 1 and matricula_turma.ativo = matricula.ativo and cod_matricula = ref_cod_matricula and ref_cod_turma = {$this->ref_cod_turma}";
        $total_alunos = $db->CampoUnico($sql);
        $this->ref_cod_curso = $registro['ref_cod_curso'];
        if (!$registro || !$_POST) {
            header('Location: educar_matricula_lst.php');
            die;
        }
        // Tipo da turma
        $obj_ref_cod_turma_tipo = new clsPmieducarTurmaTipo($registro['ref_cod_turma_tipo']);
        $det_ref_cod_turma_tipo = $obj_ref_cod_turma_tipo->detalhe();
        $registro['ref_cod_turma_tipo'] = $det_ref_cod_turma_tipo['nm_tipo'];
        // Código da instituição
        $obj_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']);
        $obj_cod_instituicao_det = $obj_cod_instituicao->detalhe();
        $registro['ref_cod_instituicao'] = $obj_cod_instituicao_det['nm_instituicao'];
        // Nome da escola
        $obj_ref_cod_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']);
        $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
        $registro['ref_ref_cod_escola'] = $det_ref_cod_escola['nome'];
        // Nome do curso
        $obj_ref_cod_curso = new clsPmieducarCurso($registro['ref_cod_curso']);
        $det_ref_cod_curso = $obj_ref_cod_curso->detalhe();
        $registro['ref_cod_curso'] = $det_ref_cod_curso['nm_curso'];
        $padrao_ano_escolar = $det_ref_cod_curso['padrao_ano_escolar'];
        // Nome da série
        $obj_ser = new clsPmieducarSerie($registro['ref_ref_cod_serie']);
        $det_ser = $obj_ser->detalhe();
        $registro['ref_ref_cod_serie'] = $det_ser['nm_serie'];
        // Matrícula
        $obj_ref_cod_matricula = new clsPmieducarMatricula();
        $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista($this->ref_cod_matricula));
        $obj_aluno = new clsPmieducarAluno();
        $det_aluno = array_shift($det_aluno = $obj_aluno->lista($detalhe_aluno['ref_cod_aluno'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1));
        $obj_escola = new clsPmieducarEscola($this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
        $det_escola = $obj_escola->detalhe();
        $this->addDetalhe(array('Nome do Aluno', $det_aluno['nome_aluno']));
        $objTemp = new clsPmieducarTurma($this->ref_cod_turma);
        $det_turma = $objTemp->detalhe();
        if ($registro['ref_ref_cod_escola']) {
            $this->addDetalhe(array('Escola', $registro['ref_ref_cod_escola']));
        }
        if ($registro['ref_cod_curso']) {
            $this->addDetalhe(array('Curso', $registro['ref_cod_curso']));
        }
        if ($registro['ref_ref_cod_serie']) {
            $this->addDetalhe(array('S&eacute;rie', $registro['ref_ref_cod_serie']));
        }
        //(enturmações) turma atual
        $enturmacoes = new clsPmieducarMatriculaTurma();
        $enturmacoes = $enturmacoes->lista($this->ref_cod_matricula, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
        $this->possuiEnturmacao = !empty($enturmacoes);
        $this->possuiEnturmacaoTurmaDestino = false;
        $this->turmaOrigemMesmaDestino = false;
        $this->addDetalhe(array('<b>Turma selecionada</b>', '<b>' . $registro['nm_turma'] . '</b>'));
        $this->addDetalhe(array('Total de vagas', $registro['max_aluno']));
        if (is_numeric($total_alunos)) {
            $this->addDetalhe(array('Alunos enturmados', $total_alunos));
            $this->addDetalhe(array('Vagas disponíveis', $registro['max_aluno'] - $total_alunos));
        }
        if ($this->possuiEnturmacao) {
            //se possui uma enturmacao mostra o nome, se mais de uma mostra select para selecionar
            if (count($enturmacoes) > 1) {
                $selectEnturmacoes = "<select id='ref_cod_turma_origem' class='obrigatorio'>";
                $selectEnturmacoes .= "<option value=''>Selecione</option>";
                foreach ($enturmacoes as $enturmacao) {
                    if ($enturmacao['ref_cod_turma'] != $this->ref_cod_turma) {
                        $selectEnturmacoes .= "<option value='{$enturmacao['ref_cod_turma']}'>{$enturmacao['nm_turma']}</option>";
                    } elseif (!$this->possuiEnturmacaoTurmaDestino) {
                        $this->possuiEnturmacaoTurmaDestino = true;
                    }
                }
                $selectEnturmacoes .= "</select>";
            } else {
                if ($enturmacoes[0]['ref_cod_turma'] == $this->ref_cod_turma) {
                    $this->possuiEnturmacaoTurmaDestino = true;
                    $this->turmaOrigemMesmaDestino = true;
                }
                $selectEnturmacoes = "<input id='ref_cod_turma_origem' type='hidden' value = '{$enturmacoes[0]['ref_cod_turma']}'/>{$enturmacoes[0]['nm_turma']}";
            }
            $this->addDetalhe(array('<b>Enturmação</b>', $selectEnturmacoes));
        }
        if (!$this->possuiEnturmacaoTurmaDestino) {
            $this->addDetalhe(array('Data da enturmação', '<input onkeypress="formataData(this,event);" value="' . date('d/m/Y') . '" class="geral" type="text" name="data_enturmacao" id="data_enturmacao" size="9" maxlength="10"/>'));
        }
        $this->addDetalhe(array('-', sprintf('
        <form name="formcadastro" method="post" action="educar_matricula_turma_cad.php">
          <input type="hidden" name="ref_cod_matricula" value="">
          <input type="hidden" name="ref_cod_serie" value="">
          <input type="hidden" name="ref_cod_escola" value="">
          <input type="hidden" name="ref_cod_turma_origem" value="%d">
          <input type="hidden" name="ref_cod_turma_destino" value="">
          <input type="hidden" name="data_enturmacao" value="">
          <input type="hidden" name="sequencial" value="%d">
        </form>
      ', $this->ref_cod_turma_origem, $this->sequencial)));
        if ($registro['max_aluno'] - $total_alunos <= 0) {
            $escolaSerie = $this->getEscolaSerie($det_ref_cod_escola['cod_escola'], $det_ser['cod_serie']);
            if ($escolaSerie['bloquear_enturmacao_sem_vagas'] != 1) {
                $msg = sprintf('Atenção! Turma sem vagas! Deseja continuar com a enturmação mesmo assim?');
                $jsEnturmacao = sprintf('if (!confirm("%s")) return false;', $msg);
            } else {
                $msg = sprintf('Enturmação não pode ser realizada,\\n\\no limite de vagas da turma já foi atingido e para esta série e escola foi definido bloqueio de enturmação após atingir tal limite.');
                $jsEnturmacao = sprintf('alert("%s"); return false;', $msg);
            }
        } else {
            $jsEnturmacao = 'if (!confirm("Confirma a enturmação?")) return false;';
        }
        $script = sprintf('
      <script type="text/javascript">

        function enturmar(ref_cod_matricula, ref_cod_turma_destino, tipo){
          document.formcadastro.ref_cod_turma_origem.value = "";

          if(tipo == "transferir") {
            var turmaOrigemId = document.getElementById("ref_cod_turma_origem");
            if (turmaOrigemId && turmaOrigemId.value)
              document.formcadastro.ref_cod_turma_origem.value = turmaOrigemId.value;
            else {
              alert("Por favor, selecione a enturmação a ser transferida.");
              return false;
            }
          }

          %s

          document.formcadastro.ref_cod_matricula.value = ref_cod_matricula;
          document.formcadastro.ref_cod_turma_destino.value = ref_cod_turma_destino;
          document.formcadastro.data_enturmacao.value = document.getElementById("data_enturmacao").value;
          document.formcadastro.submit();
        }

        function removerEnturmacao(ref_cod_matricula, ref_cod_turma_destino) {

          if (! confirm("Confirma remoção da enturmação?"))
            return false;

          document.formcadastro.ref_cod_turma_origem.value = "remover-enturmacao-destino";
          document.formcadastro.ref_cod_matricula.value = ref_cod_matricula;
          document.formcadastro.ref_cod_turma_destino.value = ref_cod_turma_destino;
          document.formcadastro.submit();
        }

      </script>', $jsEnturmacao);
        print $script;
        $canCreate = new clsPermissoes();
        $canCreate = $canCreate->permissao_cadastra(578, $this->pessoa_logada, 7);
        if ($this->possuiEnturmacaoTurmaDestino && $canCreate) {
            $this->array_botao = array('Remover (enturmação) da turma selecionada');
            $this->array_botao_url_script = array("removerEnturmacao({$this->ref_cod_matricula}, {$this->ref_cod_turma})");
        }
        if (!$this->turmaOrigemMesmaDestino && $canCreate) {
            //mover enturmação
            if ($this->possuiEnturmacao) {
                $this->array_botao[] = 'Transferir para turma selecionada';
                $this->array_botao_url_script[] = "enturmar({$this->ref_cod_matricula}, {$this->ref_cod_turma}, \"transferir\")";
            }
            //nova enturmação
            if (!$this->possuiEnturmacaoTurmaDestino && $canCreate) {
                $this->array_botao[] = 'Enturmar na turma selecionada';
                $this->array_botao_url_script[] = "enturmar({$this->ref_cod_matricula}, {$this->ref_cod_turma}, \"nova\")";
            }
        }
        $this->array_botao[] = 'Voltar';
        $this->array_botao_url_script[] = "go(\"educar_matricula_turma_lst.php?ref_cod_matricula={$this->ref_cod_matricula}\");";
        $this->largura = '100%';
    }
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = 'Turma - Detalhe';
     $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet');
     $this->cod_turma = $_GET['cod_turma'];
     $tmp_obj = new clsPmieducarTurma();
     $lst_obj = $tmp_obj->lista($this->cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, array('true', 'false'));
     $registro = array_shift($lst_obj);
     foreach ($registro as $key => $value) {
         $this->{$key} = $value;
     }
     if (!$registro) {
         header('Location: educar_turma_lst.php');
         die;
     }
     if (class_exists('clsPmieducarTurmaTipo')) {
         $obj_ref_cod_turma_tipo = new clsPmieducarTurmaTipo($registro['ref_cod_turma_tipo']);
         $det_ref_cod_turma_tipo = $obj_ref_cod_turma_tipo->detalhe();
         $registro['ref_cod_turma_tipo'] = $det_ref_cod_turma_tipo['nm_tipo'];
     } else {
         $registro['ref_cod_turma_tipo'] = 'Erro na geração';
     }
     if (class_exists('clsPmieducarInfraPredioComodo')) {
         $obj_ref_cod_infra_predio_comodo = new clsPmieducarInfraPredioComodo($registro['ref_cod_infra_predio_comodo']);
         $det_ref_cod_infra_predio_comodo = $obj_ref_cod_infra_predio_comodo->detalhe();
         $registro['ref_cod_infra_predio_comodo'] = $det_ref_cod_infra_predio_comodo['nm_comodo'];
     } else {
         $registro['ref_cod_infra_predio_comodo'] = 'Erro na geração';
     }
     if (class_exists('clsPmieducarInstituicao')) {
         $obj_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']);
         $obj_cod_instituicao_det = $obj_cod_instituicao->detalhe();
         $registro['ref_cod_instituicao'] = $obj_cod_instituicao_det['nm_instituicao'];
     } else {
         $registro['ref_cod_instituicao'] = 'Erro na geração';
     }
     if (class_exists('clsPmieducarEscola')) {
         $this->ref_ref_cod_escola = $registro['ref_ref_cod_escola'];
         $obj_ref_cod_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']);
         $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
         $registro['ref_ref_cod_escola'] = $det_ref_cod_escola['nome'];
     } else {
         $registro['ref_cod_escola'] = 'Erro na geração';
     }
     if (class_exists('clsPmieducarCurso')) {
         $obj_ref_cod_curso = new clsPmieducarCurso($registro['ref_cod_curso']);
         $det_ref_cod_curso = $obj_ref_cod_curso->detalhe();
         $registro['ref_cod_curso'] = $det_ref_cod_curso['nm_curso'];
         $padrao_ano_escolar = $det_ref_cod_curso['padrao_ano_escolar'];
     } else {
         $registro['ref_cod_curso'] = 'Erro na geração';
     }
     if (class_exists('clsPmieducarSerie')) {
         $this->ref_ref_cod_serie = $registro['ref_ref_cod_serie'];
         $obj_ser = new clsPmieducarSerie($registro['ref_ref_cod_serie']);
         $det_ser = $obj_ser->detalhe();
         $registro['ref_ref_cod_serie'] = $det_ser['nm_serie'];
     } else {
         $registro['ref_ref_cod_serie'] = 'Erro na geração';
     }
     $obj_permissoes = new clsPermissoes();
     $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         if ($registro['ref_cod_instituicao']) {
             $this->addDetalhe(array('Instituição', $registro['ref_cod_instituicao']));
         }
     }
     if ($nivel_usuario == 1 || $nivel_usuario == 2) {
         if ($registro['ref_ref_cod_escola']) {
             $this->addDetalhe(array('Escola', $registro['ref_ref_cod_escola']));
         }
     }
     if ($registro['ref_cod_curso']) {
         $this->addDetalhe(array('Curso', $registro['ref_cod_curso']));
     }
     if ($registro['ref_ref_cod_serie']) {
         $this->addDetalhe(array('Série', $registro['ref_ref_cod_serie']));
     }
     if ($registro['ref_cod_regente']) {
         $obj_pessoa = new clsPessoa_($registro['ref_cod_regente']);
         $det = $obj_pessoa->detalhe();
         $this->addDetalhe(array('Professor/Regente', $det['nome']));
     }
     if ($registro['ref_cod_infra_predio_comodo']) {
         $this->addDetalhe(array('Sala', $registro['ref_cod_infra_predio_comodo']));
     }
     if ($registro['ref_cod_turma_tipo']) {
         $this->addDetalhe(array('Tipo de Turma', $registro['ref_cod_turma_tipo']));
     }
     if ($registro['nm_turma']) {
         $this->addDetalhe(array('Turma', $registro['nm_turma']));
     }
     if ($registro['sgl_turma']) {
         $this->addDetalhe(array('Sigla', $registro['sgl_turma']));
     }
     if ($registro['max_aluno']) {
         $this->addDetalhe(array('Máximo de Alunos', $registro['max_aluno']));
     }
     $this->addDetalhe(array('Situação', dbBool($registro['visivel']) ? 'Ativo' : 'Desativo'));
     if ($registro['multiseriada'] == 1) {
         if ($registro['multiseriada'] == 1) {
             $registro['multiseriada'] = 'sim';
         } else {
             $registro['multiseriada'] = 'não';
         }
         $this->addDetalhe(array('Multi-Seriada', $registro['multiseriada']));
         $obj_serie_mult = new clsPmieducarSerie($registro['ref_ref_cod_serie_mult']);
         $det_serie_mult = $obj_serie_mult->detalhe();
         $this->addDetalhe(array('Série Multi-Seriada', $det_serie_mult['nm_serie']));
     }
     if ($padrao_ano_escolar == 1) {
         if ($registro['hora_inicial']) {
             $registro['hora_inicial'] = date('H:i', strtotime($registro['hora_inicial']));
             $this->addDetalhe(array('Hora Inicial', $registro['hora_inicial']));
         }
         if ($registro['hora_final']) {
             $registro['hora_final'] = date('H:i', strtotime($registro['hora_final']));
             $this->addDetalhe(array('Hora Final', $registro['hora_final']));
         }
         if ($registro['hora_inicio_intervalo']) {
             $registro['hora_inicio_intervalo'] = date('H:i', strtotime($registro['hora_inicio_intervalo']));
             $this->addDetalhe(array('Hora Início Intervalo', $registro['hora_inicio_intervalo']));
         }
         if ($registro['hora_fim_intervalo']) {
             $registro['hora_fim_intervalo'] = date('H:i', strtotime($registro['hora_fim_intervalo']));
             $this->addDetalhe(array('Hora Fim Intervalo', $registro['hora_fim_intervalo']));
         }
     } elseif ($padrao_ano_escolar == 0) {
         $obj = new clsPmieducarTurmaModulo();
         $obj->setOrderby('data_inicio ASC');
         $lst = $obj->lista($this->cod_turma);
         if ($lst) {
             $tabela = '
       <table>
         <tr align="center">
           <td bgcolor="#A1B3BD"><b>Nome</b></td>
           <td bgcolor="#A1B3BD"><b>Data Início</b></td>
           <td bgcolor="#A1B3BD"><b>Data Fim</b></td>
         </tr>';
             $cont = 0;
             foreach ($lst as $valor) {
                 if ($cont % 2 == 0) {
                     $color = ' bgcolor="#E4E9ED" ';
                 } else {
                     $color = ' bgcolor="#FFFFFF" ';
                 }
                 $obj_modulo = new clsPmieducarModulo($valor['ref_cod_modulo']);
                 $det_modulo = $obj_modulo->detalhe();
                 $nm_modulo = $det_modulo['nm_tipo'];
                 $valor['data_inicio'] = dataFromPgToBr($valor['data_inicio']);
                 $valor['data_fim'] = dataFromPgToBr($valor['data_fim']);
                 $tabela .= sprintf('
         <tr>
           <td %s align=left>%s</td>
           <td %s align=left>%s</td>
           <td %s align=left>%s</td>
         </tr>', $color, $nm_modulo, $color, $valor['data_inicio'], $color, $valor['data_fim']);
                 $cont++;
             }
             $tabela .= '</table>';
         }
         if ($tabela) {
             $this->addDetalhe(array('Módulo', $tabela));
         }
         $dias_da_semana = array('' => 'Selecione', 1 => 'Domingo', 2 => 'Segunda', 3 => 'Terça', 4 => 'Quarta', 5 => 'Quinta', 6 => 'Sexta', 7 => 'Sábado');
         $obj = new clsPmieducarTurmaDiaSemana();
         $lst = $obj->lista(NULL, $this->cod_turma);
         if ($lst) {
             $tabela1 = '
       <table>
         <tr align="center">
           <td bgcolor="#A1B3BD"><b>Nome</b></td>
           <td bgcolor="#A1B3BD"><b>Hora Inicial</b></td>
           <td bgcolor="#A1B3BD"><b>Hora Final</b></td>
         </tr>';
             $cont = 0;
             foreach ($lst as $valor) {
                 if ($cont % 2 == 0) {
                     $color = ' bgcolor="#E4E9ED" ';
                 } else {
                     $color = ' bgcolor="#FFFFFF" ';
                 }
                 $valor['hora_inicial'] = date('H:i', strtotime($valor['hora_inicial']));
                 $valor['hora_final'] = date('H:i', strtotime($valor['hora_final']));
                 $tabela1 .= sprintf("\n            <tr>\n              <td %s align=left>%s</td>\n              <td %s align=left>%s</td>\n              <td %s align=left>%s</td>\n            </tr>", $color, $dias_da_semana[$valor['dia_semana']], $color, $valor['hora_inicial'], $color, $valor['hora_final']);
                 $cont++;
             }
             $tabela1 .= '</table>';
         }
         if ($tabela1) {
             $this->addDetalhe(array('Dia da Semana', $tabela1));
         }
     }
     // Recupera os componentes curriculares da turma
     $componentes = array();
     try {
         $componentes = App_Model_IedFinder::getComponentesTurma($this->ref_ref_cod_serie, $this->ref_ref_cod_escola, $this->cod_turma);
     } catch (Exception $e) {
     }
     $tabela3 = '
   <table>
     <tr align="center">
       <td bgcolor="#A1B3BD"><b>Nome</b></td>
       <td bgcolor="#A1B3BD"><b>Carga horária</b></td>
     </tr>';
     $cont = 0;
     foreach ($componentes as $componente) {
         $color = $cont++ % 2 == 0 ? ' bgcolor="#E4E9ED" ' : ' bgcolor="#FFFFFF" ';
         $tabela3 .= sprintf('
     <tr>
       <td %s align="left">%s</td>
       <td %s align="center">%.0f h</td>
     </tr>', $color, $componente, $color, $componente->cargaHoraria);
     }
     $tabela3 .= '</table>';
     $this->addDetalhe(array('Componentes curriculares', $tabela3));
     if ($obj_permissoes->permissao_cadastra(586, $this->pessoa_logada, 7)) {
         $this->url_novo = 'educar_turma_cad.php';
         $this->url_editar = 'educar_turma_cad.php?cod_turma=' . $registro['cod_turma'];
     }
     $this->url_cancelar = 'educar_turma_lst.php';
     $this->largura = '100%';
     $localizacao = new LocalizacaoSistema();
     $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "In&iacute;cio", "educar_index.php" => "i-Educar - Escola", "" => "Detalhe da turma"));
     $this->enviaLocalizacao($localizacao->montar());
     $this->array_botao[] = 'Reclassificar alunos alfabeticamente';
     $this->array_botao_url_script[] = "if(confirm(\"Deseja realmente reclassificar os alunos alfabeticamente?\\nAo utilizar esta opção para esta turma, a ordenação dos alunos no diário e em relatórios que é controlada por ordem de chegada após a data de fechamento da turma (campo Data de fechamento), passará a ter o controle novamente alfabético, desconsiderando a data de fechamento.\"))reclassifica_matriculas({$registro['cod_turma']})";
     Portabilis_View_Helper_Application::loadJQueryLib($this);
     $scripts = array('/modules/Portabilis/Assets/Javascripts/Utils.js', '/modules/Portabilis/Assets/Javascripts/ClientApi.js', '/modules/Cadastro/Assets/Javascripts/TurmaDet.js');
     Portabilis_View_Helper_Application::loadJavascript($this, $scripts);
 }
示例#7
0
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = 'Turma - Detalhe';
     $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet');
     $this->cod_turma = $_GET['cod_turma'];
     $tmp_obj = new clsPmieducarTurma();
     $lst_obj = $tmp_obj->lista($this->cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, array('true', 'false'));
     $registro = array_shift($lst_obj);
     foreach ($registro as $key => $value) {
         $this->{$key} = $value;
     }
     if (!$registro) {
         header('Location: educar_turma_lst.php');
         die;
     }
     if (class_exists('clsPmieducarTurmaTipo')) {
         $obj_ref_cod_turma_tipo = new clsPmieducarTurmaTipo($registro['ref_cod_turma_tipo']);
         $det_ref_cod_turma_tipo = $obj_ref_cod_turma_tipo->detalhe();
         $registro['ref_cod_turma_tipo'] = $det_ref_cod_turma_tipo['nm_tipo'];
     } else {
         $registro['ref_cod_turma_tipo'] = 'Erro na geração';
     }
     if (class_exists('clsPmieducarInfraPredioComodo')) {
         $obj_ref_cod_infra_predio_comodo = new clsPmieducarInfraPredioComodo($registro['ref_cod_infra_predio_comodo']);
         $det_ref_cod_infra_predio_comodo = $obj_ref_cod_infra_predio_comodo->detalhe();
         $registro['ref_cod_infra_predio_comodo'] = $det_ref_cod_infra_predio_comodo['nm_comodo'];
     } else {
         $registro['ref_cod_infra_predio_comodo'] = 'Erro na geração';
     }
     if (class_exists('clsPmieducarInstituicao')) {
         $obj_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']);
         $obj_cod_instituicao_det = $obj_cod_instituicao->detalhe();
         $registro['ref_cod_instituicao'] = $obj_cod_instituicao_det['nm_instituicao'];
     } else {
         $registro['ref_cod_instituicao'] = 'Erro na geração';
     }
     if (class_exists('clsPmieducarEscola')) {
         $this->ref_ref_cod_escola = $registro['ref_ref_cod_escola'];
         $obj_ref_cod_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']);
         $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
         $registro['ref_ref_cod_escola'] = $det_ref_cod_escola['nome'];
     } else {
         $registro['ref_cod_escola'] = 'Erro na geração';
     }
     if (class_exists('clsPmieducarCurso')) {
         $obj_ref_cod_curso = new clsPmieducarCurso($registro['ref_cod_curso']);
         $det_ref_cod_curso = $obj_ref_cod_curso->detalhe();
         $registro['ref_cod_curso'] = $det_ref_cod_curso['nm_curso'];
         $padrao_ano_escolar = $det_ref_cod_curso['padrao_ano_escolar'];
     } else {
         $registro['ref_cod_curso'] = 'Erro na geração';
     }
     if (class_exists('clsPmieducarSerie')) {
         $this->ref_ref_cod_serie = $registro['ref_ref_cod_serie'];
         $obj_ser = new clsPmieducarSerie($registro['ref_ref_cod_serie']);
         $det_ser = $obj_ser->detalhe();
         $registro['ref_ref_cod_serie'] = $det_ser['nm_serie'];
     } else {
         $registro['ref_ref_cod_serie'] = 'Erro na geração';
     }
     $obj_permissoes = new clsPermissoes();
     $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
     if ($nivel_usuario == 1) {
         if ($registro['ref_cod_instituicao']) {
             $this->addDetalhe(array('Instituição', $registro['ref_cod_instituicao']));
         }
     }
     if ($nivel_usuario == 1 || $nivel_usuario == 2) {
         if ($registro['ref_ref_cod_escola']) {
             $this->addDetalhe(array('Escola', $registro['ref_ref_cod_escola']));
         }
     }
     if ($registro['ref_cod_curso']) {
         $this->addDetalhe(array('Curso', $registro['ref_cod_curso']));
     }
     if ($registro['ref_ref_cod_serie']) {
         $this->addDetalhe(array('Série', $registro['ref_ref_cod_serie']));
     }
     if ($registro['ref_cod_regente']) {
         $obj_pessoa = new clsPessoa_($registro['ref_cod_regente']);
         $det = $obj_pessoa->detalhe();
         $this->addDetalhe(array('Professor/Regente', $det['nome']));
     }
     if ($registro['ref_cod_infra_predio_comodo']) {
         $this->addDetalhe(array('Sala', $registro['ref_cod_infra_predio_comodo']));
     }
     if ($registro['ref_cod_turma_tipo']) {
         $this->addDetalhe(array('Tipo de Turma', $registro['ref_cod_turma_tipo']));
     }
     if ($registro['nm_turma']) {
         $this->addDetalhe(array('Turma', $registro['nm_turma']));
     }
     if ($registro['sgl_turma']) {
         $this->addDetalhe(array('Sigla', $registro['sgl_turma']));
     }
     if ($registro['max_aluno']) {
         $this->addDetalhe(array('Máximo de Alunos', $registro['max_aluno']));
     }
     $this->addDetalhe(array('Situação', dbBool($registro['visivel']) ? 'Ativo' : 'Desativo'));
     if ($registro['multiseriada'] == 1) {
         if ($registro['multiseriada'] == 1) {
             $registro['multiseriada'] = 'sim';
         } else {
             $registro['multiseriada'] = 'não';
         }
         $this->addDetalhe(array('Multi-Seriada', $registro['multiseriada']));
         $obj_serie_mult = new clsPmieducarSerie($registro['ref_ref_cod_serie_mult']);
         $det_serie_mult = $obj_serie_mult->detalhe();
         $this->addDetalhe(array('Série Multi-Seriada', $det_serie_mult['nm_serie']));
     }
     if ($padrao_ano_escolar == 1) {
         if ($registro['hora_inicial']) {
             $registro['hora_inicial'] = date('H:i', strtotime($registro['hora_inicial']));
             $this->addDetalhe(array('Hora Inicial', $registro['hora_inicial']));
         }
         if ($registro['hora_final']) {
             $registro['hora_final'] = date('H:i', strtotime($registro['hora_final']));
             $this->addDetalhe(array('Hora Final', $registro['hora_final']));
         }
         if ($registro['hora_inicio_intervalo']) {
             $registro['hora_inicio_intervalo'] = date('H:i', strtotime($registro['hora_inicio_intervalo']));
             $this->addDetalhe(array('Hora Início Intervalo', $registro['hora_inicio_intervalo']));
         }
         if ($registro['hora_fim_intervalo']) {
             $registro['hora_fim_intervalo'] = date('H:i', strtotime($registro['hora_fim_intervalo']));
             $this->addDetalhe(array('Hora Fim Intervalo', $registro['hora_fim_intervalo']));
         }
     } elseif ($padrao_ano_escolar == 0) {
         $obj = new clsPmieducarTurmaModulo();
         $obj->setOrderby('data_inicio ASC');
         $lst = $obj->lista($this->cod_turma);
         if ($lst) {
             $tabela = '
       <table>
         <tr align="center">
           <td bgcolor="#A1B3BD"><b>Nome</b></td>
           <td bgcolor="#A1B3BD"><b>Data Início</b></td>
           <td bgcolor="#A1B3BD"><b>Data Fim</b></td>
         </tr>';
             $cont = 0;
             foreach ($lst as $valor) {
                 if ($cont % 2 == 0) {
                     $color = ' bgcolor="#E4E9ED" ';
                 } else {
                     $color = ' bgcolor="#FFFFFF" ';
                 }
                 $obj_modulo = new clsPmieducarModulo($valor['ref_cod_modulo']);
                 $det_modulo = $obj_modulo->detalhe();
                 $nm_modulo = $det_modulo['nm_tipo'];
                 $valor['data_inicio'] = dataFromPgToBr($valor['data_inicio']);
                 $valor['data_fim'] = dataFromPgToBr($valor['data_fim']);
                 $tabela .= sprintf('
         <tr>
           <td %s align=left>%s</td>
           <td %s align=left>%s</td>
           <td %s align=left>%s</td>
         </tr>', $color, $nm_modulo, $color, $valor['data_inicio'], $color, $valor['data_fim']);
                 $cont++;
             }
             $tabela .= '</table>';
         }
         if ($tabela) {
             $this->addDetalhe(array('Módulo', $tabela));
         }
         $dias_da_semana = array('' => 'Selecione', 1 => 'Domingo', 2 => 'Segunda', 3 => 'Terça', 4 => 'Quarta', 5 => 'Quinta', 6 => 'Sexta', 7 => 'Sábado');
         $obj = new clsPmieducarTurmaDiaSemana();
         $lst = $obj->lista(NULL, $this->cod_turma);
         if ($lst) {
             $tabela1 = '
       <table>
         <tr align="center">
           <td bgcolor="#A1B3BD"><b>Nome</b></td>
           <td bgcolor="#A1B3BD"><b>Hora Inicial</b></td>
           <td bgcolor="#A1B3BD"><b>Hora Final</b></td>
         </tr>';
             $cont = 0;
             foreach ($lst as $valor) {
                 if ($cont % 2 == 0) {
                     $color = ' bgcolor="#E4E9ED" ';
                 } else {
                     $color = ' bgcolor="#FFFFFF" ';
                 }
                 $valor['hora_inicial'] = date('H:i', strtotime($valor['hora_inicial']));
                 $valor['hora_final'] = date('H:i', strtotime($valor['hora_final']));
                 $tabela1 .= sprintf("\n            <tr>\n              <td %s align=left>%s</td>\n              <td %s align=left>%s</td>\n              <td %s align=left>%s</td>\n            </tr>", $color, $dias_da_semana[$valor['dia_semana']], $color, $valor['hora_inicial'], $color, $valor['hora_final']);
                 $cont++;
             }
             $tabela1 .= '</table>';
         }
         if ($tabela1) {
             $this->addDetalhe(array('Dia da Semana', $tabela1));
         }
     }
     // Recupera os componentes curriculares da turma
     $componentes = array();
     try {
         $componentes = App_Model_IedFinder::getComponentesTurma($this->ref_ref_cod_serie, $this->ref_ref_cod_escola, $this->cod_turma);
     } catch (Exception $e) {
     }
     $tabela3 = '
   <table>
     <tr align="center">
       <td bgcolor="#A1B3BD"><b>Nome</b></td>
       <td bgcolor="#A1B3BD"><b>Carga horária</b></td>
     </tr>';
     $cont = 0;
     foreach ($componentes as $componente) {
         $color = $cont++ % 2 == 0 ? ' bgcolor="#E4E9ED" ' : ' bgcolor="#FFFFFF" ';
         $tabela3 .= sprintf('
     <tr>
       <td %s align="left">%s</td>
       <td %s align="center">%.0f h</td>
     </tr>', $color, $componente, $color, $componente->cargaHoraria);
     }
     $tabela3 .= '</table>';
     $this->addDetalhe(array('Componentes curriculares', $tabela3));
     if ($obj_permissoes->permissao_cadastra(586, $this->pessoa_logada, 7)) {
         $this->url_novo = 'educar_turma_cad.php';
         $this->url_editar = 'educar_turma_cad.php?cod_turma=' . $registro['cod_turma'];
     }
     $this->url_cancelar = 'educar_turma_lst.php';
     $this->largura = '100%';
 }
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = 'Matricula Turma - Detalhe';
     $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet');
     foreach ($_POST as $key => $value) {
         $this->{$key} = $value;
     }
     $obj_mat_turma = new clsPmieducarMatriculaTurma();
     $det_mat_turma = $obj_mat_turma->lista($this->ref_cod_matricula, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
     if ($det_mat_turma) {
         $det_mat_turma = array_shift($det_mat_turma);
         $obj_turma = new clsPmieducarTurma($det_mat_turma['ref_cod_turma']);
         $det_turma = $obj_turma->detalhe();
         $this->nm_turma = $det_turma['nm_turma'];
         $this->ref_cod_turma_origem = $det_turma['cod_turma'];
         $this->sequencial = $det_mat_turma['sequencial'];
     }
     $tmp_obj = new clsPmieducarMatriculaTurma();
     $lista = $tmp_obj->lista(NULL, $this->ref_cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1);
     $total_alunos = 0;
     if ($lista) {
         $total_alunos = count($lista);
     }
     $tmp_obj = new clsPmieducarTurma();
     $lst_obj = $tmp_obj->lista($this->ref_cod_turma);
     $registro = array_shift($lst_obj);
     $this->ref_cod_curso = $registro['ref_cod_curso'];
     if (!$registro || !$_POST) {
         header('Location: educar_matricula_lst.php');
         die;
     }
     // Tipo da turma
     $obj_ref_cod_turma_tipo = new clsPmieducarTurmaTipo($registro['ref_cod_turma_tipo']);
     $det_ref_cod_turma_tipo = $obj_ref_cod_turma_tipo->detalhe();
     $registro['ref_cod_turma_tipo'] = $det_ref_cod_turma_tipo['nm_tipo'];
     // Código da instituição
     $obj_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']);
     $obj_cod_instituicao_det = $obj_cod_instituicao->detalhe();
     $registro['ref_cod_instituicao'] = $obj_cod_instituicao_det['nm_instituicao'];
     // Nome da escola
     $obj_ref_cod_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']);
     $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
     $registro['ref_ref_cod_escola'] = $det_ref_cod_escola['nome'];
     // Nome do curso
     $obj_ref_cod_curso = new clsPmieducarCurso($registro['ref_cod_curso']);
     $det_ref_cod_curso = $obj_ref_cod_curso->detalhe();
     $registro['ref_cod_curso'] = $det_ref_cod_curso['nm_curso'];
     $padrao_ano_escolar = $det_ref_cod_curso['padrao_ano_escolar'];
     // Nome da série
     $obj_ser = new clsPmieducarSerie($registro['ref_ref_cod_serie']);
     $det_ser = $obj_ser->detalhe();
     $registro['ref_ref_cod_serie'] = $det_ser['nm_serie'];
     // Matrícula
     $obj_ref_cod_matricula = new clsPmieducarMatricula();
     $detalhe_aluno = array_shift($obj_ref_cod_matricula->lista($this->ref_cod_matricula));
     $obj_aluno = new clsPmieducarAluno();
     $det_aluno = array_shift($det_aluno = $obj_aluno->lista($detalhe_aluno['ref_cod_aluno'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1));
     $obj_escola = new clsPmieducarEscola($this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
     $det_escola = $obj_escola->detalhe();
     $this->addDetalhe(array('Nome do Aluno', $det_aluno['nome_aluno']));
     $objTemp = new clsPmieducarTurma($this->ref_cod_turma);
     $det_turma = $objTemp->detalhe();
     if ($registro['ref_ref_cod_escola']) {
         $this->addDetalhe(array('Escola', $registro['ref_ref_cod_escola']));
     }
     if ($registro['ref_cod_curso']) {
         $this->addDetalhe(array('Curso', $registro['ref_cod_curso']));
     }
     if ($registro['ref_ref_cod_serie']) {
         $this->addDetalhe(array('S&eacute;rie', $registro['ref_ref_cod_serie']));
     }
     $this->addDetalhe(array('Turma atual', $this->nm_turma));
     if ($registro['nm_turma']) {
         $this->addDetalhe(array('Turma destino', $registro['nm_turma']));
     }
     if ($registro['max_aluno']) {
         $this->addDetalhe(array('Total de vagas', $registro['max_aluno']));
     }
     if (is_numeric($total_alunos)) {
         $this->addDetalhe(array('Alunos nesta turma', $total_alunos));
         $this->addDetalhe(array('Vagas restantes', $registro['max_aluno'] - $total_alunos));
     }
     $this->addDetalhe(array('-', sprintf('
     <form name="formcadastro" method="post" action="educar_matricula_turma_cad.php">
       <input type="hidden" name="ref_cod_matricula" value="">
       <input type="hidden" name="ref_cod_serie" value="">
       <input type="hidden" name="ref_cod_escola" value="">
       <input type="hidden" name="ref_cod_turma_origem" value="%d">
       <input type="hidden" name="ref_cod_turma_destino" value="">
       <input type="hidden" name="sequencial" value="%d">
     </form>
   ', $this->ref_cod_turma_origem, $this->sequencial)));
     if ($registro['max_aluno'] - $total_alunos <= 0) {
         $msg = sprintf('Atenção! Turma sem vagas! Deseja continuar com a enturmação mesmo assim?');
         $valida = sprintf('if (!confirm("%s")) return false;', $msg);
     } else {
         $valida = 'if (!confirm("Confirmar a enturmação?")) return false;';
     }
     $script = sprintf('
   <script type="text/javascript">
     function enturmar(ref_cod_matricula, ref_cod_turma_destino){
       %s
       document.formcadastro.ref_cod_matricula.value = ref_cod_matricula;
       document.formcadastro.ref_cod_turma_destino.value = ref_cod_turma_destino;
       document.formcadastro.submit();
     }
   </script>', $valida);
     print $script;
     $obj_permissoes = new clsPermissoes();
     if ($obj_permissoes->permissao_cadastra(578, $this->pessoa_logada, 7)) {
         $script = "enturmar({$this->ref_cod_matricula},{$this->ref_cod_turma})";
         $this->array_botao = array('Transferir Aluno');
         $this->array_botao_url_script = array($script);
     }
     $this->array_botao[] = 'Voltar';
     $this->array_botao_url_script[] = "go(\"educar_matricula_turma_lst.php?ref_cod_matricula={$this->ref_cod_matricula}\");";
     $this->largura = '100%';
 }