function Novo() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $permite_cadastrar = $obj_permissoes->permissao_cadastra(829, $this->pessoa_logada, 3, "", true); if (!$permite_cadastrar) { echo "<script>window.parent.fechaExpansivel( '{$_GET['div']}');</script>"; die; } $obj = new clsPmieducarSubnivel(null, $this->pessoa_logada, $this->pessoa_logada, null, $this->ref_cod_nivel); $obj->desativaTodos(); if ($this->nm_nivel) { $nivel_anterior = null; foreach ($this->nm_nivel as $id => $nm_nivel) { $obj_nivel = new clsPmieducarSubnivel($this->cod_nivel[$id], $this->pessoa_logada, $this->pessoa_logada, $nivel_anterior, $this->ref_cod_nivel, $nm_nivel, null, null, 1, str_replace(',', '.', str_replace('.', '', $this->salario_base[$id]))); if ($obj_nivel->existe()) { $obj_nivel->edita(); $nivel_anterior = $this->cod_nivel[$id]; } else { $nivel_anterior = $obj_nivel->cadastra(); } } echo "<script>window.parent.fechaExpansivel( '{$_GET['div']}');</script>"; die; } $this->mensagem = "Cadastro não realizado.<br>"; echo "<!--\nErro ao cadastrar clsPmieducarNivel\nvalores obrigatorios\nis_numeric( {$this->ref_cod_categoria_nivel} ) && is_numeric( {$this->ref_usuario_cad} ) && is_numeric( {$this->ref_cod_nivel_anterior} ) && is_string( {$this->nm_nivel} )\n-->"; return false; }
function Novo() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(829, $this->pessoa_logada, 3, "educar_categoria_nivel_det.php?cod_categoria_nivel={$this->cod_nivel}", true); $obj = new clsPmieducarNivel($this->cod_nivel, $this->ref_cod_categoria_nivel, $this->pessoa_logada, $this->pessoa_logada, $this->ref_cod_nivel_anterior, $this->nm_nivel, $this->salario_base, $this->data_cadastro, $this->data_exclusao, $this->ativo); $obj->desativaTodos(); if ($this->nm_nivel) { $nivel_anterior = null; $niveis = array(); foreach ($this->nm_nivel as $id => $nm_nivel) { $obj_nivel = new clsPmieducarNivel($this->cod_nivel[$id], $this->ref_cod_categoria_nivel, $this->pessoa_logada, $this->pessoa_logada, $nivel_anterior, $nm_nivel, str_replace(',', '.', str_replace('.', '', $this->salario_base[$id])), null, null, 1); if ($obj_nivel->existe()) { $obj_nivel->edita(); $nivel_anterior = $this->cod_nivel[$id]; } else { $nivel_anterior = $obj_nivel->cadastra(); } $niveis[] = $nivel_anterior; } /** * desativa todos os subniveis dos niveis que nao se * encontram ativos */ if ($niveis) { $obj = new clsPmieducarSubnivel(null, $this->pessoa_logada, $this->pessoa_logada, null, $this->ref_cod_nivel); $obj->desativaTodos($niveis); } header("location:educar_categoria_nivel_det.php?cod_categoria_nivel={$this->ref_cod_categoria_nivel}"); die; return true; } $this->mensagem = "Cadastro não realizado.<br>"; echo "<!--\nErro ao cadastrar clsPmieducarNivel\nvalores obrigatorios\nis_numeric( {$this->ref_cod_categoria_nivel} ) && is_numeric( {$this->ref_usuario_cad} ) && is_numeric( {$this->ref_cod_nivel_anterior} ) && is_string( {$this->nm_nivel} )\n-->"; return false; }