function admindeleteAction() { $this->_helper->layout->setLayout("layout_admin"); $this->view->title = "Delete Plan"; if (!$this->_request->isPost()) { $id = (int) $this->_request->getParam('plan_id'); $type = $this->_request->getParam('type'); if ($id > 0) { //first, delete the telephone log or sms if ($type == "TELEPHONE") { $telephoneLogModel = new TelephoneLog(); $telephoneLogModel->deleteByPlan($id); } else { if ($type == "SMS") { $shortMessageModel = new ShortMessage(); $shortMessageModel->deleteByPlan($id); } else { } } //second, delete the plan $telephonePlanModel = new TelephonePlan(); $where = 'id = ' . $id; $telephonePlanModel->delete($where); } } //$this->_helper->json($type); $this->_redirect('conversation/adminindex'); }