function delete() { $cat = new category_news(); $news = new news(); if ($this->db->check_delete($news->table, $this->key, $_POST['cid']) > 0) { $this->db->alert('You must delete news first.'); security::redirect($news->module, 'list'); return false; } $this->db->delete_record($this->table, $this->key, $_POST['cid']); $cat->delete($this->key); }