/** * Allows a user to delete a workshop category * */ public function deleteAction() { $get = Zend_Registry::get('getFilter'); if (!isset($get->categoryId)) { throw new Ot_Exception_Input('msg-error-categoryIdNotSet'); } $category = new Category(); $thisCategory = $category->find($get->categoryId); if (is_null($thisCategory)) { throw new Ot_Exception_Data('msg-error-category'); } $this->view->category = $thisCategory; $form = Ot_Form_Template::delete('deleteForm'); if ($this->_request->isPost() && $form->isValid($_POST)) { $where = $category->getAdapter()->quoteInto('categoryId = ?', $get->categoryId); $category->delete($where); $this->_helper->flashMessenger->addMessage('msg-info-categoryDeleted'); $this->_helper->redirector->gotoUrl('/workshop/category/index'); } $this->_helper->pageTitle('workshop-category-delete:title'); $this->view->form = $form; }