function Novo() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $backUrl = sprintf('educar_servidor_formacao_lst.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, $backUrl); $obj = new clsPmieducarServidorFormacao(NULL, NULL, $this->pessoa_logada, $this->ref_cod_servidor, $this->nm_formacao, $this->tipo, $this->descricao, NULL, NULL, $this->ativo, $this->ref_cod_instituicao); $cadastrou = $obj->cadastra(); if ($cadastrou) { if ($this->tipo == 'C') { $obj = new clsPmieducarServidorCurso(NULL, $cadastrou, dataToBanco($this->data_conclusao), dataToBanco($this->data_registro), $this->diplomas_registros); if ($obj->cadastra()) { $this->mensagem .= 'Cadastro efetuado com sucesso.<br>'; header('Location: ' . $backUrl); die; } } elseif ($this->tipo == 'T' || $this->tipo == 'O') { $obj = new clsPmieducarServidorTituloConcurso(NULL, $cadastrou, dataToBanco($this->data_vigencia_homolog), dataToBanco($this->data_publicacao)); if ($obj->cadastra()) { $this->mensagem .= 'Cadastro efetuado com sucesso.<br>'; header('Location: ' . $backUrl); die; } } } $this->mensagem = 'Cadastro não realizado.<br>'; return FALSE; }