function Novo() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $this->data_falta_atraso = Portabilis_Date_Utils::brToPgSQL($this->data_falta_atraso); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, sprintf('educar_falta_atraso_lst.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao)); if ($this->tipo == 1) { $obj = new clsPmieducarFaltaAtraso(NULL, $this->ref_cod_escola, $this->ref_cod_instituicao, NULL, $this->pessoa_logada, $this->ref_cod_servidor, $this->tipo, $this->data_falta_atraso, $this->qtd_horas, $this->qtd_min, $this->justificada, NULL, NULL, 1); } elseif ($this->tipo == 2) { $db = new clsBanco(); $dia_semana = $db->CampoUnico(sprintf('(SELECT EXTRACT (DOW FROM date \'%s\') + 1 )', $this->data_falta_atraso)); $obj_ser = new clsPmieducarServidor(); $horas = $obj_ser->qtdhoras($this->ref_cod_servidor, $this->ref_cod_escola, $this->ref_cod_instituicao, $dia_semana); if ($horas) { $obj = new clsPmieducarFaltaAtraso(NULL, $this->ref_cod_escola, $this->ref_cod_instituicao, NULL, $this->pessoa_logada, $this->ref_cod_servidor, $this->tipo, $this->data_falta_atraso, $horas['hora'], $horas['min'], $this->justificada, NULL, NULL, 1); } } $cadastrou = $obj->cadastra(); if ($cadastrou) { $this->mensagem .= 'Cadastro efetuado com sucesso.<br />'; header('Location: ' . sprintf('educar_falta_atraso_lst.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao)); die; } $this->mensagem = 'Cadastro não realizado.<br />'; echo "<!--\nErro ao cadastrar clsPmieducarFaltaAtraso\nvalores obrigatórios\nis_numeric( {$this->ref_cod_escola} ) && is_numeric({$this->ref_ref_cod_instituicao}) && is_numeric({$this->ref_usuario_exc}) && is_numeric({$this->ref_usuario_cad}) && is_numeric({$this->ref_cod_servidor}) && is_numeric({$this->tipo}) && is_string({$this->data_falta_atraso}) && is_numeric({$this->justificada})\n-->"; return FALSE; }