コード例 #1
0
 /**
  * @Created By : Mahipal Singh Adhikari
  * @Created On : 5-Jan-2011
  * @Description: This function used to delete user(simply change user status as 'deleted')
  */
 public function deleteAction()
 {
     $id = $this->_getParam('id');
     $type = $this->_getParam('type');
     $catM = new Application_Model_Category();
     //$catM->delete("id={$id}");
     $catRes = $catM->find($id);
     if ($catRes) {
         $catRes->setStatus('deleted');
         $catRes->save();
         //delete all data associated with category
         $catM->deleteCategoryData($id);
         //set message
         $msg = "Category has been deleted successfully!";
     } else {
         $msg = "Invalid request, no category found!";
     }
     //set mesage in session and redirect user to index
     $_SESSION['errorMsg'] = $msg;
     $this->_helper->redirector('index', 'category', "admin", array('type' => $type));
 }