4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.5 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2014 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
32 * @copyright CiviCRM LLC (c) 2004-2014
38 * Build the form for disable mail feature
45 class CRM_Mailing_Form_Browse
extends CRM_Core_Form
{
48 * Heart of the viewing process. The runner gets all the meta data for
49 * the contact and calls the appropriate type of page to view.
55 function preProcess() {
56 $this->_mailingId
= CRM_Utils_Request
::retrieve('mid', 'Positive', $this);
57 $this->_action
= CRM_Utils_Request
::retrieve('action', 'String', $this);
59 // check for action permissions.
60 if (!CRM_Core_Permission
::checkActionPermission('CiviMail', $this->_action
)) {
61 CRM_Core_Error
::fatal(ts('You do not have permission to access this page'));
64 $mailing = new CRM_Mailing_BAO_Mailing();
65 $mailing->id
= $this->_mailingId
;
67 if ($mailing->find(TRUE)) {
68 $subject = $mailing->subject
;
70 $this->assign('subject', $subject);
74 * Function to actually build the form
80 public function buildQuickForm() {
81 $this->addButtons(array(
84 'name' => ts('Confirm'),
89 'name' => ts('Cancel'),
101 public function postProcess() {
102 if ($this->_action
& CRM_Core_Action
::DELETE
) {
103 CRM_Mailing_BAO_Mailing
::del($this->_mailingId
);
105 elseif ($this->_action
& CRM_Core_Action
::DISABLE
) {
106 CRM_Mailing_BAO_MailingJob
::cancel($this->_mailingId
);
108 elseif ($this->_action
& CRM_Core_Action
::RENEW
) {
109 //set is_archived to 1
110 CRM_Core_DAO
::setFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingId
, 'is_archived', TRUE);