3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Page to display / edit the header / footer of a mailing.
21 class CRM_Mailing_Page_Report
extends CRM_Core_Page_Basic
{
30 public function getBAOName() {
31 return 'CRM_Mailing_BAO_Mailing';
35 * An array of action links.
39 public function &links() {
40 return CRM_Core_DAO
::$_nullObject;
46 public function editForm() {
53 public function editName() {
54 return 'CiviMail Report';
65 public function userContext($mode = NULL) {
66 return 'civicrm/mailing/report';
74 public function userContextParams($mode = NULL) {
75 return 'reset=1&mid=' . $this->_mailing_id
;
81 public function run() {
82 $this->_mailing_id
= CRM_Utils_Request
::retrieve('mid', 'Positive', $this);
83 //CRM-15979 - check if abtest exist for mailing then redirect accordingly
84 $abtest = CRM_Mailing_BAO_MailingAB
::getABTest($this->_mailing_id
);
85 if (!empty($abtest) && !empty($abtest->id
)) {
86 CRM_Utils_System
::redirect(CRM_Utils_System
::url('civicrm/a/', NULL, TRUE, '/abtest/' . $abtest->id
));
88 // check that the user has permission to access mailing id
89 CRM_Mailing_BAO_Mailing
::checkPermission($this->_mailing_id
);
91 $report = CRM_Mailing_BAO_Mailing
::report($this->_mailing_id
);
93 // get contents of mailing
94 CRM_Mailing_BAO_Mailing
::getMailingContent($report, $this);
97 $context = CRM_Utils_Request
::retrieve('context', 'Alphanumeric', $this);
98 $cid = CRM_Utils_Request
::retrieve('cid', 'Positive', $this);
100 if ($context == 'activitySelector') {
101 $backUrl = CRM_Utils_System
::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
102 $backUrlTitle = ts('Back to Activities');
104 elseif ($context == 'activity') {
105 $atype = CRM_Utils_Request
::retrieve('atype', 'Positive', $this);
106 $aid = CRM_Utils_Request
::retrieve('aid', 'Positive', $this);
108 $backUrl = CRM_Utils_System
::url('civicrm/activity/view',
109 "atype={$atype}&action=view&reset=1&id={$aid}&cid={$cid}&context=activity"
111 $backUrlTitle = ts('Back to Activity');
113 elseif ($context == 'mailing') {
114 $backUrl = CRM_Utils_System
::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing");
115 $backUrlTitle = ts('Back to Mailing');
118 $backUrl = CRM_Utils_System
::url('civicrm/mailing', 'reset=1');
119 $backUrlTitle = ts('Back to CiviMail');
121 $this->assign('backUrl', $backUrl);
122 $this->assign('backUrlTitle', $backUrlTitle);
124 $this->assign('report', $report);
125 CRM_Utils_System
::setTitle(ts('CiviMail Report: %1',
126 [1 => $report['mailing']['name']]
128 $this->assign('public_url', CRM_Mailing_BAO_Mailing
::getPublicViewUrl($this->_mailing_id
));
130 return CRM_Core_Page
::run();