_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE); $params = ['id' => $this->_surveyId]; CRM_Campaign_BAO_Survey::retrieve($params, $surveyInfo); $this->_surveyTitle = $surveyInfo['title']; $this->assign('surveyTitle', $this->_surveyTitle); CRM_Utils_System::setTitle(ts('Delete Survey') . ' - ' . $this->_surveyTitle); } /** * Build the form object. */ public function buildQuickForm() { $this->addButtons([ [ 'type' => 'next', 'name' => ts('Delete'), 'isDefault' => TRUE, ], [ 'type' => 'cancel', 'name' => ts('Cancel'), ], ]); } /** * Process the form when submitted. */ public function postProcess() { if ($this->_surveyId) { CRM_Campaign_BAO_Survey::del($this->_surveyId); CRM_Core_Session::setStatus('', ts("'%1' survey has been deleted.", [1 => $this->_surveyTitle]), 'success'); CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey')); } else { CRM_Core_Error::fatal(ts('Delete action is missing expected survey ID.')); } } }