phpcs - Fix error, "Visibility must be declared on method"
[civicrm-core.git] / CRM / Mailing / Form / Browse.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4 +--------------------------------------------------------------------+
39de6fd5 5 | CiviCRM version 4.6 |
6a488035 6 +--------------------------------------------------------------------+
06b69b18 7 | Copyright CiviCRM LLC (c) 2004-2014 |
6a488035
TO
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
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. |
14 | |
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. |
19 | |
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 +--------------------------------------------------------------------+
27*/
28
29/**
30 *
31 * @package CRM
06b69b18 32 * @copyright CiviCRM LLC (c) 2004-2014
6a488035
TO
33 * $Id$
34 *
35 */
36
37/**
c490a46a 38 * Build the form object for disable mail feature
6a488035
TO
39 *
40 * @param
41 *
42 * @return void
43 * @access public
44 */
45class CRM_Mailing_Form_Browse extends CRM_Core_Form {
46
47 /**
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.
50 *
51 * @return void
52 * @access public
53 *
54 */
00be9182 55 public function preProcess() {
6a488035
TO
56 $this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
57 $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
58
59 // check for action permissions.
60 if (!CRM_Core_Permission::checkActionPermission('CiviMail', $this->_action)) {
0499b0ad 61 CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
6a488035
TO
62 }
63
64 $mailing = new CRM_Mailing_BAO_Mailing();
65 $mailing->id = $this->_mailingId;
66 $subject = '';
67 if ($mailing->find(TRUE)) {
68 $subject = $mailing->subject;
69 }
70 $this->assign('subject', $subject);
71 }
72
73 /**
c490a46a 74 * Build the form object
6a488035 75 *
355ba699 76 * @return void
6a488035
TO
77 * @access public
78 */
79
80 public function buildQuickForm() {
81 $this->addButtons(array(
82 array(
83 'type' => 'next',
84 'name' => ts('Confirm'),
85 'isDefault' => TRUE,
86 ),
87 array(
88 'type' => 'cancel',
89 'name' => ts('Cancel'),
90 ),
91 )
92 );
93 }
94
95 /**
6a488035
TO
96 * @access public
97 *
355ba699 98 * @return void
6a488035
TO
99 */
100 public function postProcess() {
101 if ($this->_action & CRM_Core_Action::DELETE) {
102 CRM_Mailing_BAO_Mailing::del($this->_mailingId);
103 }
104 elseif ($this->_action & CRM_Core_Action::DISABLE) {
9da8dc8c 105 CRM_Mailing_BAO_MailingJob::cancel($this->_mailingId);
6a488035
TO
106 }
107 elseif ($this->_action & CRM_Core_Action::RENEW) {
108 //set is_archived to 1
109 CRM_Core_DAO::setFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingId, 'is_archived', TRUE);
110 }
111 }
6a488035
TO
112}
113