_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this); // check for action permissions. if (!CRM_Core_Permission::checkActionPermission('CiviMail', $this->_action)) { CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.')); } $mailing = new CRM_Mailing_BAO_Mailing(); $mailing->id = $this->_mailingId; $subject = ''; if ($mailing->find(TRUE)) { $subject = $mailing->subject; } $this->assign('subject', $subject); } /** * Build the form object. */ public function buildQuickForm() { $this->addButtons([ [ 'type' => 'next', 'name' => ts('Confirm'), 'isDefault' => TRUE, ], [ 'type' => 'cancel', 'name' => ts('Cancel'), ], ]); } public function postProcess() { if ($this->_action & CRM_Core_Action::DELETE) { CRM_Mailing_BAO_Mailing::del($this->_mailingId); } elseif ($this->_action & CRM_Core_Action::DISABLE) { CRM_Mailing_BAO_MailingJob::cancel($this->_mailingId); CRM_Core_Session::setStatus(ts('The mailing has been canceled.'), ts('Canceled'), 'success'); } elseif ($this->_action & CRM_Core_Action::RENEW) { //set is_archived to 1 CRM_Core_DAO::setFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingId, 'is_archived', TRUE); } } }