public function delete() { try { if (isset($_GET["_token"]) && is_numeric($_GET["_token"])) { $oProf = Sessao::getObject("oProf"); $oAprop = new Apropriacao(); $oAprop->setId($_GET["_token"]); $oAprop->getById(); // só pode excluir apropriação do próprio usuario if ($oAprop) { if ($oAprop->getCodProfFuncao() == $oProf->getCodProfFuncao()) { $oAprop->delete(); } else { $this->view->setValue("MSG", "Erro não foi possivel excluir"); } } else { $this->view->setValue("MSG", "Erro não foi possivel excluir"); } } else { $this->view->setValue("MSG", "Erro não foi possivel excluir"); } $this->show(); } catch (Exception $e) { $this->view->setValue("MSG", $e->getMessage()); } }