public function deleteAction() { if (!Zend_Auth::getInstance()->hasIdentity()) { throw new Zend_Exception("You can't edit this item"); } $id = $this->getRequest()->getParam("id"); $pagesModel = new Model_DbTable_Pages(); $page = $pagesModel->find($id)->current(); if (!$page) { throw new Zend_Exception("Selected page not found"); } if ($this->getRequest()->getParam("accept") == "accepted") { $page->delete(); $this->_redirect("/sections/media"); exit; } else { $this->view->page = $page; } }