function Novo() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(597, $this->pessoa_logada, 11, "educar_exemplar_tipo_lst.php"); $array_tipos = array(); foreach ($_POST as $key => $cliente_tipo) { if (substr($key, 0, 5) == "tipo_") { $array_tipos[substr($key, 5)] = $cliente_tipo; } } $obj = new clsPmieducarExemplarTipo(null, $this->ref_cod_biblioteca, null, $this->pessoa_logada, $this->nm_tipo, $this->descricao, null, null, 1); $cadastrou = $obj->cadastra(); if ($cadastrou) { //-----------------------CADASTRA CLIENTE TIPO------------------------// if ($array_tipos) { foreach ($array_tipos as $cliente_tipo => $dias_emprestimo) { $obj = new clsPmieducarClienteTipoExemplarTipo($cliente_tipo, $cadastrou, $dias_emprestimo); $cadastrou2 = $obj->cadastra(); if (!$cadastrou2) { $this->mensagem = "Cadastro não realizado.<br>"; echo "<!--\nErro ao cadastrar clsPmieducarClienteTipoExemplarTipo\nvalores obrigatórios\nis_numeric( {$cadastrou} ) && is_numeric( {$cliente_tipo} ) && is_numeric( {$dias_emprestimo} )\n-->"; return false; } } } //-----------------------FIM CADASTRA CLIENTE TIPO------------------------// $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; header("Location: educar_exemplar_tipo_lst.php"); die; return true; } $this->mensagem = "Cadastro não realizado.<br>"; echo "<!--\nErro ao cadastrar clsPmieducarExemplarTipo\nvalores obrigatórios\nis_numeric( {$this->ref_cod_biblioteca} ) && is_numeric( {$this->pessoa_logada} ) && is_string( {$this->nm_tipo} )\n-->"; return false; }
function Editar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj_permissoes = new clsPermissoes(); $obj_permissoes->permissao_cadastra(596, $this->pessoa_logada, 11, "educar_cliente_tipo_lst.php"); $array_tipos = array(); foreach ($_POST as $key => $exemplar_tipo) { if (substr($key, 0, 5) == "tipo_") { $array_tipos[substr($key, 5)] = $exemplar_tipo; } } $obj = new clsPmieducarClienteTipo($this->cod_cliente_tipo, $this->ref_cod_biblioteca, $this->pessoa_logada, null, $this->nm_tipo, $this->descricao, null, null, 1); $editou = $obj->edita(); if ($editou) { //-----------------------EDITA EXEMPLAR TIPO------------------------// if ($array_tipos) { foreach ($array_tipos as $exemplar_tipo => $dias_emprestimo) { $obj = new clsPmieducarClienteTipoExemplarTipo($this->cod_cliente_tipo, $exemplar_tipo, $dias_emprestimo); if ($obj->existe() == false) { $result = $obj->cadastra(); } else { $result = $obj->edita(); } if (!$result) { $this->mensagem = "Aparentemente ocorreu um erro ao gravar os dias de emprestimo.<br>"; return false; } } } //-----------------------FIM EDITA EXEMPLAR TIPO------------------------// $this->mensagem .= "Edição efetuada com sucesso.<br>"; header("Location: educar_cliente_tipo_lst.php"); die; return true; } $this->mensagem = "Edição não realizada.<br>"; echo "<!--\nErro ao editar clsPmieducarClienteTipo\nvalores obrigatorios\nif( is_numeric( {$this->cod_cliente_tipo} ) && is_numeric( {$this->pessoa_logada} ) )\n-->"; return false; }